tools/include/xen/*
tools/include/xen-foreign/*.(c|h|size)
tools/include/xen-foreign/checker
-tools/libxen/libxenapi-
-tools/libxen/test/test_bindings
-tools/libxen/test/test_event_handling
tools/libxl/libxlu_cfg_y.output
tools/libxl/xl
tools/libxl/testenum
^tools/include/xen/.*$
^tools/include/xen-foreign/.*\.(c|h|size)$
^tools/include/xen-foreign/checker$
-^tools/libxen/libxenapi-
-^tools/libxen/test/test_bindings$
-^tools/libxen/test/test_event_handling$
^tools/libxl/_.*\.h$
^tools/libxl/_.*\.c$
^tools/libxl/libxlu_cfg_y\.output$
# Optional components
XENSTAT_XENTOP := @monitors@
-LIBXENAPI_BINDINGS := @xenapi@
OCAML_TOOLS := @ocamltools@
FLASK_POLICY := @xsmpolicy@
CONFIG_OVMF := @ovmf@
SUBDIRS-$(CONFIG_NetBSD) += blktap2
SUBDIRS-$(CONFIG_NetBSD) += xenbackendd
SUBDIRS-y += libfsimage
-SUBDIRS-$(LIBXENAPI_BINDINGS) += libxen
SUBDIRS-$(CONFIG_Linux) += libvchan
# do not recurse in to a dir we are about to delete
ovmf
xsmpolicy
ocamltools
-xenapi
monitors
githttp
FILE_OFFSET_BITS
enable_largefile
enable_githttp
enable_monitors
-enable_xenapi
enable_ocamltools
enable_xsmpolicy
enable_ovmf
DISABLED)
--disable-monitors Disable xenstat and xentop monitoring tools (default
is ENABLED)
- --enable-xenapi Enable Xen API Bindings (default is DISABLED)
--disable-ocamltools Disable Ocaml tools (default is ENABLED)
--disable-xsmpolicy Disable XSM policy compilation (default is ENABLED)
--enable-ovmf Enable OVMF (default is DISABLED)
-# Check whether --enable-xenapi was given.
-if test "${enable_xenapi+set}" = set; then :
- enableval=$enable_xenapi;
-fi
-
-
-if test "x$enable_xenapi" = "xno"; then :
-
- ax_cv_xenapi="n"
-
-elif test "x$enable_xenapi" = "xyes"; then :
-
- ax_cv_xenapi="y"
-
-elif test -z $ax_cv_xenapi; then :
-
- ax_cv_xenapi="n"
-
-fi
-xenapi=$ax_cv_xenapi
-
-
-
# Check whether --enable-ocamltools was given.
if test "${enable_ocamltools+set}" = set; then :
enableval=$enable_ocamltools;
if test x"${PERL}" = x"no"
then
as_fn_error $? "Unable to find perl, please install perl" "$LINENO" 5
-fi
-if test "x$xenapi" = "xy"; then :
-
- # Extract the first word of "curl-config", so it can be a program name with args.
-set dummy curl-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_CURL+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- case $CURL in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_CURL="$CURL" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_CURL="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- test -z "$ac_cv_path_CURL" && ac_cv_path_CURL="no"
- ;;
-esac
-fi
-CURL=$ac_cv_path_CURL
-if test -n "$CURL"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CURL" >&5
-$as_echo "$CURL" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-if test x"${CURL}" = x"no"
-then
- as_fn_error $? "Unable to find curl-config, please install curl-config" "$LINENO" 5
-fi
- # Extract the first word of "xml2-config", so it can be a program name with args.
-set dummy xml2-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_XML+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- case $XML in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_XML="$XML" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_XML="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- test -z "$ac_cv_path_XML" && ac_cv_path_XML="no"
- ;;
-esac
-fi
-XML=$ac_cv_path_XML
-if test -n "$XML"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XML" >&5
-$as_echo "$XML" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-if test x"${XML}" = x"no"
-then
- as_fn_error $? "Unable to find xml2-config, please install xml2-config" "$LINENO" 5
-fi
-
fi
for ac_prog in gawk mawk nawk awk
do
# Enable/disable options
AX_ARG_DEFAULT_DISABLE([githttp], [Download GIT repositories via HTTP])
AX_ARG_DEFAULT_ENABLE([monitors], [Disable xenstat and xentop monitoring tools])
-AX_ARG_DEFAULT_DISABLE([xenapi], [Enable Xen API Bindings])
AX_ARG_DEFAULT_ENABLE([ocamltools], [Disable Ocaml tools])
AX_ARG_DEFAULT_ENABLE([xsmpolicy], [Disable XSM policy compilation])
AX_ARG_DEFAULT_DISABLE([ovmf], [Enable OVMF])
AC_PATH_PROG([BISON], [bison])
AC_PATH_PROG([FLEX], [flex])
AX_PATH_PROG_OR_FAIL([PERL], [perl])
-AS_IF([test "x$xenapi" = "xy"], [
- AX_PATH_PROG_OR_FAIL([CURL], [curl-config])
- AX_PATH_PROG_OR_FAIL([XML], [xml2-config])
-])
AS_IF([test "x$ocamltools" = "xy"], [
AC_PROG_OCAML
AC_PROG_FINDLIB
+++ /dev/null
-
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations
-below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-\f
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it
-becomes a de-facto standard. To achieve this, non-free programs must
-be allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-\f
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control
-compilation and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-\f
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-\f
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-\f
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at least
- three years, to give the same user the materials specified in
- Subsection 6a, above, for a charge no more than the cost of
- performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-\f
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-\f
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply, and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License
-may add an explicit geographical distribution limitation excluding those
-countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-\f
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-\f
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms
-of the ordinary General Public License).
-
- To apply these terms, attach the following notices to the library.
-It is safest to attach them to the start of each source file to most
-effectively convey the exclusion of warranty; and each file should
-have at least the "copyright" line and a pointer to where the full
-notice is found.
-
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- 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
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or
-your school, if any, to sign a "copyright disclaimer" for the library,
-if necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James
- Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-
-
+++ /dev/null
-#
-# 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
-#
-XEN_ROOT=$(CURDIR)/../..
-include $(XEN_ROOT)/tools/Rules.mk
-
-MAJOR = 1.0
-MINOR = 0
-
-CFLAGS += -Iinclude \
- -fPIC
-
-ifeq ($(LIBXENAPI_BINDINGS),y)
-CFLAGS += $(shell $(XML2_CONFIG) --cflags) \
- $(shell $(CURL_CONFIG) --cflags)
-
-LDFLAGS += $(shell $(XML2_CONFIG) --libs) \
- $(shell $(CURL_CONFIG) --libs)
-endif
-
-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
-
-libxenapi.so: libxenapi.so.$(MAJOR)
- ln -sf $< $@
-
-libxenapi.so.$(MAJOR): libxenapi.so.$(MAJOR).$(MINOR)
- ln -sf $< $@
-
-libxenapi.so.$(MAJOR).$(MINOR): $(LIBXENAPI_OBJS)
- $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenapi.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(APPEND_LDFLAGS)
-
-libxenapi.a: $(LIBXENAPI_OBJS)
- $(AR) rcs libxenapi.a $^
-
-$(TEST_PROGRAMS): test/%: test/%.o libxenapi.so
- $(CC) $(LDFLAGS) -o $@ $< -L . -lxenapi $(APPEND_LDFLAGS)
-
-
-.PHONY: install
-install: all
- $(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)/xen/api
- $(INSTALL_DIR) $(DESTDIR)$(LIBDIR)
- $(INSTALL_PROG) libxenapi.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)
- ln -sf libxenapi.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libxenapi.so.$(MAJOR)
- ln -sf libxenapi.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libxenapi.so
- $(INSTALL_DATA) libxenapi.a $(DESTDIR)$(LIBDIR)
- set -e; for i in $(LIBXENAPI_HDRS); do \
- $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEDIR)/xen/api; \
- done
-
-
-.PHONY: clean
-clean:
- rm -f `find -name *.o`
- rm -f libxenapi.so*
- rm -f libxenapi.a
- rm -f $(TEST_PROGRAMS)
+++ /dev/null
-#
-# 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
-#
-
-MAJOR = 1.0
-MINOR = 0
-
-CFLAGS = -Iinclude \
- $(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)
-
-# -h for Solaris
-SONAME_LDFLAG ?= -soname
-# -R /usr/sfw/$(LIBDIR) -shared for Solaris
-SHLIB_LDFLAGS ?= -shared
-
-# ginstall for Solaris
-INSTALL = install
-INSTALL_DIR = $(INSTALL) -d -m0755 -p
-INSTALL_DATA = $(INSTALL) -m0644 -p
-
-LIBXENAPI_HDRS = $(wildcard include/*.h)
-LIBXENAPI_OBJS = $(patsubst %.c, %.o, $(wildcard src/*.c))
-
-TEST_PROGRAMS = test/test_bindings test/test_event_handling
-
-TARBALL_DEST = libxenapi-$(MAJOR).$(MINOR)
-
-.PHONY: all
-all: $(TEST_PROGRAMS)
-
-libxenapi.so: libxenapi.so.$(MAJOR)
- ln -sf $< $@
-
-libxenapi.so.$(MAJOR): libxenapi.so.$(MAJOR).$(MINOR)
- ln -sf $< $@
-
-libxenapi.so.$(MAJOR).$(MINOR): $(LIBXENAPI_OBJS)
- $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenapi.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^
-
-libxenapi.a: $(LIBXENAPI_OBJS)
- $(AR) rcs libxenapi.a $^
-
-$(TEST_PROGRAMS): test/%: test/%.o libxenapi.so
- $(CC) $(LDFLAGS) -o $@ $< -L . -lxenapi
-
-
-.PHONY: install
-install: all
- $(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)/xen/api
- $(INSTALL_DIR) $(DESTDIR)$(LIBDIR)
- $(INSTALL_PROG) libxenapi.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)
- ln -sf libxenapi.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libxenapi.so.$(MAJOR)
- ln -sf libxenapi.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libxenapi.so
- $(INSTALL_DATA) libxenapi.a $(DESTDIR)$(LIBDIR)
- set -e; for i in $(LIBXENAPI_HDRS); do \
- $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEDIR)/xen/api; \
- done
-
-
-.PHONY: tarball
-tarball: $(TARBALL_DEST).tar.bz2
-
-$(TARBALL_DEST).tar.bz2: all
- rm -Rf $(TARBALL_DEST)
- mkdir -p $(TARBALL_DEST)/include/xen/api
- mkdir -p $(TARBALL_DEST)/src
- mkdir -p $(TARBALL_DEST)/test
- cp COPYING $(TARBALL_DEST)
- cp Makefile.dist $(TARBALL_DEST)/Makefile
- cp Makefile.dist $(TARBALL_DEST)/Makefile.dist
- cp README $(TARBALL_DEST)
- cp include/*.h $(TARBALL_DEST)/include
- cp include/xen/api/*.h $(TARBALL_DEST)/include/xen/api
- cp src/*.c $(TARBALL_DEST)/src
- cp test/*.c $(TARBALL_DEST)/test
- fakeroot chown root:root -R $(TARBALL_DEST)
- fakeroot tar cjf $(TARBALL_DEST).tar.bz2 $(TARBALL_DEST)
-
-
-.PHONY: clean
-clean:
- rm -f `find -name *.o`
- rm -f libxenapi.so*
- rm -f libxenapi.a
- 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" >>$@
+++ /dev/null
-Xen API C Bindings
-==================
-
-This distribution is the source code to the proposed Xen API C bindings.
-
-The Xen API project will define an XML-RPC protocol for remote and local
-management of Xen-based systems, and a set of bindings for these XML-RPC calls
-into a number of languages (this package contains those to the C language).
-
-The intention is to standardise these XML-RPC calls, and then the Xen project
-will guarantee that that wire protocol will be supported for the long term.
-The bindings will also be supported in the Xen tree, giving a stable
-foundation for Xen management tools and middlewares, in particular the Xen CIM
-providers and libvirt.
-
-THIS IS A WORK IN PROGRESS. The API and bindings are under active design and
-development, and this is a snapshot release for developers only. Both the API
-and the C bindings are scheduled to be stabilised by the Xen 3.0.4 release
-i.e. October 2006 at the earliest.
-
-These bindings are open-source (LGPL), and will be committed as libraries to
-the Xen trees for all to use after the Xen 3.0.3 release.
-
-We welcome any discussion about this library and the API in general. Please
-join the Xen-API mailing list if you are interested in this project. I (Ewan
-Mellor) will collate all the feedback from that list and push out new versions
-of the document and the bindings as and when.
-
-
-URLs
-----
-
-Xen-API wiki page:
-http://wiki.xensource.com/xenwiki/XenApi
-
-Xen-API mailing list:
- http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-api
-
-
-Usage
------
-
-The bindings depend upon libxml2, the XML toolkit from the GNOME project; the
-test program depends upon libcurl3 also. On Debian, you need the packages
-libxml2-dev and libcurl3-dev.
-
-To compile, type make. To compile the test also, type make
-test/test_bindings, remembering the additional dependency.
-
-To run the test, do
-
-LD_LIBRARY_PATH=. ./test/test_bindings <url> <username> <password>
-
-where <url> is the fragment of the server URL that follows the http://, for
-example "localhost:8005/RPC2".
+++ /dev/null
-/* This file is autogenerated */
-#ifndef XEN_API_XEN_ALL_H
-#define XEN_API_XEN_ALL_H
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_console.h>
-#include <xen/api/xen_console_protocol.h>
-#include <xen/api/xen_crashdump.h>
-#include <xen/api/xen_event.h>
-#include <xen/api/xen_event_operation.h>
-#include <xen/api/xen_host_cpu.h>
-#include <xen/api/xen_host.h>
-#include <xen/api/xen_host_metrics.h>
-#include <xen/api/xen_int_float_map.h>
-#include <xen/api/xen_int_int_map.h>
-#include <xen/api/xen_int_string_set_map.h>
-#include <xen/api/xen_network.h>
-#include <xen/api/xen_on_crash_behaviour.h>
-#include <xen/api/xen_on_normal_exit.h>
-#include <xen/api/xen_pbd.h>
-#include <xen/api/xen_pif.h>
-#include <xen/api/xen_pif_metrics.h>
-#include <xen/api/xen_sr.h>
-#include <xen/api/xen_string_set.h>
-#include <xen/api/xen_string_string_map.h>
-#include <xen/api/xen_user.h>
-#include <xen/api/xen_vbd.h>
-#include <xen/api/xen_vbd_metrics.h>
-#include <xen/api/xen_vbd_mode.h>
-#include <xen/api/xen_vbd_type.h>
-#include <xen/api/xen_vdi.h>
-#include <xen/api/xen_vdi_type.h>
-#include <xen/api/xen_vif.h>
-#include <xen/api/xen_vif_metrics.h>
-#include <xen/api/xen_vm_guest_metrics.h>
-#include <xen/api/xen_vm.h>
-#include <xen/api/xen_vm_metrics.h>
-#include <xen/api/xen_vm_power_state.h>
-#include <xen/api/xen_xspolicy.h>
-#include <xen/api/xen_cpu_pool.h>
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2006 XenSource, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_COMMON_H
-#define XEN_COMMON_H
-
-
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <time.h>
-
-#include "xen/api/xen_host_decl.h"
-
-
-typedef bool (*xen_result_func)(const void *data, size_t len,
- void *result_handle);
-
-
-/**
- * len does not include a terminating \0.
- */
-typedef int (*xen_call_func)(const void *, size_t len, void *user_handle,
- void *result_handle,
- xen_result_func result_func);
-
-
-typedef struct
-{
- xen_call_func call_func;
- void *handle;
- const char *session_id;
- bool ok;
- char **error_description;
- int error_description_count;
-} xen_session;
-
-
-typedef struct xen_session_record
-{
- char *uuid;
- struct xen_host_record_opt *this_host;
- char *this_user;
- time_t last_active;
-} xen_session_record;
-
-
-/**
- * Allocate a xen_session_record.
- */
-extern xen_session_record *
-xen_session_record_alloc(void);
-
-
-/**
- * Free the given xen_session_record, and all referenced values. The
- * given record must have been allocated by this library.
- */
-extern void
-xen_session_record_free(xen_session_record *record);
-
-
-struct xen_task_;
-typedef struct xen_task_ * xen_task_id;
-
-
-typedef struct
-{
- int progress;
- long eta;
- /* !!! RESULT */
-} xen_task_status;
-
-
-typedef struct
-{
- int major;
- int minor;
- int patch;
- char *extraversion;
-} xen_version;
-
-
-/**
- * Free the given xen_version, and all referenced values.
- */
-extern void xen_version_free(xen_version *version);
-
-
-/**
- * Return the version of this client-side library. This will be the major,
- * minor, and extraversion of the Xen release with which it was released,
- * plus the library's own version as the patch.
- */
-extern xen_version *xen_get_client_side_version(void);
-
-
-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
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_CONSOLE_H
-#define XEN_CONSOLE_H
-
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_console_decl.h>
-#include <xen/api/xen_console_protocol.h>
-#include <xen/api/xen_string_string_map.h>
-#include <xen/api/xen_vm_decl.h>
-
-
-/*
- * The console class.
- *
- * A console.
- */
-
-
-/**
- * Free the given xen_console. The given handle must have been
- * allocated by this library.
- */
-extern void
-xen_console_free(xen_console console);
-
-
-typedef struct xen_console_set
-{
- size_t size;
- xen_console *contents[];
-} xen_console_set;
-
-/**
- * Allocate a xen_console_set of the given size.
- */
-extern xen_console_set *
-xen_console_set_alloc(size_t size);
-
-/**
- * Free the given xen_console_set. The given set must have been
- * allocated by this library.
- */
-extern void
-xen_console_set_free(xen_console_set *set);
-
-
-typedef struct xen_console_record
-{
- xen_console handle;
- char *uuid;
- enum xen_console_protocol protocol;
- char *location;
- struct xen_vm_record_opt *vm;
- xen_string_string_map *other_config;
-} xen_console_record;
-
-/**
- * Allocate a xen_console_record.
- */
-extern xen_console_record *
-xen_console_record_alloc(void);
-
-/**
- * Free the given xen_console_record, and all referenced values. The
- * given record must have been allocated by this library.
- */
-extern void
-xen_console_record_free(xen_console_record *record);
-
-
-typedef struct xen_console_record_opt
-{
- bool is_record;
- union
- {
- xen_console handle;
- xen_console_record *record;
- } u;
-} xen_console_record_opt;
-
-/**
- * Allocate a xen_console_record_opt.
- */
-extern xen_console_record_opt *
-xen_console_record_opt_alloc(void);
-
-/**
- * Free the given xen_console_record_opt, and all referenced values.
- * The given record_opt must have been allocated by this library.
- */
-extern void
-xen_console_record_opt_free(xen_console_record_opt *record_opt);
-
-
-typedef struct xen_console_record_set
-{
- size_t size;
- xen_console_record *contents[];
-} xen_console_record_set;
-
-/**
- * Allocate a xen_console_record_set of the given size.
- */
-extern xen_console_record_set *
-xen_console_record_set_alloc(size_t size);
-
-/**
- * Free the given xen_console_record_set, and all referenced values.
- * The given set must have been allocated by this library.
- */
-extern void
-xen_console_record_set_free(xen_console_record_set *set);
-
-
-
-typedef struct xen_console_record_opt_set
-{
- size_t size;
- xen_console_record_opt *contents[];
-} xen_console_record_opt_set;
-
-/**
- * Allocate a xen_console_record_opt_set of the given size.
- */
-extern xen_console_record_opt_set *
-xen_console_record_opt_set_alloc(size_t size);
-
-/**
- * Free the given xen_console_record_opt_set, and all referenced
- * values. The given set must have been allocated by this library.
- */
-extern void
-xen_console_record_opt_set_free(xen_console_record_opt_set *set);
-
-
-/**
- * Get a record containing the current state of the given console.
- */
-extern bool
-xen_console_get_record(xen_session *session, xen_console_record **result, xen_console console);
-
-
-/**
- * Get a reference to the console instance with the specified UUID.
- */
-extern bool
-xen_console_get_by_uuid(xen_session *session, xen_console *result, char *uuid);
-
-
-/**
- * Create a new console instance, and return its handle.
- */
-extern bool
-xen_console_create(xen_session *session, xen_console *result, xen_console_record *record);
-
-
-/**
- * Destroy the specified console instance.
- */
-extern bool
-xen_console_destroy(xen_session *session, xen_console console);
-
-
-/**
- * Get the uuid field of the given console.
- */
-extern bool
-xen_console_get_uuid(xen_session *session, char **result, xen_console console);
-
-
-/**
- * Get the protocol field of the given console.
- */
-extern bool
-xen_console_get_protocol(xen_session *session, enum xen_console_protocol *result, xen_console console);
-
-
-/**
- * Get the location field of the given console.
- */
-extern bool
-xen_console_get_location(xen_session *session, char **result, xen_console console);
-
-
-/**
- * Get the VM field of the given console.
- */
-extern bool
-xen_console_get_vm(xen_session *session, xen_vm *result, xen_console console);
-
-
-/**
- * Get the other_config field of the given console.
- */
-extern bool
-xen_console_get_other_config(xen_session *session, xen_string_string_map **result, xen_console console);
-
-
-/**
- * Set the other_config field of the given console.
- */
-extern bool
-xen_console_set_other_config(xen_session *session, xen_console console, xen_string_string_map *other_config);
-
-
-/**
- * Add the given key-value pair to the other_config field of the given
- * console.
- */
-extern bool
-xen_console_add_to_other_config(xen_session *session, xen_console console, char *key, char *value);
-
-
-/**
- * Remove the given key and its corresponding value from the
- * other_config field of the given console. If the key is not in that Map,
- * then do nothing.
- */
-extern bool
-xen_console_remove_from_other_config(xen_session *session, xen_console console, char *key);
-
-
-/**
- * Return a list of all the consoles known to the system.
- */
-extern bool
-xen_console_get_all(xen_session *session, struct xen_console_set **result);
-
-
-#endif
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_CONSOLE_PROTOCOL_H
-#define XEN_CONSOLE_PROTOCOL_H
-
-
-#include <xen/api/xen_common.h>
-
-
-enum xen_console_protocol
-{
- /**
- * VT100 terminal
- */
- XEN_CONSOLE_PROTOCOL_VT100,
-
- /**
- * Remote FrameBuffer protocol (as used in VNC)
- */
- XEN_CONSOLE_PROTOCOL_RFB,
-
- /**
- * Remote Desktop Protocol
- */
- XEN_CONSOLE_PROTOCOL_RDP
-};
-
-
-typedef struct xen_console_protocol_set
-{
- size_t size;
- enum xen_console_protocol contents[];
-} xen_console_protocol_set;
-
-/**
- * Allocate a xen_console_protocol_set of the given size.
- */
-extern xen_console_protocol_set *
-xen_console_protocol_set_alloc(size_t size);
-
-/**
- * Free the given xen_console_protocol_set. The given set must have
- * been allocated by this library.
- */
-extern void
-xen_console_protocol_set_free(xen_console_protocol_set *set);
-
-
-/**
- * Return the name corresponding to the given code. This string must
- * not be modified or freed.
- */
-extern const char *
-xen_console_protocol_to_string(enum xen_console_protocol val);
-
-
-/**
- * Return the correct code for the given string, or set the session
- * object to failure and return an undefined value if the given string does
- * not match a known code.
- */
-extern enum xen_console_protocol
-xen_console_protocol_from_string(xen_session *session, const char *str);
-
-
-#endif
+++ /dev/null
-/*
- * 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_CPU_POOL_H
-#define XEN_CPU_POOL_H
-
-#include <stddef.h>
-#include <stdlib.h>
-
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_string_set.h>
-#include <xen/api/xen_string_string_map.h>
-#include <xen/api/xen_host_cpu_decl.h>
-#include <xen/api/xen_host.h>
-#include <xen/api/xen_vm_decl.h>
-#include <xen/api/xen_vm.h>
-#include <xen/api/xen_cpu_pool_decl.h>
-
-/*
- * The cpu_pool class.
- *
- * Management of CPU pools.
- */
-
-
-/**
- * Free the given xen_cpu_pool. The given handle must have been allocated
- * by this library.
- */
-extern void
-xen_cpu_pool_free(xen_cpu_pool cpu_pool);
-
-
-typedef struct xen_cpu_pool_set
-{
- size_t size;
- xen_cpu_pool *contents[];
-} xen_cpu_pool_set;
-
-/**
- * Allocate a xen_cpu_pool_set of the given size.
- */
-extern xen_cpu_pool_set *
-xen_cpu_pool_set_alloc(size_t size);
-
-/**
- * Free the given xen_cpu_pool_set. The given set must have been allocated
- * by this library.
- */
-extern void
-xen_cpu_pool_set_free(xen_cpu_pool_set *set);
-
-
-typedef struct xen_cpu_pool_record
-{
- xen_cpu_pool handle;
- char *uuid;
- char *name_label;
- char *name_description;
- struct xen_host_record_opt *resident_on;
- bool auto_power_on;
- struct xen_vm_record_opt_set *started_vms;
- int64_t ncpu;
- char *sched_policy;
- struct xen_string_set *proposed_cpus;
- struct xen_host_cpu_record_opt_set *host_cpus;
- bool activated;
- xen_string_string_map *other_config;
-} xen_cpu_pool_record;
-
-/**
- * Allocate a xen_cpu_pool_record.
- */
-extern xen_cpu_pool_record *
-xen_cpu_pool_record_alloc(void);
-
-/**
- * Free the given xen_cpu_pool_record, and all referenced values. The given
- * record must have been allocated by this library.
- */
-extern void
-xen_cpu_pool_record_free(xen_cpu_pool_record *record);
-
-
-typedef struct xen_cpu_pool_record_opt
-{
- bool is_record;
- union
- {
- xen_cpu_pool handle;
- xen_cpu_pool_record *record;
- } u;
-} xen_cpu_pool_record_opt;
-
-/**
- * Allocate a xen_cpu_pool_record_opt.
- */
-extern xen_cpu_pool_record_opt *
-xen_cpu_pool_record_opt_alloc(void);
-
-/**
- * Free the given xen_cpu_pool_record_opt, and all referenced values. The
- * given record_opt must have been allocated by this library.
- */
-extern void
-xen_cpu_pool_record_opt_free(xen_cpu_pool_record_opt *record_opt);
-
-
-typedef struct xen_cpu_pool_record_set
-{
- size_t size;
- xen_cpu_pool_record *contents[];
-} xen_cpu_pool_record_set;
-
-/**
- * Allocate a xen_cpu_pool_record_set of the given size.
- */
-extern xen_cpu_pool_record_set *
-xen_cpu_pool_record_set_alloc(size_t size);
-
-/**
- * Free the given xen_cpu_pool_record_set, and all referenced values. The
- * given set must have been allocated by this library.
- */
-extern void
-xen_cpu_pool_record_set_free(xen_cpu_pool_record_set *set);
-
-
-
-typedef struct xen_cpu_pool_record_opt_set
-{
- size_t size;
- xen_cpu_pool_record_opt *contents[];
-} xen_cpu_pool_record_opt_set;
-
-/**
- * Allocate a xen_cpu_pool_record_opt_set of the given size.
- */
-extern xen_cpu_pool_record_opt_set *
-xen_cpu_pool_record_opt_set_alloc(size_t size);
-
-/**
- * Free the given xen_cpu_pool_record_opt_set, and all referenced values.
- * The given set must have been allocated by this library.
- */
-extern void
-xen_cpu_pool_record_opt_set_free(xen_cpu_pool_record_opt_set *set);
-
-
-/**
- * Get a record containing the current state of the given cpu_pool.
- */
-extern bool
-xen_cpu_pool_get_record(xen_session *session, xen_cpu_pool_record **result,
- xen_cpu_pool cpu_pool);
-
-
-/**
- * Get a reference to the cpu_pool instance with the specified UUID.
- */
-extern bool
-xen_cpu_pool_get_by_uuid(xen_session *session, xen_cpu_pool *result, char *uuid);
-
-
-/**
- * Create a new cpu_pool instance, and return its handle.
- */
-extern bool
-xen_cpu_pool_create(xen_session *session, xen_cpu_pool *result,
- xen_cpu_pool_record *record);
-
-
-/**
- * Destroy the specified VBD instance.
- */
-extern bool
-xen_cpu_pool_destroy(xen_session *session, xen_cpu_pool cpu_pool);
-
-
-/**
- * Get the uuid field of the given cpu_pool.
- */
-extern bool
-xen_cpu_pool_get_uuid(xen_session *session, char **result, xen_cpu_pool cpu_pool);
-
-
-/**
- * Deactivate the given cpu_pool.
- */
-extern bool
-xen_cpu_pool_deactivate(xen_session *session, xen_cpu_pool cpu_pool);
-
-
-/**
- * Activate the given cpu_pool.
- */
-extern bool
-xen_cpu_pool_activate(xen_session *session, xen_cpu_pool cpu_pool);
-
-
-/**
- * Add a physical cpu to the active pool.
- */
-extern bool
-xen_cpu_pool_add_host_CPU_live(xen_session *session, xen_cpu_pool cpu_pool,
- xen_host_cpu host_cpu);
-
-
-/**
- * Remove a physical cpu from the active pool.
- */
-extern bool
-xen_cpu_pool_remove_host_CPU_live(xen_session *session, xen_cpu_pool cpu_pool,
- xen_host_cpu host_cpu);
-
-
-/**
- * Return a list of all the cpu_pools known to the system.
- */
-extern bool
-xen_cpu_pool_get_all(xen_session *session, struct xen_cpu_pool_set **result);
-
-
-/**
- * Get the uuid field of the cpu_pool with given name.
- */
-extern bool
-xen_cpu_pool_get_by_name_label(xen_session *session,
- struct xen_cpu_pool_set **result, char *label);
-
-
-/**
- * Get activation state of given cpu_pool.
- */
-extern bool
-xen_cpu_pool_get_activated(xen_session *session, bool *result,
- xen_cpu_pool cpu_pool);
-
-
-/**
- * Get auto_power_on option of given cpu_pool.
- */
-extern bool
-xen_cpu_pool_get_auto_power_on(xen_session *session, bool *result,
- xen_cpu_pool cpu_pool);
-
-
-/**
- * Get host_cpu refs of all physical cpus of cpu_pool.
- */
-extern bool
-xen_cpu_pool_get_host_CPUs(xen_session *session, struct xen_host_cpu_set **result,
- xen_cpu_pool cpu_pool);
-
-
-/**
- * Get name description field of given cpu_pool.
- */
-extern bool
-xen_cpu_pool_get_name_description(xen_session *session, char **result,
- xen_cpu_pool cpu_pool);
-
-
-/**
- * Get name label field of given cpu_pool.
- */
-extern bool
-xen_cpu_pool_get_name_label(xen_session *session, char **result,
- xen_cpu_pool cpu_pool);
-
-
-/**
- * Get count of physical cpus to attach to cpu_pool on activation.
- */
-extern bool
-xen_cpu_pool_get_ncpu(xen_session *session, int64_t *result,
- xen_cpu_pool cpu_pool);
-
-
-/**
- * Get proposed_CPUs field of given cpu_pool.
- */
-extern bool
-xen_cpu_pool_get_proposed_CPUs(xen_session *session, struct xen_string_set **result,
- xen_cpu_pool cpu_pool);
-
-
-/**
- * Get the other_config field of the given cpu_pool.
- */
-extern bool
-xen_cpu_pool_get_other_config(xen_session *session, xen_string_string_map **result,
- xen_cpu_pool cpu_pool);
-
-
-/**
- * Get host the cpu_pool is resident on.
- */
-extern bool
-xen_cpu_pool_get_resident_on(xen_session *session, xen_host *result,
- xen_cpu_pool cpu_pool);
-
-
-/**
- * Get sched_policy field of given cpu_pool.
- */
-extern bool
-xen_cpu_pool_get_sched_policy(xen_session *session, char **result,
- xen_cpu_pool cpu_pool);
-
-
-/**
- * Get set of started vms in given cpu_pool.
- */
-extern bool
-xen_cpu_pool_get_started_VMs(xen_session *session, xen_vm_set **result,
- xen_cpu_pool cpu_pool);
-
-
-/**
- * Set auto_power_on field of given cpu_pool.
- */
-extern bool
-xen_cpu_pool_set_auto_power_on(xen_session *session, xen_cpu_pool cpu_pool,
- bool auto_power_on);
-
-
-/**
- * Set proposed_CPUs field of given cpu_pool.
- */
-extern bool
-xen_cpu_pool_set_proposed_CPUs(xen_session *session, xen_cpu_pool cpu_pool,
- xen_string_set *proposed_cpus);
-
-
-/**
- * Add a proposed cpu to proposed_CPUs field of given cpu_pool.
- */
-extern bool
-xen_cpu_pool_add_to_proposed_CPUs(xen_session *session, xen_cpu_pool cpu_pool,
- char* proposed_cpu);
-
-
-/**
- * Remove a proposed cpu from proposed_CPUs field of given cpu_pool.
- */
-extern bool
-xen_cpu_pool_remove_from_proposed_CPUs(xen_session *session, xen_cpu_pool cpu_pool,
- char* proposed_cpu);
-
-
-/**
- * Set name_label field of given cpu_pool.
- */
-extern bool
-xen_cpu_pool_set_name_label(xen_session *session, xen_cpu_pool cpu_pool,
- char *label);
-
-
-/**
- * Set name_description field of given cpu_pool.
- */
-extern bool
-xen_cpu_pool_set_name_description(xen_session *session, xen_cpu_pool cpu_pool,
- char *descr);
-
-
-/**
- * Set ncpu field of given cpu_pool.
- */
-extern bool
-xen_cpu_pool_set_ncpu(xen_session *session, xen_cpu_pool cpu_pool, int64_t ncpu);
-
-
-/**
- * Set the other_config field of the given cpu_pool.
- */
-extern bool
-xen_cpu_pool_set_other_config(xen_session *session, xen_cpu_pool cpu_pool,
- xen_string_string_map *other_config);
-
-
-/**
- * Add the given key-value pair to the other_config field of the given
- * cpu_pool.
- */
-extern bool
-xen_cpu_pool_add_to_other_config(xen_session *session, xen_cpu_pool cpu_pool,
- char *key, char *value);
-
-
-/**
- * Remove the given key and its corresponding value from the
- * other_config field of the given cpu_pool. If the key is not in that Map, then
- * do nothing.
- */
-extern bool
-xen_cpu_pool_remove_from_other_config(xen_session *session, xen_cpu_pool cpu_pool,
- char *key);
-
-/**
- * Set sched_policy of given cpu_pool.
- */
-extern bool
-xen_cpu_pool_set_sched_policy(xen_session *session, xen_cpu_pool cpu_pool,
- char *sched_policy);
-
-
-#endif
+++ /dev/null
-/*
- * 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_CPU_POOL_DECL_H
-#define XEN_CPU_POOL_DECL_H
-
-typedef void *xen_cpu_pool;
-
-struct xen_cpu_pool_set;
-struct xen_cpu_pool_record;
-struct xen_cpu_pool_record_set;
-struct xen_cpu_pool_record_opt;
-struct xen_cpu_pool_record_opt_set;
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_CRASHDUMP_H
-#define XEN_CRASHDUMP_H
-
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_crashdump_decl.h>
-#include <xen/api/xen_vdi_decl.h>
-#include <xen/api/xen_vm_decl.h>
-
-
-/*
- * The crashdump class.
- *
- * A VM crashdump.
- */
-
-
-/**
- * Free the given xen_crashdump. The given handle must have been
- * allocated by this library.
- */
-extern void
-xen_crashdump_free(xen_crashdump crashdump);
-
-
-typedef struct xen_crashdump_set
-{
- size_t size;
- xen_crashdump *contents[];
-} xen_crashdump_set;
-
-/**
- * Allocate a xen_crashdump_set of the given size.
- */
-extern xen_crashdump_set *
-xen_crashdump_set_alloc(size_t size);
-
-/**
- * Free the given xen_crashdump_set. The given set must have been
- * allocated by this library.
- */
-extern void
-xen_crashdump_set_free(xen_crashdump_set *set);
-
-
-typedef struct xen_crashdump_record
-{
- xen_crashdump handle;
- char *uuid;
- struct xen_vm_record_opt *vm;
- struct xen_vdi_record_opt *vdi;
-} xen_crashdump_record;
-
-/**
- * Allocate a xen_crashdump_record.
- */
-extern xen_crashdump_record *
-xen_crashdump_record_alloc(void);
-
-/**
- * Free the given xen_crashdump_record, and all referenced values. The
- * given record must have been allocated by this library.
- */
-extern void
-xen_crashdump_record_free(xen_crashdump_record *record);
-
-
-typedef struct xen_crashdump_record_opt
-{
- bool is_record;
- union
- {
- xen_crashdump handle;
- xen_crashdump_record *record;
- } u;
-} xen_crashdump_record_opt;
-
-/**
- * Allocate a xen_crashdump_record_opt.
- */
-extern xen_crashdump_record_opt *
-xen_crashdump_record_opt_alloc(void);
-
-/**
- * Free the given xen_crashdump_record_opt, and all referenced values.
- * The given record_opt must have been allocated by this library.
- */
-extern void
-xen_crashdump_record_opt_free(xen_crashdump_record_opt *record_opt);
-
-
-typedef struct xen_crashdump_record_set
-{
- size_t size;
- xen_crashdump_record *contents[];
-} xen_crashdump_record_set;
-
-/**
- * Allocate a xen_crashdump_record_set of the given size.
- */
-extern xen_crashdump_record_set *
-xen_crashdump_record_set_alloc(size_t size);
-
-/**
- * Free the given xen_crashdump_record_set, and all referenced values.
- * The given set must have been allocated by this library.
- */
-extern void
-xen_crashdump_record_set_free(xen_crashdump_record_set *set);
-
-
-
-typedef struct xen_crashdump_record_opt_set
-{
- size_t size;
- xen_crashdump_record_opt *contents[];
-} xen_crashdump_record_opt_set;
-
-/**
- * Allocate a xen_crashdump_record_opt_set of the given size.
- */
-extern xen_crashdump_record_opt_set *
-xen_crashdump_record_opt_set_alloc(size_t size);
-
-/**
- * Free the given xen_crashdump_record_opt_set, and all referenced
- * values. The given set must have been allocated by this library.
- */
-extern void
-xen_crashdump_record_opt_set_free(xen_crashdump_record_opt_set *set);
-
-
-/**
- * Get a record containing the current state of the given crashdump.
- */
-extern bool
-xen_crashdump_get_record(xen_session *session, xen_crashdump_record **result, xen_crashdump crashdump);
-
-
-/**
- * Get a reference to the crashdump instance with the specified UUID.
- */
-extern bool
-xen_crashdump_get_by_uuid(xen_session *session, xen_crashdump *result, char *uuid);
-
-
-/**
- * Get the uuid field of the given crashdump.
- */
-extern bool
-xen_crashdump_get_uuid(xen_session *session, char **result, xen_crashdump crashdump);
-
-
-/**
- * Get the VM field of the given crashdump.
- */
-extern bool
-xen_crashdump_get_vm(xen_session *session, xen_vm *result, xen_crashdump crashdump);
-
-
-/**
- * Get the VDI field of the given crashdump.
- */
-extern bool
-xen_crashdump_get_vdi(xen_session *session, xen_vdi *result, xen_crashdump crashdump);
-
-
-/**
- * Destroy the specified crashdump.
- */
-extern bool
-xen_crashdump_destroy(xen_session *session, xen_crashdump self);
-
-
-/**
- * Return a list of all the crashdumps known to the system.
- */
-extern bool
-xen_crashdump_get_all(xen_session *session, struct xen_crashdump_set **result);
-
-
-#endif
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_EVENT_H
-#define XEN_EVENT_H
-
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_event_decl.h>
-#include <xen/api/xen_event_operation.h>
-#include <xen/api/xen_string_set.h>
-
-
-/*
- * The event class.
- *
- * Asynchronous event registration and handling.
- */
-
-
-
-typedef struct xen_event_record
-{
- int64_t id;
- time_t timestamp;
- char *class;
- enum xen_event_operation operation;
- char *ref;
- char *obj_uuid;
-} xen_event_record;
-
-/**
- * Allocate a xen_event_record.
- */
-extern xen_event_record *
-xen_event_record_alloc(void);
-
-/**
- * Free the given xen_event_record, and all referenced values. The
- * given record must have been allocated by this library.
- */
-extern void
-xen_event_record_free(xen_event_record *record);
-
-
-typedef struct xen_event_record_set
-{
- size_t size;
- xen_event_record *contents[];
-} xen_event_record_set;
-
-/**
- * Allocate a xen_event_record_set of the given size.
- */
-extern xen_event_record_set *
-xen_event_record_set_alloc(size_t size);
-
-/**
- * Free the given xen_event_record_set, and all referenced values. The
- * given set must have been allocated by this library.
- */
-extern void
-xen_event_record_set_free(xen_event_record_set *set);
-
-
-/**
- * Registers this session with the event system. Specifying the empty
- * list will register for all classes.
- */
-extern bool
-xen_event_register(xen_session *session, struct xen_string_set *classes);
-
-
-/**
- * Unregisters this session with the event system.
- */
-extern bool
-xen_event_unregister(xen_session *session, struct xen_string_set *classes);
-
-
-/**
- * Blocking call which returns a (possibly empty) batch of events.
- */
-extern bool
-xen_event_next(xen_session *session, struct xen_event_record_set **result);
-
-
-#endif
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_EVENT_OPERATION_H
-#define XEN_EVENT_OPERATION_H
-
-
-#include <xen/api/xen_common.h>
-
-
-enum xen_event_operation
-{
- /**
- * An object has been created
- */
- XEN_EVENT_OPERATION_ADD,
-
- /**
- * An object has been deleted
- */
- XEN_EVENT_OPERATION_DEL,
-
- /**
- * An object has been modified
- */
- XEN_EVENT_OPERATION_MOD
-};
-
-
-typedef struct xen_event_operation_set
-{
- size_t size;
- enum xen_event_operation contents[];
-} xen_event_operation_set;
-
-/**
- * Allocate a xen_event_operation_set of the given size.
- */
-extern xen_event_operation_set *
-xen_event_operation_set_alloc(size_t size);
-
-/**
- * Free the given xen_event_operation_set. The given set must have
- * been allocated by this library.
- */
-extern void
-xen_event_operation_set_free(xen_event_operation_set *set);
-
-
-/**
- * Return the name corresponding to the given code. This string must
- * not be modified or freed.
- */
-extern const char *
-xen_event_operation_to_string(enum xen_event_operation val);
-
-
-/**
- * Return the correct code for the given string, or set the session
- * object to failure and return an undefined value if the given string does
- * not match a known code.
- */
-extern enum xen_event_operation
-xen_event_operation_from_string(xen_session *session, const char *str);
-
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_HOST_H
-#define XEN_HOST_H
-
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_host_cpu_decl.h>
-#include <xen/api/xen_host_decl.h>
-#include <xen/api/xen_host_metrics_decl.h>
-#include <xen/api/xen_pbd_decl.h>
-#include <xen/api/xen_pif_decl.h>
-#include <xen/api/xen_sr_decl.h>
-#include <xen/api/xen_string_set.h>
-#include <xen/api/xen_string_string_map.h>
-#include <xen/api/xen_vm_decl.h>
-#include <xen/api/xen_cpu_pool_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;
- struct xen_cpu_pool_record_opt_set *resident_cpu_pools;
-} 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);
-
-
-/**
- * Get list of resident cpu pools.
- */
-extern bool
-xen_host_get_resident_cpu_pools(xen_session *session, struct xen_cpu_pool_set **result,
- xen_host host);
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_HOST_CPU_H
-#define XEN_HOST_CPU_H
-
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_host_cpu_decl.h>
-#include <xen/api/xen_host_decl.h>
-#include <xen/api/xen_cpu_pool_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;
- struct xen_cpu_pool_record_opt_set *cpu_pools;
-} 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);
-
-
-/**
- * Get the ref of the cpu_pool to which the host_cpu belongs.
- */
-extern bool
-xen_host_cpu_get_cpu_pool(xen_session *session, struct xen_cpu_pool_set **result, xen_host_cpu host_cpu);
-
-
-/**
- * Return a list of all the host_cpus not assigned to a cpu_pool.
- */
-extern bool
-xen_host_cpu_get_unassigned_cpus(xen_session *session, struct xen_host_cpu_set **result);
-
-
-#endif
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_HOST_METRICS_H
-#define XEN_HOST_METRICS_H
-
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_host_metrics_decl.h>
-
-
-/*
- * The host_metrics class.
- *
- * The metrics associated with a host.
- */
-
-
-/**
- * Free the given xen_host_metrics. The given handle must have been
- * allocated by this library.
- */
-extern void
-xen_host_metrics_free(xen_host_metrics host_metrics);
-
-
-typedef struct xen_host_metrics_set
-{
- size_t size;
- xen_host_metrics *contents[];
-} xen_host_metrics_set;
-
-/**
- * Allocate a xen_host_metrics_set of the given size.
- */
-extern xen_host_metrics_set *
-xen_host_metrics_set_alloc(size_t size);
-
-/**
- * Free the given xen_host_metrics_set. The given set must have been
- * allocated by this library.
- */
-extern void
-xen_host_metrics_set_free(xen_host_metrics_set *set);
-
-
-typedef struct xen_host_metrics_record
-{
- xen_host_metrics handle;
- char *uuid;
- int64_t memory_total;
- int64_t memory_free;
- time_t last_updated;
-} xen_host_metrics_record;
-
-/**
- * Allocate a xen_host_metrics_record.
- */
-extern xen_host_metrics_record *
-xen_host_metrics_record_alloc(void);
-
-/**
- * Free the given xen_host_metrics_record, and all referenced values.
- * The given record must have been allocated by this library.
- */
-extern void
-xen_host_metrics_record_free(xen_host_metrics_record *record);
-
-
-typedef struct xen_host_metrics_record_opt
-{
- bool is_record;
- union
- {
- xen_host_metrics handle;
- xen_host_metrics_record *record;
- } u;
-} xen_host_metrics_record_opt;
-
-/**
- * Allocate a xen_host_metrics_record_opt.
- */
-extern xen_host_metrics_record_opt *
-xen_host_metrics_record_opt_alloc(void);
-
-/**
- * Free the given xen_host_metrics_record_opt, and all referenced
- * values. The given record_opt must have been allocated by this library.
- */
-extern void
-xen_host_metrics_record_opt_free(xen_host_metrics_record_opt *record_opt);
-
-
-typedef struct xen_host_metrics_record_set
-{
- size_t size;
- xen_host_metrics_record *contents[];
-} xen_host_metrics_record_set;
-
-/**
- * Allocate a xen_host_metrics_record_set of the given size.
- */
-extern xen_host_metrics_record_set *
-xen_host_metrics_record_set_alloc(size_t size);
-
-/**
- * Free the given xen_host_metrics_record_set, and all referenced
- * values. The given set must have been allocated by this library.
- */
-extern void
-xen_host_metrics_record_set_free(xen_host_metrics_record_set *set);
-
-
-
-typedef struct xen_host_metrics_record_opt_set
-{
- size_t size;
- xen_host_metrics_record_opt *contents[];
-} xen_host_metrics_record_opt_set;
-
-/**
- * Allocate a xen_host_metrics_record_opt_set of the given size.
- */
-extern xen_host_metrics_record_opt_set *
-xen_host_metrics_record_opt_set_alloc(size_t size);
-
-/**
- * Free the given xen_host_metrics_record_opt_set, and all referenced
- * values. The given set must have been allocated by this library.
- */
-extern void
-xen_host_metrics_record_opt_set_free(xen_host_metrics_record_opt_set *set);
-
-
-/**
- * Get a record containing the current state of the given host_metrics.
- */
-extern bool
-xen_host_metrics_get_record(xen_session *session, xen_host_metrics_record **result, xen_host_metrics host_metrics);
-
-
-/**
- * Get a reference to the host_metrics instance with the specified
- * UUID.
- */
-extern bool
-xen_host_metrics_get_by_uuid(xen_session *session, xen_host_metrics *result, char *uuid);
-
-
-/**
- * Get the uuid field of the given host_metrics.
- */
-extern bool
-xen_host_metrics_get_uuid(xen_session *session, char **result, xen_host_metrics host_metrics);
-
-
-/**
- * Get the memory/total field of the given host_metrics.
- */
-extern bool
-xen_host_metrics_get_memory_total(xen_session *session, int64_t *result, xen_host_metrics host_metrics);
-
-
-/**
- * Get the memory/free field of the given host_metrics.
- */
-extern bool
-xen_host_metrics_get_memory_free(xen_session *session, int64_t *result, xen_host_metrics host_metrics);
-
-
-/**
- * Get the last_updated field of the given host_metrics.
- */
-extern bool
-xen_host_metrics_get_last_updated(xen_session *session, time_t *result, xen_host_metrics host_metrics);
-
-
-/**
- * Return a list of all the host_metrics instances known to the system.
- */
-extern bool
-xen_host_metrics_get_all(xen_session *session, struct xen_host_metrics_set **result);
-
-
-#endif
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_INT_FLOAT_MAP_H
-#define XEN_INT_FLOAT_MAP_H
-
-
-#include <xen/api/xen_common.h>
-
-
-typedef struct xen_int_float_map_contents
-{
- int64_t key;
- double val;
-} xen_int_float_map_contents;
-
-
-typedef struct xen_int_float_map
-{
- size_t size;
- xen_int_float_map_contents contents[];
-} xen_int_float_map;
-
-/**
- * Allocate a xen_int_float_map of the given size.
- */
-extern xen_int_float_map *
-xen_int_float_map_alloc(size_t size);
-
-/**
- * Free the given xen_int_float_map, and all referenced values. The
- * given map must have been allocated by this library.
- */
-extern void
-xen_int_float_map_free(xen_int_float_map *map);
-
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_INT_INT_MAP_H
-#define XEN_INT_INT_MAP_H
-
-
-#include <xen/api/xen_common.h>
-
-
-typedef struct xen_int_int_map_contents
-{
- int64_t key;
- int64_t val;
-} xen_int_int_map_contents;
-
-
-typedef struct xen_int_int_map
-{
- size_t size;
- xen_int_int_map_contents contents[];
-} xen_int_int_map;
-
-/**
- * Allocate a xen_int_int_map of the given size.
- */
-extern xen_int_int_map *
-xen_int_int_map_alloc(size_t size);
-
-/**
- * Free the given xen_int_int_map, and all referenced values. The
- * given map must have been allocated by this library.
- */
-extern void
-xen_int_int_map_free(xen_int_int_map *map);
-
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_INT_STRING_SET_MAP_H
-#define XEN_INT_STRING_SET_MAP_H
-
-
-#include <xen/api/xen_common.h>
-
-
-typedef struct xen_int_string_set_map_contents
-{
- int64_t key;
- struct xen_string_set *val;
-} xen_int_string_set_map_contents;
-
-
-typedef struct xen_int_string_set_map
-{
- size_t size;
- xen_int_string_set_map_contents contents[];
-} xen_int_string_set_map;
-
-/**
- * Allocate a xen_int_string_set_map of the given size.
- */
-extern xen_int_string_set_map *
-xen_int_string_set_map_alloc(size_t size);
-
-/**
- * Free the given xen_int_string_set_map, and all referenced values.
- * The given map must have been allocated by this library.
- */
-extern void
-xen_int_string_set_map_free(xen_int_string_set_map *map);
-
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_NETWORK_H
-#define XEN_NETWORK_H
-
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_network_decl.h>
-#include <xen/api/xen_pif_decl.h>
-#include <xen/api/xen_string_string_map.h>
-#include <xen/api/xen_vif_decl.h>
-
-
-/*
- * The network class.
- *
- * A virtual network.
- */
-
-
-/**
- * Free the given xen_network. The given handle must have been
- * allocated by this library.
- */
-extern void
-xen_network_free(xen_network network);
-
-
-typedef struct xen_network_set
-{
- size_t size;
- xen_network *contents[];
-} xen_network_set;
-
-/**
- * Allocate a xen_network_set of the given size.
- */
-extern xen_network_set *
-xen_network_set_alloc(size_t size);
-
-/**
- * Free the given xen_network_set. The given set must have been
- * allocated by this library.
- */
-extern void
-xen_network_set_free(xen_network_set *set);
-
-
-typedef struct xen_network_record
-{
- xen_network handle;
- char *uuid;
- char *name_label;
- char *name_description;
- struct xen_vif_record_opt_set *vifs;
- struct xen_pif_record_opt_set *pifs;
- xen_string_string_map *other_config;
-} xen_network_record;
-
-/**
- * Allocate a xen_network_record.
- */
-extern xen_network_record *
-xen_network_record_alloc(void);
-
-/**
- * Free the given xen_network_record, and all referenced values. The
- * given record must have been allocated by this library.
- */
-extern void
-xen_network_record_free(xen_network_record *record);
-
-
-typedef struct xen_network_record_opt
-{
- bool is_record;
- union
- {
- xen_network handle;
- xen_network_record *record;
- } u;
-} xen_network_record_opt;
-
-/**
- * Allocate a xen_network_record_opt.
- */
-extern xen_network_record_opt *
-xen_network_record_opt_alloc(void);
-
-/**
- * Free the given xen_network_record_opt, and all referenced values.
- * The given record_opt must have been allocated by this library.
- */
-extern void
-xen_network_record_opt_free(xen_network_record_opt *record_opt);
-
-
-typedef struct xen_network_record_set
-{
- size_t size;
- xen_network_record *contents[];
-} xen_network_record_set;
-
-/**
- * Allocate a xen_network_record_set of the given size.
- */
-extern xen_network_record_set *
-xen_network_record_set_alloc(size_t size);
-
-/**
- * Free the given xen_network_record_set, and all referenced values.
- * The given set must have been allocated by this library.
- */
-extern void
-xen_network_record_set_free(xen_network_record_set *set);
-
-
-
-typedef struct xen_network_record_opt_set
-{
- size_t size;
- xen_network_record_opt *contents[];
-} xen_network_record_opt_set;
-
-/**
- * Allocate a xen_network_record_opt_set of the given size.
- */
-extern xen_network_record_opt_set *
-xen_network_record_opt_set_alloc(size_t size);
-
-/**
- * Free the given xen_network_record_opt_set, and all referenced
- * values. The given set must have been allocated by this library.
- */
-extern void
-xen_network_record_opt_set_free(xen_network_record_opt_set *set);
-
-
-/**
- * Get a record containing the current state of the given network.
- */
-extern bool
-xen_network_get_record(xen_session *session, xen_network_record **result, xen_network network);
-
-
-/**
- * Get a reference to the network instance with the specified UUID.
- */
-extern bool
-xen_network_get_by_uuid(xen_session *session, xen_network *result, char *uuid);
-
-
-/**
- * Create a new network instance, and return its handle.
- */
-extern bool
-xen_network_create(xen_session *session, xen_network *result, xen_network_record *record);
-
-
-/**
- * Destroy the specified network instance.
- */
-extern bool
-xen_network_destroy(xen_session *session, xen_network network);
-
-
-/**
- * Get all the network instances with the given label.
- */
-extern bool
-xen_network_get_by_name_label(xen_session *session, struct xen_network_set **result, char *label);
-
-
-/**
- * Get the uuid field of the given network.
- */
-extern bool
-xen_network_get_uuid(xen_session *session, char **result, xen_network network);
-
-
-/**
- * Get the name/label field of the given network.
- */
-extern bool
-xen_network_get_name_label(xen_session *session, char **result, xen_network network);
-
-
-/**
- * Get the name/description field of the given network.
- */
-extern bool
-xen_network_get_name_description(xen_session *session, char **result, xen_network network);
-
-
-/**
- * Get the VIFs field of the given network.
- */
-extern bool
-xen_network_get_vifs(xen_session *session, struct xen_vif_set **result, xen_network network);
-
-
-/**
- * Get the PIFs field of the given network.
- */
-extern bool
-xen_network_get_pifs(xen_session *session, struct xen_pif_set **result, xen_network network);
-
-
-/**
- * Get the other_config field of the given network.
- */
-extern bool
-xen_network_get_other_config(xen_session *session, xen_string_string_map **result, xen_network network);
-
-
-/**
- * Set the name/label field of the given network.
- */
-extern bool
-xen_network_set_name_label(xen_session *session, xen_network network, char *label);
-
-
-/**
- * Set the name/description field of the given network.
- */
-extern bool
-xen_network_set_name_description(xen_session *session, xen_network network, char *description);
-
-
-/**
- * Set the other_config field of the given network.
- */
-extern bool
-xen_network_set_other_config(xen_session *session, xen_network network, xen_string_string_map *other_config);
-
-
-/**
- * Add the given key-value pair to the other_config field of the given
- * network.
- */
-extern bool
-xen_network_add_to_other_config(xen_session *session, xen_network network, char *key, char *value);
-
-
-/**
- * Remove the given key and its corresponding value from the
- * other_config field of the given network. If the key is not in that Map,
- * then do nothing.
- */
-extern bool
-xen_network_remove_from_other_config(xen_session *session, xen_network network, char *key);
-
-
-/**
- * Return a list of all the networks known to the system.
- */
-extern bool
-xen_network_get_all(xen_session *session, struct xen_network_set **result);
-
-
-#endif
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_ON_CRASH_BEHAVIOUR_H
-#define XEN_ON_CRASH_BEHAVIOUR_H
-
-
-#include <xen/api/xen_common.h>
-
-
-enum xen_on_crash_behaviour
-{
- /**
- * destroy the VM state
- */
- XEN_ON_CRASH_BEHAVIOUR_DESTROY,
-
- /**
- * record a coredump and then destroy the VM state
- */
- XEN_ON_CRASH_BEHAVIOUR_COREDUMP_AND_DESTROY,
-
- /**
- * restart the VM
- */
- XEN_ON_CRASH_BEHAVIOUR_RESTART,
-
- /**
- * record a coredump and then restart the VM
- */
- XEN_ON_CRASH_BEHAVIOUR_COREDUMP_AND_RESTART,
-
- /**
- * leave the crashed VM as-is
- */
- XEN_ON_CRASH_BEHAVIOUR_PRESERVE,
-
- /**
- * rename the crashed VM and start a new copy
- */
- XEN_ON_CRASH_BEHAVIOUR_RENAME_RESTART
-};
-
-
-typedef struct xen_on_crash_behaviour_set
-{
- size_t size;
- enum xen_on_crash_behaviour contents[];
-} xen_on_crash_behaviour_set;
-
-/**
- * Allocate a xen_on_crash_behaviour_set of the given size.
- */
-extern xen_on_crash_behaviour_set *
-xen_on_crash_behaviour_set_alloc(size_t size);
-
-/**
- * Free the given xen_on_crash_behaviour_set. The given set must have
- * been allocated by this library.
- */
-extern void
-xen_on_crash_behaviour_set_free(xen_on_crash_behaviour_set *set);
-
-
-/**
- * Return the name corresponding to the given code. This string must
- * not be modified or freed.
- */
-extern const char *
-xen_on_crash_behaviour_to_string(enum xen_on_crash_behaviour val);
-
-
-/**
- * Return the correct code for the given string, or set the session
- * object to failure and return an undefined value if the given string does
- * not match a known code.
- */
-extern enum xen_on_crash_behaviour
-xen_on_crash_behaviour_from_string(xen_session *session, const char *str);
-
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_ON_NORMAL_EXIT_H
-#define XEN_ON_NORMAL_EXIT_H
-
-
-#include <xen/api/xen_common.h>
-
-
-enum xen_on_normal_exit
-{
- /**
- * destroy the VM state
- */
- XEN_ON_NORMAL_EXIT_DESTROY,
-
- /**
- * restart the VM
- */
- XEN_ON_NORMAL_EXIT_RESTART
-};
-
-
-typedef struct xen_on_normal_exit_set
-{
- size_t size;
- enum xen_on_normal_exit contents[];
-} xen_on_normal_exit_set;
-
-/**
- * Allocate a xen_on_normal_exit_set of the given size.
- */
-extern xen_on_normal_exit_set *
-xen_on_normal_exit_set_alloc(size_t size);
-
-/**
- * Free the given xen_on_normal_exit_set. The given set must have been
- * allocated by this library.
- */
-extern void
-xen_on_normal_exit_set_free(xen_on_normal_exit_set *set);
-
-
-/**
- * Return the name corresponding to the given code. This string must
- * not be modified or freed.
- */
-extern const char *
-xen_on_normal_exit_to_string(enum xen_on_normal_exit val);
-
-
-/**
- * Return the correct code for the given string, or set the session
- * object to failure and return an undefined value if the given string does
- * not match a known code.
- */
-extern enum xen_on_normal_exit
-xen_on_normal_exit_from_string(xen_session *session, const char *str);
-
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_PBD_H
-#define XEN_PBD_H
-
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_host_decl.h>
-#include <xen/api/xen_pbd_decl.h>
-#include <xen/api/xen_sr_decl.h>
-#include <xen/api/xen_string_string_map.h>
-
-
-/*
- * The PBD class.
- *
- * The physical block devices through which hosts access SRs.
- */
-
-
-/**
- * Free the given xen_pbd. The given handle must have been allocated
- * by this library.
- */
-extern void
-xen_pbd_free(xen_pbd pbd);
-
-
-typedef struct xen_pbd_set
-{
- size_t size;
- xen_pbd *contents[];
-} xen_pbd_set;
-
-/**
- * Allocate a xen_pbd_set of the given size.
- */
-extern xen_pbd_set *
-xen_pbd_set_alloc(size_t size);
-
-/**
- * Free the given xen_pbd_set. The given set must have been allocated
- * by this library.
- */
-extern void
-xen_pbd_set_free(xen_pbd_set *set);
-
-
-typedef struct xen_pbd_record
-{
- xen_pbd handle;
- char *uuid;
- struct xen_host_record_opt *host;
- struct xen_sr_record_opt *sr;
- xen_string_string_map *device_config;
- bool currently_attached;
-} xen_pbd_record;
-
-/**
- * Allocate a xen_pbd_record.
- */
-extern xen_pbd_record *
-xen_pbd_record_alloc(void);
-
-/**
- * Free the given xen_pbd_record, and all referenced values. The given
- * record must have been allocated by this library.
- */
-extern void
-xen_pbd_record_free(xen_pbd_record *record);
-
-
-typedef struct xen_pbd_record_opt
-{
- bool is_record;
- union
- {
- xen_pbd handle;
- xen_pbd_record *record;
- } u;
-} xen_pbd_record_opt;
-
-/**
- * Allocate a xen_pbd_record_opt.
- */
-extern xen_pbd_record_opt *
-xen_pbd_record_opt_alloc(void);
-
-/**
- * Free the given xen_pbd_record_opt, and all referenced values. The
- * given record_opt must have been allocated by this library.
- */
-extern void
-xen_pbd_record_opt_free(xen_pbd_record_opt *record_opt);
-
-
-typedef struct xen_pbd_record_set
-{
- size_t size;
- xen_pbd_record *contents[];
-} xen_pbd_record_set;
-
-/**
- * Allocate a xen_pbd_record_set of the given size.
- */
-extern xen_pbd_record_set *
-xen_pbd_record_set_alloc(size_t size);
-
-/**
- * Free the given xen_pbd_record_set, and all referenced values. The
- * given set must have been allocated by this library.
- */
-extern void
-xen_pbd_record_set_free(xen_pbd_record_set *set);
-
-
-
-typedef struct xen_pbd_record_opt_set
-{
- size_t size;
- xen_pbd_record_opt *contents[];
-} xen_pbd_record_opt_set;
-
-/**
- * Allocate a xen_pbd_record_opt_set of the given size.
- */
-extern xen_pbd_record_opt_set *
-xen_pbd_record_opt_set_alloc(size_t size);
-
-/**
- * Free the given xen_pbd_record_opt_set, and all referenced values.
- * The given set must have been allocated by this library.
- */
-extern void
-xen_pbd_record_opt_set_free(xen_pbd_record_opt_set *set);
-
-
-/**
- * Get a record containing the current state of the given PBD.
- */
-extern bool
-xen_pbd_get_record(xen_session *session, xen_pbd_record **result, xen_pbd pbd);
-
-
-/**
- * Get a reference to the PBD instance with the specified UUID.
- */
-extern bool
-xen_pbd_get_by_uuid(xen_session *session, xen_pbd *result, char *uuid);
-
-
-/**
- * Create a new PBD instance, and return its handle.
- */
-extern bool
-xen_pbd_create(xen_session *session, xen_pbd *result, xen_pbd_record *record);
-
-
-/**
- * Destroy the specified PBD instance.
- */
-extern bool
-xen_pbd_destroy(xen_session *session, xen_pbd pbd);
-
-
-/**
- * Get the uuid field of the given PBD.
- */
-extern bool
-xen_pbd_get_uuid(xen_session *session, char **result, xen_pbd pbd);
-
-
-/**
- * Get the host field of the given PBD.
- */
-extern bool
-xen_pbd_get_host(xen_session *session, xen_host *result, xen_pbd pbd);
-
-
-/**
- * Get the SR field of the given PBD.
- */
-extern bool
-xen_pbd_get_sr(xen_session *session, xen_sr *result, xen_pbd pbd);
-
-
-/**
- * Get the device_config field of the given PBD.
- */
-extern bool
-xen_pbd_get_device_config(xen_session *session, xen_string_string_map **result, xen_pbd pbd);
-
-
-/**
- * Get the currently_attached field of the given PBD.
- */
-extern bool
-xen_pbd_get_currently_attached(xen_session *session, bool *result, xen_pbd pbd);
-
-
-/**
- * Return a list of all the PBDs known to the system.
- */
-extern bool
-xen_pbd_get_all(xen_session *session, struct xen_pbd_set **result);
-
-
-#endif
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_PIF_H
-#define XEN_PIF_H
-
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_host_decl.h>
-#include <xen/api/xen_network_decl.h>
-#include <xen/api/xen_pif_decl.h>
-#include <xen/api/xen_pif_metrics_decl.h>
-
-
-/*
- * The PIF class.
- *
- * A physical network interface (note separate VLANs are represented as
- * several PIFs).
- */
-
-
-/**
- * Free the given xen_pif. The given handle must have been allocated
- * by this library.
- */
-extern void
-xen_pif_free(xen_pif pif);
-
-
-typedef struct xen_pif_set
-{
- size_t size;
- xen_pif *contents[];
-} xen_pif_set;
-
-/**
- * Allocate a xen_pif_set of the given size.
- */
-extern xen_pif_set *
-xen_pif_set_alloc(size_t size);
-
-/**
- * Free the given xen_pif_set. The given set must have been allocated
- * by this library.
- */
-extern void
-xen_pif_set_free(xen_pif_set *set);
-
-
-typedef struct xen_pif_record
-{
- xen_pif handle;
- char *uuid;
- char *device;
- struct xen_network_record_opt *network;
- struct xen_host_record_opt *host;
- char *mac;
- int64_t mtu;
- int64_t vlan;
- struct xen_pif_metrics_record_opt *metrics;
-} xen_pif_record;
-
-/**
- * Allocate a xen_pif_record.
- */
-extern xen_pif_record *
-xen_pif_record_alloc(void);
-
-/**
- * Free the given xen_pif_record, and all referenced values. The given
- * record must have been allocated by this library.
- */
-extern void
-xen_pif_record_free(xen_pif_record *record);
-
-
-typedef struct xen_pif_record_opt
-{
- bool is_record;
- union
- {
- xen_pif handle;
- xen_pif_record *record;
- } u;
-} xen_pif_record_opt;
-
-/**
- * Allocate a xen_pif_record_opt.
- */
-extern xen_pif_record_opt *
-xen_pif_record_opt_alloc(void);
-
-/**
- * Free the given xen_pif_record_opt, and all referenced values. The
- * given record_opt must have been allocated by this library.
- */
-extern void
-xen_pif_record_opt_free(xen_pif_record_opt *record_opt);
-
-
-typedef struct xen_pif_record_set
-{
- size_t size;
- xen_pif_record *contents[];
-} xen_pif_record_set;
-
-/**
- * Allocate a xen_pif_record_set of the given size.
- */
-extern xen_pif_record_set *
-xen_pif_record_set_alloc(size_t size);
-
-/**
- * Free the given xen_pif_record_set, and all referenced values. The
- * given set must have been allocated by this library.
- */
-extern void
-xen_pif_record_set_free(xen_pif_record_set *set);
-
-
-
-typedef struct xen_pif_record_opt_set
-{
- size_t size;
- xen_pif_record_opt *contents[];
-} xen_pif_record_opt_set;
-
-/**
- * Allocate a xen_pif_record_opt_set of the given size.
- */
-extern xen_pif_record_opt_set *
-xen_pif_record_opt_set_alloc(size_t size);
-
-/**
- * Free the given xen_pif_record_opt_set, and all referenced values.
- * The given set must have been allocated by this library.
- */
-extern void
-xen_pif_record_opt_set_free(xen_pif_record_opt_set *set);
-
-
-/**
- * Get a record containing the current state of the given PIF.
- */
-extern bool
-xen_pif_get_record(xen_session *session, xen_pif_record **result, xen_pif pif);
-
-
-/**
- * Get a reference to the PIF instance with the specified UUID.
- */
-extern bool
-xen_pif_get_by_uuid(xen_session *session, xen_pif *result, char *uuid);
-
-
-/**
- * Get the uuid field of the given PIF.
- */
-extern bool
-xen_pif_get_uuid(xen_session *session, char **result, xen_pif pif);
-
-
-/**
- * Get the device field of the given PIF.
- */
-extern bool
-xen_pif_get_device(xen_session *session, char **result, xen_pif pif);
-
-
-/**
- * Get the network field of the given PIF.
- */
-extern bool
-xen_pif_get_network(xen_session *session, xen_network *result, xen_pif pif);
-
-
-/**
- * Get the host field of the given PIF.
- */
-extern bool
-xen_pif_get_host(xen_session *session, xen_host *result, xen_pif pif);
-
-
-/**
- * Get the MAC field of the given PIF.
- */
-extern bool
-xen_pif_get_mac(xen_session *session, char **result, xen_pif pif);
-
-
-/**
- * Get the MTU field of the given PIF.
- */
-extern bool
-xen_pif_get_mtu(xen_session *session, int64_t *result, xen_pif pif);
-
-
-/**
- * Get the VLAN field of the given PIF.
- */
-extern bool
-xen_pif_get_vlan(xen_session *session, int64_t *result, xen_pif pif);
-
-
-/**
- * Get the metrics field of the given PIF.
- */
-extern bool
-xen_pif_get_metrics(xen_session *session, xen_pif_metrics *result, xen_pif pif);
-
-
-/**
- * Set the device field of the given PIF.
- */
-extern bool
-xen_pif_set_device(xen_session *session, xen_pif pif, char *device);
-
-
-/**
- * Set the MAC field of the given PIF.
- */
-extern bool
-xen_pif_set_mac(xen_session *session, xen_pif pif, char *mac);
-
-
-/**
- * Set the MTU field of the given PIF.
- */
-extern bool
-xen_pif_set_mtu(xen_session *session, xen_pif pif, int64_t mtu);
-
-
-/**
- * Set the VLAN field of the given PIF.
- */
-extern bool
-xen_pif_set_vlan(xen_session *session, xen_pif pif, int64_t vlan);
-
-
-/**
- * Create a VLAN interface from an existing physical interface.
- */
-extern bool
-xen_pif_create_vlan(xen_session *session, xen_pif *result, char *device, xen_network network, xen_host host, int64_t vlan);
-
-
-/**
- * Destroy the interface (provided it is a synthetic interface like a
- * VLAN; fail if it is a physical interface).
- */
-extern bool
-xen_pif_destroy(xen_session *session, xen_pif self);
-
-
-/**
- * Return a list of all the PIFs known to the system.
- */
-extern bool
-xen_pif_get_all(xen_session *session, struct xen_pif_set **result);
-
-
-#endif
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_PIF_METRICS_H
-#define XEN_PIF_METRICS_H
-
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_pif_metrics_decl.h>
-
-
-/*
- * The PIF_metrics class.
- *
- * The metrics associated with a physical network interface.
- */
-
-
-/**
- * Free the given xen_pif_metrics. The given handle must have been
- * allocated by this library.
- */
-extern void
-xen_pif_metrics_free(xen_pif_metrics pif_metrics);
-
-
-typedef struct xen_pif_metrics_set
-{
- size_t size;
- xen_pif_metrics *contents[];
-} xen_pif_metrics_set;
-
-/**
- * Allocate a xen_pif_metrics_set of the given size.
- */
-extern xen_pif_metrics_set *
-xen_pif_metrics_set_alloc(size_t size);
-
-/**
- * Free the given xen_pif_metrics_set. The given set must have been
- * allocated by this library.
- */
-extern void
-xen_pif_metrics_set_free(xen_pif_metrics_set *set);
-
-
-typedef struct xen_pif_metrics_record
-{
- xen_pif_metrics handle;
- char *uuid;
- double io_read_kbs;
- double io_write_kbs;
- time_t last_updated;
-} xen_pif_metrics_record;
-
-/**
- * Allocate a xen_pif_metrics_record.
- */
-extern xen_pif_metrics_record *
-xen_pif_metrics_record_alloc(void);
-
-/**
- * Free the given xen_pif_metrics_record, and all referenced values.
- * The given record must have been allocated by this library.
- */
-extern void
-xen_pif_metrics_record_free(xen_pif_metrics_record *record);
-
-
-typedef struct xen_pif_metrics_record_opt
-{
- bool is_record;
- union
- {
- xen_pif_metrics handle;
- xen_pif_metrics_record *record;
- } u;
-} xen_pif_metrics_record_opt;
-
-/**
- * Allocate a xen_pif_metrics_record_opt.
- */
-extern xen_pif_metrics_record_opt *
-xen_pif_metrics_record_opt_alloc(void);
-
-/**
- * Free the given xen_pif_metrics_record_opt, and all referenced
- * values. The given record_opt must have been allocated by this library.
- */
-extern void
-xen_pif_metrics_record_opt_free(xen_pif_metrics_record_opt *record_opt);
-
-
-typedef struct xen_pif_metrics_record_set
-{
- size_t size;
- xen_pif_metrics_record *contents[];
-} xen_pif_metrics_record_set;
-
-/**
- * Allocate a xen_pif_metrics_record_set of the given size.
- */
-extern xen_pif_metrics_record_set *
-xen_pif_metrics_record_set_alloc(size_t size);
-
-/**
- * Free the given xen_pif_metrics_record_set, and all referenced
- * values. The given set must have been allocated by this library.
- */
-extern void
-xen_pif_metrics_record_set_free(xen_pif_metrics_record_set *set);
-
-
-
-typedef struct xen_pif_metrics_record_opt_set
-{
- size_t size;
- xen_pif_metrics_record_opt *contents[];
-} xen_pif_metrics_record_opt_set;
-
-/**
- * Allocate a xen_pif_metrics_record_opt_set of the given size.
- */
-extern xen_pif_metrics_record_opt_set *
-xen_pif_metrics_record_opt_set_alloc(size_t size);
-
-/**
- * Free the given xen_pif_metrics_record_opt_set, and all referenced
- * values. The given set must have been allocated by this library.
- */
-extern void
-xen_pif_metrics_record_opt_set_free(xen_pif_metrics_record_opt_set *set);
-
-
-/**
- * Get a record containing the current state of the given PIF_metrics.
- */
-extern bool
-xen_pif_metrics_get_record(xen_session *session, xen_pif_metrics_record **result, xen_pif_metrics pif_metrics);
-
-
-/**
- * Get a reference to the PIF_metrics instance with the specified UUID.
- */
-extern bool
-xen_pif_metrics_get_by_uuid(xen_session *session, xen_pif_metrics *result, char *uuid);
-
-
-/**
- * Get the uuid field of the given PIF_metrics.
- */
-extern bool
-xen_pif_metrics_get_uuid(xen_session *session, char **result, xen_pif_metrics pif_metrics);
-
-
-/**
- * Get the io/read_kbs field of the given PIF_metrics.
- */
-extern bool
-xen_pif_metrics_get_io_read_kbs(xen_session *session, double *result, xen_pif_metrics pif_metrics);
-
-
-/**
- * Get the io/write_kbs field of the given PIF_metrics.
- */
-extern bool
-xen_pif_metrics_get_io_write_kbs(xen_session *session, double *result, xen_pif_metrics pif_metrics);
-
-
-/**
- * Get the last_updated field of the given PIF_metrics.
- */
-extern bool
-xen_pif_metrics_get_last_updated(xen_session *session, time_t *result, xen_pif_metrics pif_metrics);
-
-
-/**
- * Return a list of all the PIF_metrics instances known to the system.
- */
-extern bool
-xen_pif_metrics_get_all(xen_session *session, struct xen_pif_metrics_set **result);
-
-
-#endif
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_SR_H
-#define XEN_SR_H
-
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_pbd_decl.h>
-#include <xen/api/xen_sr_decl.h>
-#include <xen/api/xen_string_set.h>
-#include <xen/api/xen_vdi_decl.h>
-
-
-/*
- * The SR class.
- *
- * A storage repository.
- */
-
-
-/**
- * Free the given xen_sr. The given handle must have been allocated by
- * this library.
- */
-extern void
-xen_sr_free(xen_sr sr);
-
-
-typedef struct xen_sr_set
-{
- size_t size;
- xen_sr *contents[];
-} xen_sr_set;
-
-/**
- * Allocate a xen_sr_set of the given size.
- */
-extern xen_sr_set *
-xen_sr_set_alloc(size_t size);
-
-/**
- * Free the given xen_sr_set. The given set must have been allocated
- * by this library.
- */
-extern void
-xen_sr_set_free(xen_sr_set *set);
-
-
-typedef struct xen_sr_record
-{
- xen_sr handle;
- char *uuid;
- char *name_label;
- char *name_description;
- struct xen_vdi_record_opt_set *vdis;
- struct xen_pbd_record_opt_set *pbds;
- int64_t virtual_allocation;
- int64_t physical_utilisation;
- int64_t physical_size;
- char *type;
- char *content_type;
-} xen_sr_record;
-
-/**
- * Allocate a xen_sr_record.
- */
-extern xen_sr_record *
-xen_sr_record_alloc(void);
-
-/**
- * Free the given xen_sr_record, and all referenced values. The given
- * record must have been allocated by this library.
- */
-extern void
-xen_sr_record_free(xen_sr_record *record);
-
-
-typedef struct xen_sr_record_opt
-{
- bool is_record;
- union
- {
- xen_sr handle;
- xen_sr_record *record;
- } u;
-} xen_sr_record_opt;
-
-/**
- * Allocate a xen_sr_record_opt.
- */
-extern xen_sr_record_opt *
-xen_sr_record_opt_alloc(void);
-
-/**
- * Free the given xen_sr_record_opt, and all referenced values. The
- * given record_opt must have been allocated by this library.
- */
-extern void
-xen_sr_record_opt_free(xen_sr_record_opt *record_opt);
-
-
-typedef struct xen_sr_record_set
-{
- size_t size;
- xen_sr_record *contents[];
-} xen_sr_record_set;
-
-/**
- * Allocate a xen_sr_record_set of the given size.
- */
-extern xen_sr_record_set *
-xen_sr_record_set_alloc(size_t size);
-
-/**
- * Free the given xen_sr_record_set, and all referenced values. The
- * given set must have been allocated by this library.
- */
-extern void
-xen_sr_record_set_free(xen_sr_record_set *set);
-
-
-
-typedef struct xen_sr_record_opt_set
-{
- size_t size;
- xen_sr_record_opt *contents[];
-} xen_sr_record_opt_set;
-
-/**
- * Allocate a xen_sr_record_opt_set of the given size.
- */
-extern xen_sr_record_opt_set *
-xen_sr_record_opt_set_alloc(size_t size);
-
-/**
- * Free the given xen_sr_record_opt_set, and all referenced values.
- * The given set must have been allocated by this library.
- */
-extern void
-xen_sr_record_opt_set_free(xen_sr_record_opt_set *set);
-
-
-/**
- * Get a record containing the current state of the given SR.
- */
-extern bool
-xen_sr_get_record(xen_session *session, xen_sr_record **result, xen_sr sr);
-
-
-/**
- * Get a reference to the SR instance with the specified UUID.
- */
-extern bool
-xen_sr_get_by_uuid(xen_session *session, xen_sr *result, char *uuid);
-
-
-/**
- * Get all the SR instances with the given label.
- */
-extern bool
-xen_sr_get_by_name_label(xen_session *session, struct xen_sr_set **result, char *label);
-
-
-/**
- * Get the uuid field of the given SR.
- */
-extern bool
-xen_sr_get_uuid(xen_session *session, char **result, xen_sr sr);
-
-
-/**
- * Get the name/label field of the given SR.
- */
-extern bool
-xen_sr_get_name_label(xen_session *session, char **result, xen_sr sr);
-
-
-/**
- * Get the name/description field of the given SR.
- */
-extern bool
-xen_sr_get_name_description(xen_session *session, char **result, xen_sr sr);
-
-
-/**
- * Get the VDIs field of the given SR.
- */
-extern bool
-xen_sr_get_vdis(xen_session *session, struct xen_vdi_set **result, xen_sr sr);
-
-
-/**
- * Get the PBDs field of the given SR.
- */
-extern bool
-xen_sr_get_pbds(xen_session *session, struct xen_pbd_set **result, xen_sr sr);
-
-
-/**
- * Get the virtual_allocation field of the given SR.
- */
-extern bool
-xen_sr_get_virtual_allocation(xen_session *session, int64_t *result, xen_sr sr);
-
-
-/**
- * Get the physical_utilisation field of the given SR.
- */
-extern bool
-xen_sr_get_physical_utilisation(xen_session *session, int64_t *result, xen_sr sr);
-
-
-/**
- * Get the physical_size field of the given SR.
- */
-extern bool
-xen_sr_get_physical_size(xen_session *session, int64_t *result, xen_sr sr);
-
-
-/**
- * Get the type field of the given SR.
- */
-extern bool
-xen_sr_get_type(xen_session *session, char **result, xen_sr sr);
-
-
-/**
- * Get the content_type field of the given SR.
- */
-extern bool
-xen_sr_get_content_type(xen_session *session, char **result, xen_sr sr);
-
-
-/**
- * Set the name/label field of the given SR.
- */
-extern bool
-xen_sr_set_name_label(xen_session *session, xen_sr sr, char *label);
-
-
-/**
- * Set the name/description field of the given SR.
- */
-extern bool
-xen_sr_set_name_description(xen_session *session, xen_sr sr, char *description);
-
-
-/**
- * Return a set of all the SR types supported by the system.
- */
-extern bool
-xen_sr_get_supported_types(xen_session *session, struct xen_string_set **result);
-
-
-/**
- * Return a list of all the SRs known to the system.
- */
-extern bool
-xen_sr_get_all(xen_session *session, struct xen_sr_set **result);
-
-
-#endif
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_STRING_STRING_MAP_H
-#define XEN_STRING_STRING_MAP_H
-
-
-#include <xen/api/xen_common.h>
-
-
-typedef struct xen_string_string_map_contents
-{
- char *key;
- char *val;
-} xen_string_string_map_contents;
-
-
-typedef struct xen_string_string_map
-{
- size_t size;
- xen_string_string_map_contents contents[];
-} xen_string_string_map;
-
-/**
- * Allocate a xen_string_string_map of the given size.
- */
-extern xen_string_string_map *
-xen_string_string_map_alloc(size_t size);
-
-/**
- * Free the given xen_string_string_map, and all referenced values.
- * The given map must have been allocated by this library.
- */
-extern void
-xen_string_string_map_free(xen_string_string_map *map);
-
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_USER_H
-#define XEN_USER_H
-
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_user_decl.h>
-
-
-/*
- * The user class.
- *
- * A user of the system.
- */
-
-
-/**
- * Free the given xen_user. The given handle must have been allocated
- * by this library.
- */
-extern void
-xen_user_free(xen_user user);
-
-
-typedef struct xen_user_set
-{
- size_t size;
- xen_user *contents[];
-} xen_user_set;
-
-/**
- * Allocate a xen_user_set of the given size.
- */
-extern xen_user_set *
-xen_user_set_alloc(size_t size);
-
-/**
- * Free the given xen_user_set. The given set must have been allocated
- * by this library.
- */
-extern void
-xen_user_set_free(xen_user_set *set);
-
-
-typedef struct xen_user_record
-{
- xen_user handle;
- char *uuid;
- char *short_name;
- char *fullname;
-} xen_user_record;
-
-/**
- * Allocate a xen_user_record.
- */
-extern xen_user_record *
-xen_user_record_alloc(void);
-
-/**
- * Free the given xen_user_record, and all referenced values. The
- * given record must have been allocated by this library.
- */
-extern void
-xen_user_record_free(xen_user_record *record);
-
-
-typedef struct xen_user_record_opt
-{
- bool is_record;
- union
- {
- xen_user handle;
- xen_user_record *record;
- } u;
-} xen_user_record_opt;
-
-/**
- * Allocate a xen_user_record_opt.
- */
-extern xen_user_record_opt *
-xen_user_record_opt_alloc(void);
-
-/**
- * Free the given xen_user_record_opt, and all referenced values. The
- * given record_opt must have been allocated by this library.
- */
-extern void
-xen_user_record_opt_free(xen_user_record_opt *record_opt);
-
-
-typedef struct xen_user_record_set
-{
- size_t size;
- xen_user_record *contents[];
-} xen_user_record_set;
-
-/**
- * Allocate a xen_user_record_set of the given size.
- */
-extern xen_user_record_set *
-xen_user_record_set_alloc(size_t size);
-
-/**
- * Free the given xen_user_record_set, and all referenced values. The
- * given set must have been allocated by this library.
- */
-extern void
-xen_user_record_set_free(xen_user_record_set *set);
-
-
-
-typedef struct xen_user_record_opt_set
-{
- size_t size;
- xen_user_record_opt *contents[];
-} xen_user_record_opt_set;
-
-/**
- * Allocate a xen_user_record_opt_set of the given size.
- */
-extern xen_user_record_opt_set *
-xen_user_record_opt_set_alloc(size_t size);
-
-/**
- * Free the given xen_user_record_opt_set, and all referenced values.
- * The given set must have been allocated by this library.
- */
-extern void
-xen_user_record_opt_set_free(xen_user_record_opt_set *set);
-
-
-/**
- * Get a record containing the current state of the given user.
- */
-extern bool
-xen_user_get_record(xen_session *session, xen_user_record **result, xen_user user);
-
-
-/**
- * Get a reference to the user instance with the specified UUID.
- */
-extern bool
-xen_user_get_by_uuid(xen_session *session, xen_user *result, char *uuid);
-
-
-/**
- * Create a new user instance, and return its handle.
- */
-extern bool
-xen_user_create(xen_session *session, xen_user *result, xen_user_record *record);
-
-
-/**
- * Destroy the specified user instance.
- */
-extern bool
-xen_user_destroy(xen_session *session, xen_user user);
-
-
-/**
- * Get the uuid field of the given user.
- */
-extern bool
-xen_user_get_uuid(xen_session *session, char **result, xen_user user);
-
-
-/**
- * Get the short_name field of the given user.
- */
-extern bool
-xen_user_get_short_name(xen_session *session, char **result, xen_user user);
-
-
-/**
- * Get the fullname field of the given user.
- */
-extern bool
-xen_user_get_fullname(xen_session *session, char **result, xen_user user);
-
-
-/**
- * Set the fullname field of the given user.
- */
-extern bool
-xen_user_set_fullname(xen_session *session, xen_user user, char *fullname);
-
-
-#endif
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_VBD_H
-#define XEN_VBD_H
-
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_string_set.h>
-#include <xen/api/xen_string_string_map.h>
-#include <xen/api/xen_vbd_decl.h>
-#include <xen/api/xen_vbd_metrics_decl.h>
-#include <xen/api/xen_vbd_mode.h>
-#include <xen/api/xen_vbd_type.h>
-#include <xen/api/xen_vdi_decl.h>
-#include <xen/api/xen_vm_decl.h>
-
-
-/*
- * The VBD class.
- *
- * A virtual block device.
- */
-
-
-/**
- * Free the given xen_vbd. The given handle must have been allocated
- * by this library.
- */
-extern void
-xen_vbd_free(xen_vbd vbd);
-
-
-typedef struct xen_vbd_set
-{
- size_t size;
- xen_vbd *contents[];
-} xen_vbd_set;
-
-/**
- * Allocate a xen_vbd_set of the given size.
- */
-extern xen_vbd_set *
-xen_vbd_set_alloc(size_t size);
-
-/**
- * Free the given xen_vbd_set. The given set must have been allocated
- * by this library.
- */
-extern void
-xen_vbd_set_free(xen_vbd_set *set);
-
-
-typedef struct xen_vbd_record
-{
- xen_vbd handle;
- char *uuid;
- struct xen_vm_record_opt *vm;
- struct xen_vdi_record_opt *vdi;
- char *device;
- bool bootable;
- enum xen_vbd_mode mode;
- enum xen_vbd_type type;
- bool currently_attached;
- int64_t status_code;
- char *status_detail;
- xen_string_string_map *runtime_properties;
- char *qos_algorithm_type;
- xen_string_string_map *qos_algorithm_params;
- struct xen_string_set *qos_supported_algorithms;
- struct xen_vbd_metrics_record_opt *metrics;
-} xen_vbd_record;
-
-/**
- * Allocate a xen_vbd_record.
- */
-extern xen_vbd_record *
-xen_vbd_record_alloc(void);
-
-/**
- * Free the given xen_vbd_record, and all referenced values. The given
- * record must have been allocated by this library.
- */
-extern void
-xen_vbd_record_free(xen_vbd_record *record);
-
-
-typedef struct xen_vbd_record_opt
-{
- bool is_record;
- union
- {
- xen_vbd handle;
- xen_vbd_record *record;
- } u;
-} xen_vbd_record_opt;
-
-/**
- * Allocate a xen_vbd_record_opt.
- */
-extern xen_vbd_record_opt *
-xen_vbd_record_opt_alloc(void);
-
-/**
- * Free the given xen_vbd_record_opt, and all referenced values. The
- * given record_opt must have been allocated by this library.
- */
-extern void
-xen_vbd_record_opt_free(xen_vbd_record_opt *record_opt);
-
-
-typedef struct xen_vbd_record_set
-{
- size_t size;
- xen_vbd_record *contents[];
-} xen_vbd_record_set;
-
-/**
- * Allocate a xen_vbd_record_set of the given size.
- */
-extern xen_vbd_record_set *
-xen_vbd_record_set_alloc(size_t size);
-
-/**
- * Free the given xen_vbd_record_set, and all referenced values. The
- * given set must have been allocated by this library.
- */
-extern void
-xen_vbd_record_set_free(xen_vbd_record_set *set);
-
-
-
-typedef struct xen_vbd_record_opt_set
-{
- size_t size;
- xen_vbd_record_opt *contents[];
-} xen_vbd_record_opt_set;
-
-/**
- * Allocate a xen_vbd_record_opt_set of the given size.
- */
-extern xen_vbd_record_opt_set *
-xen_vbd_record_opt_set_alloc(size_t size);
-
-/**
- * Free the given xen_vbd_record_opt_set, and all referenced values.
- * The given set must have been allocated by this library.
- */
-extern void
-xen_vbd_record_opt_set_free(xen_vbd_record_opt_set *set);
-
-
-/**
- * Get a record containing the current state of the given VBD.
- */
-extern bool
-xen_vbd_get_record(xen_session *session, xen_vbd_record **result, xen_vbd vbd);
-
-
-/**
- * Get a reference to the VBD instance with the specified UUID.
- */
-extern bool
-xen_vbd_get_by_uuid(xen_session *session, xen_vbd *result, char *uuid);
-
-
-/**
- * Create a new VBD instance, and return its handle.
- */
-extern bool
-xen_vbd_create(xen_session *session, xen_vbd *result, xen_vbd_record *record);
-
-
-/**
- * Destroy the specified VBD instance.
- */
-extern bool
-xen_vbd_destroy(xen_session *session, xen_vbd vbd);
-
-
-/**
- * Get the uuid field of the given VBD.
- */
-extern bool
-xen_vbd_get_uuid(xen_session *session, char **result, xen_vbd vbd);
-
-
-/**
- * Get the VM field of the given VBD.
- */
-extern bool
-xen_vbd_get_vm(xen_session *session, xen_vm *result, xen_vbd vbd);
-
-
-/**
- * Get the VDI field of the given VBD.
- */
-extern bool
-xen_vbd_get_vdi(xen_session *session, xen_vdi *result, xen_vbd vbd);
-
-
-/**
- * Get the device field of the given VBD.
- */
-extern bool
-xen_vbd_get_device(xen_session *session, char **result, xen_vbd vbd);
-
-
-/**
- * Get the bootable field of the given VBD.
- */
-extern bool
-xen_vbd_get_bootable(xen_session *session, bool *result, xen_vbd vbd);
-
-
-/**
- * Get the mode field of the given VBD.
- */
-extern bool
-xen_vbd_get_mode(xen_session *session, enum xen_vbd_mode *result, xen_vbd vbd);
-
-
-/**
- * Get the type field of the given VBD.
- */
-extern bool
-xen_vbd_get_type(xen_session *session, enum xen_vbd_type *result, xen_vbd vbd);
-
-
-/**
- * Get the currently_attached field of the given VBD.
- */
-extern bool
-xen_vbd_get_currently_attached(xen_session *session, bool *result, xen_vbd vbd);
-
-
-/**
- * Get the status_code field of the given VBD.
- */
-extern bool
-xen_vbd_get_status_code(xen_session *session, int64_t *result, xen_vbd vbd);
-
-
-/**
- * Get the status_detail field of the given VBD.
- */
-extern bool
-xen_vbd_get_status_detail(xen_session *session, char **result, xen_vbd vbd);
-
-
-/**
- * Get the runtime_properties field of the given VBD.
- */
-extern bool
-xen_vbd_get_runtime_properties(xen_session *session, xen_string_string_map **result, xen_vbd vbd);
-
-
-/**
- * Get the qos/algorithm_type field of the given VBD.
- */
-extern bool
-xen_vbd_get_qos_algorithm_type(xen_session *session, char **result, xen_vbd vbd);
-
-
-/**
- * Get the qos/algorithm_params field of the given VBD.
- */
-extern bool
-xen_vbd_get_qos_algorithm_params(xen_session *session, xen_string_string_map **result, xen_vbd vbd);
-
-
-/**
- * Get the qos/supported_algorithms field of the given VBD.
- */
-extern bool
-xen_vbd_get_qos_supported_algorithms(xen_session *session, struct xen_string_set **result, xen_vbd vbd);
-
-
-/**
- * Get the metrics field of the given VBD.
- */
-extern bool
-xen_vbd_get_metrics(xen_session *session, xen_vbd_metrics *result, xen_vbd vbd);
-
-
-/**
- * Set the device field of the given VBD.
- */
-extern bool
-xen_vbd_set_device(xen_session *session, xen_vbd vbd, char *device);
-
-
-/**
- * Set the bootable field of the given VBD.
- */
-extern bool
-xen_vbd_set_bootable(xen_session *session, xen_vbd vbd, bool bootable);
-
-
-/**
- * Set the mode field of the given VBD.
- */
-extern bool
-xen_vbd_set_mode(xen_session *session, xen_vbd vbd, enum xen_vbd_mode mode);
-
-
-/**
- * Set the type field of the given VBD.
- */
-extern bool
-xen_vbd_set_type(xen_session *session, xen_vbd vbd, enum xen_vbd_type type);
-
-
-/**
- * Set the qos/algorithm_type field of the given VBD.
- */
-extern bool
-xen_vbd_set_qos_algorithm_type(xen_session *session, xen_vbd vbd, char *algorithm_type);
-
-
-/**
- * Set the qos/algorithm_params field of the given VBD.
- */
-extern bool
-xen_vbd_set_qos_algorithm_params(xen_session *session, xen_vbd vbd, xen_string_string_map *algorithm_params);
-
-
-/**
- * Add the given key-value pair to the qos/algorithm_params field of
- * the given VBD.
- */
-extern bool
-xen_vbd_add_to_qos_algorithm_params(xen_session *session, xen_vbd vbd, char *key, char *value);
-
-
-/**
- * Remove the given key and its corresponding value from the
- * qos/algorithm_params field of the given VBD. If the key is not in that
- * Map, then do nothing.
- */
-extern bool
-xen_vbd_remove_from_qos_algorithm_params(xen_session *session, xen_vbd vbd, char *key);
-
-
-/**
- * Change the media in the device for CDROM-like devices only. For
- * other devices, detach the VBD and attach a new one.
- */
-extern bool
-xen_vbd_media_change(xen_session *session, xen_vbd vbd, xen_vdi vdi);
-
-
-/**
- * Hotplug the specified VBD, dynamically attaching it to the running
- * VM.
- */
-extern bool
-xen_vbd_plug(xen_session *session, xen_vbd self);
-
-
-/**
- * Hot-unplug the specified VBD, dynamically unattaching it from the
- * running VM.
- */
-extern bool
-xen_vbd_unplug(xen_session *session, xen_vbd self);
-
-
-/**
- * Return a list of all the VBDs known to the system.
- */
-extern bool
-xen_vbd_get_all(xen_session *session, struct xen_vbd_set **result);
-
-
-#endif
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_VBD_METRICS_H
-#define XEN_VBD_METRICS_H
-
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_vbd_metrics_decl.h>
-
-
-/*
- * The VBD_metrics class.
- *
- * The metrics associated with a virtual block device.
- */
-
-
-/**
- * Free the given xen_vbd_metrics. The given handle must have been
- * allocated by this library.
- */
-extern void
-xen_vbd_metrics_free(xen_vbd_metrics vbd_metrics);
-
-
-typedef struct xen_vbd_metrics_set
-{
- size_t size;
- xen_vbd_metrics *contents[];
-} xen_vbd_metrics_set;
-
-/**
- * Allocate a xen_vbd_metrics_set of the given size.
- */
-extern xen_vbd_metrics_set *
-xen_vbd_metrics_set_alloc(size_t size);
-
-/**
- * Free the given xen_vbd_metrics_set. The given set must have been
- * allocated by this library.
- */
-extern void
-xen_vbd_metrics_set_free(xen_vbd_metrics_set *set);
-
-
-typedef struct xen_vbd_metrics_record
-{
- xen_vbd_metrics handle;
- char *uuid;
- double io_read_kbs;
- double io_write_kbs;
- time_t last_updated;
-} xen_vbd_metrics_record;
-
-/**
- * Allocate a xen_vbd_metrics_record.
- */
-extern xen_vbd_metrics_record *
-xen_vbd_metrics_record_alloc(void);
-
-/**
- * Free the given xen_vbd_metrics_record, and all referenced values.
- * The given record must have been allocated by this library.
- */
-extern void
-xen_vbd_metrics_record_free(xen_vbd_metrics_record *record);
-
-
-typedef struct xen_vbd_metrics_record_opt
-{
- bool is_record;
- union
- {
- xen_vbd_metrics handle;
- xen_vbd_metrics_record *record;
- } u;
-} xen_vbd_metrics_record_opt;
-
-/**
- * Allocate a xen_vbd_metrics_record_opt.
- */
-extern xen_vbd_metrics_record_opt *
-xen_vbd_metrics_record_opt_alloc(void);
-
-/**
- * Free the given xen_vbd_metrics_record_opt, and all referenced
- * values. The given record_opt must have been allocated by this library.
- */
-extern void
-xen_vbd_metrics_record_opt_free(xen_vbd_metrics_record_opt *record_opt);
-
-
-typedef struct xen_vbd_metrics_record_set
-{
- size_t size;
- xen_vbd_metrics_record *contents[];
-} xen_vbd_metrics_record_set;
-
-/**
- * Allocate a xen_vbd_metrics_record_set of the given size.
- */
-extern xen_vbd_metrics_record_set *
-xen_vbd_metrics_record_set_alloc(size_t size);
-
-/**
- * Free the given xen_vbd_metrics_record_set, and all referenced
- * values. The given set must have been allocated by this library.
- */
-extern void
-xen_vbd_metrics_record_set_free(xen_vbd_metrics_record_set *set);
-
-
-
-typedef struct xen_vbd_metrics_record_opt_set
-{
- size_t size;
- xen_vbd_metrics_record_opt *contents[];
-} xen_vbd_metrics_record_opt_set;
-
-/**
- * Allocate a xen_vbd_metrics_record_opt_set of the given size.
- */
-extern xen_vbd_metrics_record_opt_set *
-xen_vbd_metrics_record_opt_set_alloc(size_t size);
-
-/**
- * Free the given xen_vbd_metrics_record_opt_set, and all referenced
- * values. The given set must have been allocated by this library.
- */
-extern void
-xen_vbd_metrics_record_opt_set_free(xen_vbd_metrics_record_opt_set *set);
-
-
-/**
- * Get a record containing the current state of the given VBD_metrics.
- */
-extern bool
-xen_vbd_metrics_get_record(xen_session *session, xen_vbd_metrics_record **result, xen_vbd_metrics vbd_metrics);
-
-
-/**
- * Get a reference to the VBD_metrics instance with the specified UUID.
- */
-extern bool
-xen_vbd_metrics_get_by_uuid(xen_session *session, xen_vbd_metrics *result, char *uuid);
-
-
-/**
- * Get the uuid field of the given VBD_metrics.
- */
-extern bool
-xen_vbd_metrics_get_uuid(xen_session *session, char **result, xen_vbd_metrics vbd_metrics);
-
-
-/**
- * Get the io/read_kbs field of the given VBD_metrics.
- */
-extern bool
-xen_vbd_metrics_get_io_read_kbs(xen_session *session, double *result, xen_vbd_metrics vbd_metrics);
-
-
-/**
- * Get the io/write_kbs field of the given VBD_metrics.
- */
-extern bool
-xen_vbd_metrics_get_io_write_kbs(xen_session *session, double *result, xen_vbd_metrics vbd_metrics);
-
-
-/**
- * Get the last_updated field of the given VBD_metrics.
- */
-extern bool
-xen_vbd_metrics_get_last_updated(xen_session *session, time_t *result, xen_vbd_metrics vbd_metrics);
-
-
-/**
- * Return a list of all the VBD_metrics instances known to the system.
- */
-extern bool
-xen_vbd_metrics_get_all(xen_session *session, struct xen_vbd_metrics_set **result);
-
-
-#endif
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_VBD_MODE_H
-#define XEN_VBD_MODE_H
-
-
-#include <xen/api/xen_common.h>
-
-
-enum xen_vbd_mode
-{
- /**
- * disk is mounted read-only
- */
- XEN_VBD_MODE_RO,
-
- /**
- * disk is mounted read-write
- */
- XEN_VBD_MODE_RW
-};
-
-
-typedef struct xen_vbd_mode_set
-{
- size_t size;
- enum xen_vbd_mode contents[];
-} xen_vbd_mode_set;
-
-/**
- * Allocate a xen_vbd_mode_set of the given size.
- */
-extern xen_vbd_mode_set *
-xen_vbd_mode_set_alloc(size_t size);
-
-/**
- * Free the given xen_vbd_mode_set. The given set must have been
- * allocated by this library.
- */
-extern void
-xen_vbd_mode_set_free(xen_vbd_mode_set *set);
-
-
-/**
- * Return the name corresponding to the given code. This string must
- * not be modified or freed.
- */
-extern const char *
-xen_vbd_mode_to_string(enum xen_vbd_mode val);
-
-
-/**
- * Return the correct code for the given string, or set the session
- * object to failure and return an undefined value if the given string does
- * not match a known code.
- */
-extern enum xen_vbd_mode
-xen_vbd_mode_from_string(xen_session *session, const char *str);
-
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_VBD_TYPE_H
-#define XEN_VBD_TYPE_H
-
-
-#include <xen/api/xen_common.h>
-
-
-enum xen_vbd_type
-{
- /**
- * VBD will appear to guest as CD
- */
- XEN_VBD_TYPE_CD,
-
- /**
- * VBD will appear to guest as disk
- */
- XEN_VBD_TYPE_DISK
-};
-
-
-typedef struct xen_vbd_type_set
-{
- size_t size;
- enum xen_vbd_type contents[];
-} xen_vbd_type_set;
-
-/**
- * Allocate a xen_vbd_type_set of the given size.
- */
-extern xen_vbd_type_set *
-xen_vbd_type_set_alloc(size_t size);
-
-/**
- * Free the given xen_vbd_type_set. The given set must have been
- * allocated by this library.
- */
-extern void
-xen_vbd_type_set_free(xen_vbd_type_set *set);
-
-
-/**
- * Return the name corresponding to the given code. This string must
- * not be modified or freed.
- */
-extern const char *
-xen_vbd_type_to_string(enum xen_vbd_type val);
-
-
-/**
- * Return the correct code for the given string, or set the session
- * object to failure and return an undefined value if the given string does
- * not match a known code.
- */
-extern enum xen_vbd_type
-xen_vbd_type_from_string(xen_session *session, const char *str);
-
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_VDI_H
-#define XEN_VDI_H
-
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_crashdump_decl.h>
-#include <xen/api/xen_sr_decl.h>
-#include <xen/api/xen_string_string_map.h>
-#include <xen/api/xen_vbd_decl.h>
-#include <xen/api/xen_vdi_decl.h>
-#include <xen/api/xen_vdi_type.h>
-
-
-/*
- * The VDI class.
- *
- * A virtual disk image.
- */
-
-
-/**
- * Free the given xen_vdi. The given handle must have been allocated
- * by this library.
- */
-extern void
-xen_vdi_free(xen_vdi vdi);
-
-
-typedef struct xen_vdi_set
-{
- size_t size;
- xen_vdi *contents[];
-} xen_vdi_set;
-
-/**
- * Allocate a xen_vdi_set of the given size.
- */
-extern xen_vdi_set *
-xen_vdi_set_alloc(size_t size);
-
-/**
- * Free the given xen_vdi_set. The given set must have been allocated
- * by this library.
- */
-extern void
-xen_vdi_set_free(xen_vdi_set *set);
-
-
-typedef struct xen_vdi_record
-{
- xen_vdi handle;
- char *uuid;
- char *name_label;
- char *name_description;
- struct xen_sr_record_opt *sr;
- struct xen_vbd_record_opt_set *vbds;
- struct xen_crashdump_record_opt_set *crash_dumps;
- int64_t virtual_size;
- int64_t physical_utilisation;
- enum xen_vdi_type type;
- bool sharable;
- bool read_only;
- xen_string_string_map *other_config;
-} xen_vdi_record;
-
-/**
- * Allocate a xen_vdi_record.
- */
-extern xen_vdi_record *
-xen_vdi_record_alloc(void);
-
-/**
- * Free the given xen_vdi_record, and all referenced values. The given
- * record must have been allocated by this library.
- */
-extern void
-xen_vdi_record_free(xen_vdi_record *record);
-
-
-typedef struct xen_vdi_record_opt
-{
- bool is_record;
- union
- {
- xen_vdi handle;
- xen_vdi_record *record;
- } u;
-} xen_vdi_record_opt;
-
-/**
- * Allocate a xen_vdi_record_opt.
- */
-extern xen_vdi_record_opt *
-xen_vdi_record_opt_alloc(void);
-
-/**
- * Free the given xen_vdi_record_opt, and all referenced values. The
- * given record_opt must have been allocated by this library.
- */
-extern void
-xen_vdi_record_opt_free(xen_vdi_record_opt *record_opt);
-
-
-typedef struct xen_vdi_record_set
-{
- size_t size;
- xen_vdi_record *contents[];
-} xen_vdi_record_set;
-
-/**
- * Allocate a xen_vdi_record_set of the given size.
- */
-extern xen_vdi_record_set *
-xen_vdi_record_set_alloc(size_t size);
-
-/**
- * Free the given xen_vdi_record_set, and all referenced values. The
- * given set must have been allocated by this library.
- */
-extern void
-xen_vdi_record_set_free(xen_vdi_record_set *set);
-
-
-
-typedef struct xen_vdi_record_opt_set
-{
- size_t size;
- xen_vdi_record_opt *contents[];
-} xen_vdi_record_opt_set;
-
-/**
- * Allocate a xen_vdi_record_opt_set of the given size.
- */
-extern xen_vdi_record_opt_set *
-xen_vdi_record_opt_set_alloc(size_t size);
-
-/**
- * Free the given xen_vdi_record_opt_set, and all referenced values.
- * The given set must have been allocated by this library.
- */
-extern void
-xen_vdi_record_opt_set_free(xen_vdi_record_opt_set *set);
-
-
-/**
- * Get a record containing the current state of the given VDI.
- */
-extern bool
-xen_vdi_get_record(xen_session *session, xen_vdi_record **result, xen_vdi vdi);
-
-
-/**
- * Get a reference to the VDI instance with the specified UUID.
- */
-extern bool
-xen_vdi_get_by_uuid(xen_session *session, xen_vdi *result, char *uuid);
-
-
-/**
- * Create a new VDI instance, and return its handle.
- */
-extern bool
-xen_vdi_create(xen_session *session, xen_vdi *result, xen_vdi_record *record);
-
-
-/**
- * Destroy the specified VDI instance.
- */
-extern bool
-xen_vdi_destroy(xen_session *session, xen_vdi vdi);
-
-
-/**
- * Get all the VDI instances with the given label.
- */
-extern bool
-xen_vdi_get_by_name_label(xen_session *session, struct xen_vdi_set **result, char *label);
-
-
-/**
- * Get the uuid field of the given VDI.
- */
-extern bool
-xen_vdi_get_uuid(xen_session *session, char **result, xen_vdi vdi);
-
-
-/**
- * Get the name/label field of the given VDI.
- */
-extern bool
-xen_vdi_get_name_label(xen_session *session, char **result, xen_vdi vdi);
-
-
-/**
- * Get the name/description field of the given VDI.
- */
-extern bool
-xen_vdi_get_name_description(xen_session *session, char **result, xen_vdi vdi);
-
-
-/**
- * Get the SR field of the given VDI.
- */
-extern bool
-xen_vdi_get_sr(xen_session *session, xen_sr *result, xen_vdi vdi);
-
-
-/**
- * Get the VBDs field of the given VDI.
- */
-extern bool
-xen_vdi_get_vbds(xen_session *session, struct xen_vbd_set **result, xen_vdi vdi);
-
-
-/**
- * Get the crash_dumps field of the given VDI.
- */
-extern bool
-xen_vdi_get_crash_dumps(xen_session *session, struct xen_crashdump_set **result, xen_vdi vdi);
-
-
-/**
- * Get the virtual_size field of the given VDI.
- */
-extern bool
-xen_vdi_get_virtual_size(xen_session *session, int64_t *result, xen_vdi vdi);
-
-
-/**
- * Get the physical_utilisation field of the given VDI.
- */
-extern bool
-xen_vdi_get_physical_utilisation(xen_session *session, int64_t *result, xen_vdi vdi);
-
-
-/**
- * Get the type field of the given VDI.
- */
-extern bool
-xen_vdi_get_type(xen_session *session, enum xen_vdi_type *result, xen_vdi vdi);
-
-
-/**
- * Get the sharable field of the given VDI.
- */
-extern bool
-xen_vdi_get_sharable(xen_session *session, bool *result, xen_vdi vdi);
-
-
-/**
- * Get the read_only field of the given VDI.
- */
-extern bool
-xen_vdi_get_read_only(xen_session *session, bool *result, xen_vdi vdi);
-
-
-/**
- * Get the other_config field of the given VDI.
- */
-extern bool
-xen_vdi_get_other_config(xen_session *session, xen_string_string_map **result, xen_vdi vdi);
-
-
-/**
- * Set the name/label field of the given VDI.
- */
-extern bool
-xen_vdi_set_name_label(xen_session *session, xen_vdi vdi, char *label);
-
-
-/**
- * Set the name/description field of the given VDI.
- */
-extern bool
-xen_vdi_set_name_description(xen_session *session, xen_vdi vdi, char *description);
-
-
-/**
- * Set the virtual_size field of the given VDI.
- */
-extern bool
-xen_vdi_set_virtual_size(xen_session *session, xen_vdi vdi, int64_t virtual_size);
-
-
-/**
- * Set the sharable field of the given VDI.
- */
-extern bool
-xen_vdi_set_sharable(xen_session *session, xen_vdi vdi, bool sharable);
-
-
-/**
- * Set the read_only field of the given VDI.
- */
-extern bool
-xen_vdi_set_read_only(xen_session *session, xen_vdi vdi, bool read_only);
-
-
-/**
- * Set the other_config field of the given VDI.
- */
-extern bool
-xen_vdi_set_other_config(xen_session *session, xen_vdi vdi, xen_string_string_map *other_config);
-
-
-/**
- * Add the given key-value pair to the other_config field of the given
- * VDI.
- */
-extern bool
-xen_vdi_add_to_other_config(xen_session *session, xen_vdi vdi, char *key, char *value);
-
-
-/**
- * Remove the given key and its corresponding value from the
- * other_config field of the given VDI. If the key is not in that Map, then
- * do nothing.
- */
-extern bool
-xen_vdi_remove_from_other_config(xen_session *session, xen_vdi vdi, char *key);
-
-
-/**
- * Return a list of all the VDIs known to the system.
- */
-extern bool
-xen_vdi_get_all(xen_session *session, struct xen_vdi_set **result);
-
-
-/**
- * Set the security label of a VDI.
- */
-extern bool
-xen_vdi_set_security_label(xen_session *session, int64_t *result, xen_vdi vdi,
- char *label, char *oldlabel);
-
-/**
- * Get the security label of a VDI.
- */
-extern bool
-xen_vdi_get_security_label(xen_session *session, char **result, xen_vdi vdi);
-
-#endif
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_VDI_TYPE_H
-#define XEN_VDI_TYPE_H
-
-
-#include <xen/api/xen_common.h>
-
-
-enum xen_vdi_type
-{
- /**
- * a disk that may be replaced on upgrade
- */
- XEN_VDI_TYPE_SYSTEM,
-
- /**
- * a disk that is always preserved on upgrade
- */
- XEN_VDI_TYPE_USER,
-
- /**
- * a disk that may be reformatted on upgrade
- */
- XEN_VDI_TYPE_EPHEMERAL,
-
- /**
- * a disk that stores a suspend image
- */
- XEN_VDI_TYPE_SUSPEND,
-
- /**
- * a disk that stores VM crashdump information
- */
- XEN_VDI_TYPE_CRASHDUMP
-};
-
-
-typedef struct xen_vdi_type_set
-{
- size_t size;
- enum xen_vdi_type contents[];
-} xen_vdi_type_set;
-
-/**
- * Allocate a xen_vdi_type_set of the given size.
- */
-extern xen_vdi_type_set *
-xen_vdi_type_set_alloc(size_t size);
-
-/**
- * Free the given xen_vdi_type_set. The given set must have been
- * allocated by this library.
- */
-extern void
-xen_vdi_type_set_free(xen_vdi_type_set *set);
-
-
-/**
- * Return the name corresponding to the given code. This string must
- * not be modified or freed.
- */
-extern const char *
-xen_vdi_type_to_string(enum xen_vdi_type val);
-
-
-/**
- * Return the correct code for the given string, or set the session
- * object to failure and return an undefined value if the given string does
- * not match a known code.
- */
-extern enum xen_vdi_type
-xen_vdi_type_from_string(xen_session *session, const char *str);
-
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_VIF_H
-#define XEN_VIF_H
-
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_network_decl.h>
-#include <xen/api/xen_string_set.h>
-#include <xen/api/xen_string_string_map.h>
-#include <xen/api/xen_vif_decl.h>
-#include <xen/api/xen_vif_metrics_decl.h>
-#include <xen/api/xen_vm_decl.h>
-
-
-/*
- * The VIF class.
- *
- * A virtual network interface.
- */
-
-
-/**
- * Free the given xen_vif. The given handle must have been allocated
- * by this library.
- */
-extern void
-xen_vif_free(xen_vif vif);
-
-
-typedef struct xen_vif_set
-{
- size_t size;
- xen_vif *contents[];
-} xen_vif_set;
-
-/**
- * Allocate a xen_vif_set of the given size.
- */
-extern xen_vif_set *
-xen_vif_set_alloc(size_t size);
-
-/**
- * Free the given xen_vif_set. The given set must have been allocated
- * by this library.
- */
-extern void
-xen_vif_set_free(xen_vif_set *set);
-
-
-typedef struct xen_vif_record
-{
- xen_vif handle;
- char *uuid;
- char *device;
- struct xen_network_record_opt *network;
- struct xen_vm_record_opt *vm;
- char *mac;
- int64_t mtu;
- bool currently_attached;
- int64_t status_code;
- char *status_detail;
- xen_string_string_map *runtime_properties;
- char *qos_algorithm_type;
- xen_string_string_map *qos_algorithm_params;
- struct xen_string_set *qos_supported_algorithms;
- struct xen_vif_metrics_record_opt *metrics;
-} xen_vif_record;
-
-/**
- * Allocate a xen_vif_record.
- */
-extern xen_vif_record *
-xen_vif_record_alloc(void);
-
-/**
- * Free the given xen_vif_record, and all referenced values. The given
- * record must have been allocated by this library.
- */
-extern void
-xen_vif_record_free(xen_vif_record *record);
-
-
-typedef struct xen_vif_record_opt
-{
- bool is_record;
- union
- {
- xen_vif handle;
- xen_vif_record *record;
- } u;
-} xen_vif_record_opt;
-
-/**
- * Allocate a xen_vif_record_opt.
- */
-extern xen_vif_record_opt *
-xen_vif_record_opt_alloc(void);
-
-/**
- * Free the given xen_vif_record_opt, and all referenced values. The
- * given record_opt must have been allocated by this library.
- */
-extern void
-xen_vif_record_opt_free(xen_vif_record_opt *record_opt);
-
-
-typedef struct xen_vif_record_set
-{
- size_t size;
- xen_vif_record *contents[];
-} xen_vif_record_set;
-
-/**
- * Allocate a xen_vif_record_set of the given size.
- */
-extern xen_vif_record_set *
-xen_vif_record_set_alloc(size_t size);
-
-/**
- * Free the given xen_vif_record_set, and all referenced values. The
- * given set must have been allocated by this library.
- */
-extern void
-xen_vif_record_set_free(xen_vif_record_set *set);
-
-
-
-typedef struct xen_vif_record_opt_set
-{
- size_t size;
- xen_vif_record_opt *contents[];
-} xen_vif_record_opt_set;
-
-/**
- * Allocate a xen_vif_record_opt_set of the given size.
- */
-extern xen_vif_record_opt_set *
-xen_vif_record_opt_set_alloc(size_t size);
-
-/**
- * Free the given xen_vif_record_opt_set, and all referenced values.
- * The given set must have been allocated by this library.
- */
-extern void
-xen_vif_record_opt_set_free(xen_vif_record_opt_set *set);
-
-
-/**
- * Get a record containing the current state of the given VIF.
- */
-extern bool
-xen_vif_get_record(xen_session *session, xen_vif_record **result, xen_vif vif);
-
-
-/**
- * Get a reference to the VIF instance with the specified UUID.
- */
-extern bool
-xen_vif_get_by_uuid(xen_session *session, xen_vif *result, char *uuid);
-
-
-/**
- * Create a new VIF instance, and return its handle.
- */
-extern bool
-xen_vif_create(xen_session *session, xen_vif *result, xen_vif_record *record);
-
-
-/**
- * Destroy the specified VIF instance.
- */
-extern bool
-xen_vif_destroy(xen_session *session, xen_vif vif);
-
-
-/**
- * Get the uuid field of the given VIF.
- */
-extern bool
-xen_vif_get_uuid(xen_session *session, char **result, xen_vif vif);
-
-
-/**
- * Get the device field of the given VIF.
- */
-extern bool
-xen_vif_get_device(xen_session *session, char **result, xen_vif vif);
-
-
-/**
- * Get the network field of the given VIF.
- */
-extern bool
-xen_vif_get_network(xen_session *session, xen_network *result, xen_vif vif);
-
-
-/**
- * Get the VM field of the given VIF.
- */
-extern bool
-xen_vif_get_vm(xen_session *session, xen_vm *result, xen_vif vif);
-
-
-/**
- * Get the MAC field of the given VIF.
- */
-extern bool
-xen_vif_get_mac(xen_session *session, char **result, xen_vif vif);
-
-
-/**
- * Get the MTU field of the given VIF.
- */
-extern bool
-xen_vif_get_mtu(xen_session *session, int64_t *result, xen_vif vif);
-
-
-/**
- * Get the currently_attached field of the given VIF.
- */
-extern bool
-xen_vif_get_currently_attached(xen_session *session, bool *result, xen_vif vif);
-
-
-/**
- * Get the status_code field of the given VIF.
- */
-extern bool
-xen_vif_get_status_code(xen_session *session, int64_t *result, xen_vif vif);
-
-
-/**
- * Get the status_detail field of the given VIF.
- */
-extern bool
-xen_vif_get_status_detail(xen_session *session, char **result, xen_vif vif);
-
-
-/**
- * Get the runtime_properties field of the given VIF.
- */
-extern bool
-xen_vif_get_runtime_properties(xen_session *session, xen_string_string_map **result, xen_vif vif);
-
-
-/**
- * Get the qos/algorithm_type field of the given VIF.
- */
-extern bool
-xen_vif_get_qos_algorithm_type(xen_session *session, char **result, xen_vif vif);
-
-
-/**
- * Get the qos/algorithm_params field of the given VIF.
- */
-extern bool
-xen_vif_get_qos_algorithm_params(xen_session *session, xen_string_string_map **result, xen_vif vif);
-
-
-/**
- * Get the qos/supported_algorithms field of the given VIF.
- */
-extern bool
-xen_vif_get_qos_supported_algorithms(xen_session *session, struct xen_string_set **result, xen_vif vif);
-
-
-/**
- * Get the metrics field of the given VIF.
- */
-extern bool
-xen_vif_get_metrics(xen_session *session, xen_vif_metrics *result, xen_vif vif);
-
-
-/**
- * Set the device field of the given VIF.
- */
-extern bool
-xen_vif_set_device(xen_session *session, xen_vif vif, char *device);
-
-
-/**
- * Set the MAC field of the given VIF.
- */
-extern bool
-xen_vif_set_mac(xen_session *session, xen_vif vif, char *mac);
-
-
-/**
- * Set the MTU field of the given VIF.
- */
-extern bool
-xen_vif_set_mtu(xen_session *session, xen_vif vif, int64_t mtu);
-
-
-/**
- * Set the qos/algorithm_type field of the given VIF.
- */
-extern bool
-xen_vif_set_qos_algorithm_type(xen_session *session, xen_vif vif, char *algorithm_type);
-
-
-/**
- * Set the qos/algorithm_params field of the given VIF.
- */
-extern bool
-xen_vif_set_qos_algorithm_params(xen_session *session, xen_vif vif, xen_string_string_map *algorithm_params);
-
-
-/**
- * Add the given key-value pair to the qos/algorithm_params field of
- * the given VIF.
- */
-extern bool
-xen_vif_add_to_qos_algorithm_params(xen_session *session, xen_vif vif, char *key, char *value);
-
-
-/**
- * Remove the given key and its corresponding value from the
- * qos/algorithm_params field of the given VIF. If the key is not in that
- * Map, then do nothing.
- */
-extern bool
-xen_vif_remove_from_qos_algorithm_params(xen_session *session, xen_vif vif, char *key);
-
-
-/**
- * Hotplug the specified VIF, dynamically attaching it to the running
- * VM.
- */
-extern bool
-xen_vif_plug(xen_session *session, xen_vif self);
-
-
-/**
- * Hot-unplug the specified VIF, dynamically unattaching it from the
- * running VM.
- */
-extern bool
-xen_vif_unplug(xen_session *session, xen_vif self);
-
-
-/**
- * Return a list of all the VIFs known to the system.
- */
-extern bool
-xen_vif_get_all(xen_session *session, struct xen_vif_set **result);
-
-
-/**
- * Set the security label of a VIF.
- */
-extern bool
-xen_vif_set_security_label(xen_session *session, int64_t *result, xen_vif vif,
- char *label, char *oldlabel);
-
-
-/**
- * Get the security label of a VIF.
- */
-extern bool
-xen_vif_get_security_label(xen_session *session, char **result, xen_vif vif);
-
-#endif
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_VIF_METRICS_H
-#define XEN_VIF_METRICS_H
-
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_vif_metrics_decl.h>
-
-
-/*
- * The VIF_metrics class.
- *
- * The metrics associated with a virtual network device.
- */
-
-
-/**
- * Free the given xen_vif_metrics. The given handle must have been
- * allocated by this library.
- */
-extern void
-xen_vif_metrics_free(xen_vif_metrics vif_metrics);
-
-
-typedef struct xen_vif_metrics_set
-{
- size_t size;
- xen_vif_metrics *contents[];
-} xen_vif_metrics_set;
-
-/**
- * Allocate a xen_vif_metrics_set of the given size.
- */
-extern xen_vif_metrics_set *
-xen_vif_metrics_set_alloc(size_t size);
-
-/**
- * Free the given xen_vif_metrics_set. The given set must have been
- * allocated by this library.
- */
-extern void
-xen_vif_metrics_set_free(xen_vif_metrics_set *set);
-
-
-typedef struct xen_vif_metrics_record
-{
- xen_vif_metrics handle;
- char *uuid;
- double io_read_kbs;
- double io_write_kbs;
- time_t last_updated;
-} xen_vif_metrics_record;
-
-/**
- * Allocate a xen_vif_metrics_record.
- */
-extern xen_vif_metrics_record *
-xen_vif_metrics_record_alloc(void);
-
-/**
- * Free the given xen_vif_metrics_record, and all referenced values.
- * The given record must have been allocated by this library.
- */
-extern void
-xen_vif_metrics_record_free(xen_vif_metrics_record *record);
-
-
-typedef struct xen_vif_metrics_record_opt
-{
- bool is_record;
- union
- {
- xen_vif_metrics handle;
- xen_vif_metrics_record *record;
- } u;
-} xen_vif_metrics_record_opt;
-
-/**
- * Allocate a xen_vif_metrics_record_opt.
- */
-extern xen_vif_metrics_record_opt *
-xen_vif_metrics_record_opt_alloc(void);
-
-/**
- * Free the given xen_vif_metrics_record_opt, and all referenced
- * values. The given record_opt must have been allocated by this library.
- */
-extern void
-xen_vif_metrics_record_opt_free(xen_vif_metrics_record_opt *record_opt);
-
-
-typedef struct xen_vif_metrics_record_set
-{
- size_t size;
- xen_vif_metrics_record *contents[];
-} xen_vif_metrics_record_set;
-
-/**
- * Allocate a xen_vif_metrics_record_set of the given size.
- */
-extern xen_vif_metrics_record_set *
-xen_vif_metrics_record_set_alloc(size_t size);
-
-/**
- * Free the given xen_vif_metrics_record_set, and all referenced
- * values. The given set must have been allocated by this library.
- */
-extern void
-xen_vif_metrics_record_set_free(xen_vif_metrics_record_set *set);
-
-
-
-typedef struct xen_vif_metrics_record_opt_set
-{
- size_t size;
- xen_vif_metrics_record_opt *contents[];
-} xen_vif_metrics_record_opt_set;
-
-/**
- * Allocate a xen_vif_metrics_record_opt_set of the given size.
- */
-extern xen_vif_metrics_record_opt_set *
-xen_vif_metrics_record_opt_set_alloc(size_t size);
-
-/**
- * Free the given xen_vif_metrics_record_opt_set, and all referenced
- * values. The given set must have been allocated by this library.
- */
-extern void
-xen_vif_metrics_record_opt_set_free(xen_vif_metrics_record_opt_set *set);
-
-
-/**
- * Get a record containing the current state of the given VIF_metrics.
- */
-extern bool
-xen_vif_metrics_get_record(xen_session *session, xen_vif_metrics_record **result, xen_vif_metrics vif_metrics);
-
-
-/**
- * Get a reference to the VIF_metrics instance with the specified UUID.
- */
-extern bool
-xen_vif_metrics_get_by_uuid(xen_session *session, xen_vif_metrics *result, char *uuid);
-
-
-/**
- * Get the uuid field of the given VIF_metrics.
- */
-extern bool
-xen_vif_metrics_get_uuid(xen_session *session, char **result, xen_vif_metrics vif_metrics);
-
-
-/**
- * Get the io/read_kbs field of the given VIF_metrics.
- */
-extern bool
-xen_vif_metrics_get_io_read_kbs(xen_session *session, double *result, xen_vif_metrics vif_metrics);
-
-
-/**
- * Get the io/write_kbs field of the given VIF_metrics.
- */
-extern bool
-xen_vif_metrics_get_io_write_kbs(xen_session *session, double *result, xen_vif_metrics vif_metrics);
-
-
-/**
- * Get the last_updated field of the given VIF_metrics.
- */
-extern bool
-xen_vif_metrics_get_last_updated(xen_session *session, time_t *result, xen_vif_metrics vif_metrics);
-
-
-/**
- * Return a list of all the VIF_metrics instances known to the system.
- */
-extern bool
-xen_vif_metrics_get_all(xen_session *session, struct xen_vif_metrics_set **result);
-
-
-#endif
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_VM_H
-#define XEN_VM_H
-
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_console_decl.h>
-#include <xen/api/xen_crashdump_decl.h>
-#include <xen/api/xen_host_decl.h>
-#include <xen/api/xen_on_crash_behaviour.h>
-#include <xen/api/xen_on_normal_exit.h>
-#include <xen/api/xen_string_string_map.h>
-#include <xen/api/xen_vbd_decl.h>
-#include <xen/api/xen_vdi_decl.h>
-#include <xen/api/xen_vif_decl.h>
-#include <xen/api/xen_vm_decl.h>
-#include <xen/api/xen_vm_guest_metrics_decl.h>
-#include <xen/api/xen_vm_metrics_decl.h>
-#include <xen/api/xen_vm_power_state.h>
-#include <xen/api/xen_cpu_pool_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;
- 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;
- char *security_label;
- char *pool_name;
- struct xen_cpu_pool_record_opt_set *cpu_pool;
-} 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 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);
-
-
-/**
- * Set the security label of a domain.
- */
-extern bool
-xen_vm_set_security_label(xen_session *session, int64_t *result, xen_vm vm,
- char *label, char *oldlabel);
-
-/**
- * Get the security label of a domain.
- */
-extern bool
-xen_vm_get_security_label(xen_session *session, char **result, xen_vm vm);
-
-
-/**
- * Get the cpu_pool ref field of a domain.
- */
-extern bool
-xen_vm_get_cpu_pool(xen_session *session, struct xen_cpu_pool_set **result, xen_vm vm);
-
-
-/**
- * Get the pool_name field of a domain.
- */
-extern bool
-xen_vm_get_pool_name(xen_session *session, char **result, xen_vm vm);
-
-
-/**
- * Set the pool_name field of a domain.
- */
-extern bool
-xen_vm_set_pool_name(xen_session *session, xen_vm vm, char *pool_name);
-
-
-/**
- * Migrate the VM to another cpu_pool (on the same host). This can only be
- * called when the specified VM is in the Running state.
- */
-extern bool
-xen_vm_cpu_pool_migrate(xen_session *session, xen_vm vm, xen_cpu_pool cpu_pool);
-
-#endif
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_VM_GUEST_METRICS_H
-#define XEN_VM_GUEST_METRICS_H
-
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_string_string_map.h>
-#include <xen/api/xen_vm_guest_metrics_decl.h>
-
-
-/*
- * The VM_guest_metrics class.
- *
- * The metrics reported by the guest (as opposed to inferred from outside).
- */
-
-
-/**
- * Free the given xen_vm_guest_metrics. The given handle must have
- * been allocated by this library.
- */
-extern void
-xen_vm_guest_metrics_free(xen_vm_guest_metrics vm_guest_metrics);
-
-
-typedef struct xen_vm_guest_metrics_set
-{
- size_t size;
- xen_vm_guest_metrics *contents[];
-} xen_vm_guest_metrics_set;
-
-/**
- * Allocate a xen_vm_guest_metrics_set of the given size.
- */
-extern xen_vm_guest_metrics_set *
-xen_vm_guest_metrics_set_alloc(size_t size);
-
-/**
- * Free the given xen_vm_guest_metrics_set. The given set must have
- * been allocated by this library.
- */
-extern void
-xen_vm_guest_metrics_set_free(xen_vm_guest_metrics_set *set);
-
-
-typedef struct xen_vm_guest_metrics_record
-{
- xen_vm_guest_metrics handle;
- char *uuid;
- xen_string_string_map *os_version;
- xen_string_string_map *pv_drivers_version;
- xen_string_string_map *memory;
- xen_string_string_map *disks;
- xen_string_string_map *networks;
- xen_string_string_map *other;
- time_t last_updated;
-} xen_vm_guest_metrics_record;
-
-/**
- * Allocate a xen_vm_guest_metrics_record.
- */
-extern xen_vm_guest_metrics_record *
-xen_vm_guest_metrics_record_alloc(void);
-
-/**
- * Free the given xen_vm_guest_metrics_record, and all referenced
- * values. The given record must have been allocated by this library.
- */
-extern void
-xen_vm_guest_metrics_record_free(xen_vm_guest_metrics_record *record);
-
-
-typedef struct xen_vm_guest_metrics_record_opt
-{
- bool is_record;
- union
- {
- xen_vm_guest_metrics handle;
- xen_vm_guest_metrics_record *record;
- } u;
-} xen_vm_guest_metrics_record_opt;
-
-/**
- * Allocate a xen_vm_guest_metrics_record_opt.
- */
-extern xen_vm_guest_metrics_record_opt *
-xen_vm_guest_metrics_record_opt_alloc(void);
-
-/**
- * Free the given xen_vm_guest_metrics_record_opt, and all referenced
- * values. The given record_opt must have been allocated by this library.
- */
-extern void
-xen_vm_guest_metrics_record_opt_free(xen_vm_guest_metrics_record_opt *record_opt);
-
-
-typedef struct xen_vm_guest_metrics_record_set
-{
- size_t size;
- xen_vm_guest_metrics_record *contents[];
-} xen_vm_guest_metrics_record_set;
-
-/**
- * Allocate a xen_vm_guest_metrics_record_set of the given size.
- */
-extern xen_vm_guest_metrics_record_set *
-xen_vm_guest_metrics_record_set_alloc(size_t size);
-
-/**
- * Free the given xen_vm_guest_metrics_record_set, and all referenced
- * values. The given set must have been allocated by this library.
- */
-extern void
-xen_vm_guest_metrics_record_set_free(xen_vm_guest_metrics_record_set *set);
-
-
-
-typedef struct xen_vm_guest_metrics_record_opt_set
-{
- size_t size;
- xen_vm_guest_metrics_record_opt *contents[];
-} xen_vm_guest_metrics_record_opt_set;
-
-/**
- * Allocate a xen_vm_guest_metrics_record_opt_set of the given size.
- */
-extern xen_vm_guest_metrics_record_opt_set *
-xen_vm_guest_metrics_record_opt_set_alloc(size_t size);
-
-/**
- * Free the given xen_vm_guest_metrics_record_opt_set, and all
- * referenced values. The given set must have been allocated by this library.
- */
-extern void
-xen_vm_guest_metrics_record_opt_set_free(xen_vm_guest_metrics_record_opt_set *set);
-
-
-/**
- * Get a record containing the current state of the given
- * VM_guest_metrics.
- */
-extern bool
-xen_vm_guest_metrics_get_record(xen_session *session, xen_vm_guest_metrics_record **result, xen_vm_guest_metrics vm_guest_metrics);
-
-
-/**
- * Get a reference to the VM_guest_metrics instance with the specified
- * UUID.
- */
-extern bool
-xen_vm_guest_metrics_get_by_uuid(xen_session *session, xen_vm_guest_metrics *result, char *uuid);
-
-
-/**
- * Get the uuid field of the given VM_guest_metrics.
- */
-extern bool
-xen_vm_guest_metrics_get_uuid(xen_session *session, char **result, xen_vm_guest_metrics vm_guest_metrics);
-
-
-/**
- * Get the os_version field of the given VM_guest_metrics.
- */
-extern bool
-xen_vm_guest_metrics_get_os_version(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics);
-
-
-/**
- * Get the PV_drivers_version field of the given VM_guest_metrics.
- */
-extern bool
-xen_vm_guest_metrics_get_pv_drivers_version(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics);
-
-
-/**
- * Get the memory field of the given VM_guest_metrics.
- */
-extern bool
-xen_vm_guest_metrics_get_memory(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics);
-
-
-/**
- * Get the disks field of the given VM_guest_metrics.
- */
-extern bool
-xen_vm_guest_metrics_get_disks(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics);
-
-
-/**
- * Get the networks field of the given VM_guest_metrics.
- */
-extern bool
-xen_vm_guest_metrics_get_networks(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics);
-
-
-/**
- * Get the other field of the given VM_guest_metrics.
- */
-extern bool
-xen_vm_guest_metrics_get_other(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics);
-
-
-/**
- * Get the last_updated field of the given VM_guest_metrics.
- */
-extern bool
-xen_vm_guest_metrics_get_last_updated(xen_session *session, time_t *result, xen_vm_guest_metrics vm_guest_metrics);
-
-
-/**
- * Return a list of all the VM_guest_metrics instances known to the
- * system.
- */
-extern bool
-xen_vm_guest_metrics_get_all(xen_session *session, struct xen_vm_guest_metrics_set **result);
-
-
-#endif
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_VM_METRICS_H
-#define XEN_VM_METRICS_H
-
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_int_float_map.h>
-#include <xen/api/xen_int_int_map.h>
-#include <xen/api/xen_int_string_set_map.h>
-#include <xen/api/xen_string_set.h>
-#include <xen/api/xen_string_string_map.h>
-#include <xen/api/xen_vm_metrics_decl.h>
-
-
-/*
- * The VM_metrics class.
- *
- * The metrics associated with a VM.
- */
-
-
-/**
- * Free the given xen_vm_metrics. The given handle must have been
- * allocated by this library.
- */
-extern void
-xen_vm_metrics_free(xen_vm_metrics vm_metrics);
-
-
-typedef struct xen_vm_metrics_set
-{
- size_t size;
- xen_vm_metrics *contents[];
-} xen_vm_metrics_set;
-
-/**
- * Allocate a xen_vm_metrics_set of the given size.
- */
-extern xen_vm_metrics_set *
-xen_vm_metrics_set_alloc(size_t size);
-
-/**
- * Free the given xen_vm_metrics_set. The given set must have been
- * allocated by this library.
- */
-extern void
-xen_vm_metrics_set_free(xen_vm_metrics_set *set);
-
-
-typedef struct xen_vm_metrics_record
-{
- xen_vm_metrics handle;
- char *uuid;
- int64_t memory_actual;
- int64_t vcpus_number;
- xen_int_float_map *vcpus_utilisation;
- xen_int_int_map *vcpus_cpu;
- xen_string_string_map *vcpus_params;
- xen_int_string_set_map *vcpus_flags;
- struct xen_string_set *state;
- time_t start_time;
- time_t last_updated;
-} xen_vm_metrics_record;
-
-/**
- * Allocate a xen_vm_metrics_record.
- */
-extern xen_vm_metrics_record *
-xen_vm_metrics_record_alloc(void);
-
-/**
- * Free the given xen_vm_metrics_record, and all referenced values.
- * The given record must have been allocated by this library.
- */
-extern void
-xen_vm_metrics_record_free(xen_vm_metrics_record *record);
-
-
-typedef struct xen_vm_metrics_record_opt
-{
- bool is_record;
- union
- {
- xen_vm_metrics handle;
- xen_vm_metrics_record *record;
- } u;
-} xen_vm_metrics_record_opt;
-
-/**
- * Allocate a xen_vm_metrics_record_opt.
- */
-extern xen_vm_metrics_record_opt *
-xen_vm_metrics_record_opt_alloc(void);
-
-/**
- * Free the given xen_vm_metrics_record_opt, and all referenced values.
- * The given record_opt must have been allocated by this library.
- */
-extern void
-xen_vm_metrics_record_opt_free(xen_vm_metrics_record_opt *record_opt);
-
-
-typedef struct xen_vm_metrics_record_set
-{
- size_t size;
- xen_vm_metrics_record *contents[];
-} xen_vm_metrics_record_set;
-
-/**
- * Allocate a xen_vm_metrics_record_set of the given size.
- */
-extern xen_vm_metrics_record_set *
-xen_vm_metrics_record_set_alloc(size_t size);
-
-/**
- * Free the given xen_vm_metrics_record_set, and all referenced values.
- * The given set must have been allocated by this library.
- */
-extern void
-xen_vm_metrics_record_set_free(xen_vm_metrics_record_set *set);
-
-
-
-typedef struct xen_vm_metrics_record_opt_set
-{
- size_t size;
- xen_vm_metrics_record_opt *contents[];
-} xen_vm_metrics_record_opt_set;
-
-/**
- * Allocate a xen_vm_metrics_record_opt_set of the given size.
- */
-extern xen_vm_metrics_record_opt_set *
-xen_vm_metrics_record_opt_set_alloc(size_t size);
-
-/**
- * Free the given xen_vm_metrics_record_opt_set, and all referenced
- * values. The given set must have been allocated by this library.
- */
-extern void
-xen_vm_metrics_record_opt_set_free(xen_vm_metrics_record_opt_set *set);
-
-
-/**
- * Get a record containing the current state of the given VM_metrics.
- */
-extern bool
-xen_vm_metrics_get_record(xen_session *session, xen_vm_metrics_record **result, xen_vm_metrics vm_metrics);
-
-
-/**
- * Get a reference to the VM_metrics instance with the specified UUID.
- */
-extern bool
-xen_vm_metrics_get_by_uuid(xen_session *session, xen_vm_metrics *result, char *uuid);
-
-
-/**
- * Get the uuid field of the given VM_metrics.
- */
-extern bool
-xen_vm_metrics_get_uuid(xen_session *session, char **result, xen_vm_metrics vm_metrics);
-
-
-/**
- * Get the memory/actual field of the given VM_metrics.
- */
-extern bool
-xen_vm_metrics_get_memory_actual(xen_session *session, int64_t *result, xen_vm_metrics vm_metrics);
-
-
-/**
- * Get the VCPUs/number field of the given VM_metrics.
- */
-extern bool
-xen_vm_metrics_get_vcpus_number(xen_session *session, int64_t *result, xen_vm_metrics vm_metrics);
-
-
-/**
- * Get the VCPUs/utilisation field of the given VM_metrics.
- */
-extern bool
-xen_vm_metrics_get_vcpus_utilisation(xen_session *session, xen_int_float_map **result, xen_vm_metrics vm_metrics);
-
-
-/**
- * Get the VCPUs/CPU field of the given VM_metrics.
- */
-extern bool
-xen_vm_metrics_get_vcpus_cpu(xen_session *session, xen_int_int_map **result, xen_vm_metrics vm_metrics);
-
-
-/**
- * Get the VCPUs/params field of the given VM_metrics.
- */
-extern bool
-xen_vm_metrics_get_vcpus_params(xen_session *session, xen_string_string_map **result, xen_vm_metrics vm_metrics);
-
-
-/**
- * Get the VCPUs/flags field of the given VM_metrics.
- */
-extern bool
-xen_vm_metrics_get_vcpus_flags(xen_session *session, xen_int_string_set_map **result, xen_vm_metrics vm_metrics);
-
-
-/**
- * Get the state field of the given VM_metrics.
- */
-extern bool
-xen_vm_metrics_get_state(xen_session *session, struct xen_string_set **result, xen_vm_metrics vm_metrics);
-
-
-/**
- * Get the start_time field of the given VM_metrics.
- */
-extern bool
-xen_vm_metrics_get_start_time(xen_session *session, time_t *result, xen_vm_metrics vm_metrics);
-
-
-/**
- * Get the last_updated field of the given VM_metrics.
- */
-extern bool
-xen_vm_metrics_get_last_updated(xen_session *session, time_t *result, xen_vm_metrics vm_metrics);
-
-
-/**
- * Return a list of all the VM_metrics instances known to the system.
- */
-extern bool
-xen_vm_metrics_get_all(xen_session *session, struct xen_vm_metrics_set **result);
-
-
-#endif
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * Copyright (c) 2006-2007, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_VM_POWER_STATE_H
-#define XEN_VM_POWER_STATE_H
-
-
-#include <xen/api/xen_common.h>
-
-
-enum xen_vm_power_state
-{
- /**
- * Halted
- */
- XEN_VM_POWER_STATE_HALTED,
-
- /**
- * Paused
- */
- XEN_VM_POWER_STATE_PAUSED,
-
- /**
- * Running
- */
- XEN_VM_POWER_STATE_RUNNING,
-
- /**
- * Suspended
- */
- XEN_VM_POWER_STATE_SUSPENDED,
-
- /**
- * Crashed
- */
- XEN_VM_POWER_STATE_CRASHED,
-
- /**
- * 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
+++ /dev/null
-/*
- * Copyright (c) 2007, IBM Corp.
- * Copyright (c) 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_XSPOLICY_H
-#define XEN_XSPOLICY_H
-
-#include "xen_common.h"
-#include "xen_xspolicy_decl.h"
-#include "xen_string_string_map.h"
-
-
-/*
- * The XSPolicy and associated data structures.
- *
- */
-typedef int64_t xs_type;
-typedef int64_t xs_instantiationflags;
-
-enum xs_type {
- XS_POLICY_ACM = (1 << 0),
-};
-
-enum xs_instantiationflags {
- XS_INST_NONE = 0,
- XS_INST_BOOT = (1 << 0),
- XS_INST_LOAD = (1 << 1),
-};
-
-
-/* Error codes returned by xend following XSPolicy operations */
-#define XSERR_BASE 0x1000
-
-#define XSERR_SUCCESS 0
-#define XSERR_GENERAL_FAILURE 1 + XSERR_BASE
-#define XSERR_BAD_XML 2 + XSERR_BASE
-#define XSERR_XML_PROCESSING 3 + XSERR_BASE
-#define XSERR_POLICY_INCONSISTENT 4 + XSERR_BASE
-#define XSERR_FILE_ERROR 5 + XSERR_BASE
-#define XSERR_BAD_RESOURCE_FORMAT 6 + XSERR_BASE
-#define XSERR_BAD_LABEL_FORMAT 7 + XSERR_BASE
-#define XSERR_RESOURCE_NOT_LABELED 8 + XSERR_BASE
-#define XSERR_RESOURCE_ALREADY_LABELED 9 + XSERR_BASE
-#define XSERR_WRONG_POLICY_TYPE 10 + XSERR_BASE
-#define XSERR_BOOTPOLICY_INSTALLED 11 + XSERR_BASE
-#define XSERR_NO_DEFAULT_BOOT_TITLE 12 + XSERR_BASE
-#define XSERR_POLICY_LOAD_FAILED 13 + XSERR_BASE
-#define XSERR_POLICY_LOADED 14 + XSERR_BASE
-#define XSERR_POLICY_TYPE_UNSUPPORTED 15 + XSERR_BASE
-#define XSERR_BAD_CONFLICTSET 20 + XSERR_BASE
-#define XSERR_RESOURCE_IN_USE 21 + XSERR_BASE
-#define XSERR_BAD_POLICY_NAME 22 + XSERR_BASE
-#define XSERR_RESOURCE_ACCESS 23 + XSERR_BASE
-#define XSERR_HV_OP_FAILED 24 + XSERR_BASE
-#define XSERR_BOOTPOLICY_INSTALL_ERROR 25 + XSERR_BASE
-#define XSERR_VM_NOT_AUTHORIZED 26 + XSERR_BASE
-#define XSERR_VM_IN_CONFLICT 27 + XSERR_BASE
-
-
-/**
- * Free the given xen_xspolicy. The given handle must have been allocated
- * by this library.
- */
-extern void
-xen_xspolicy_free(xen_xspolicy xspolicy);
-
-
-typedef struct xen_xspolicy_set
-{
- size_t size;
- xen_xspolicy *contents[];
-} xen_xspolicy_set;
-
-/**
- * Allocate a xen_xspolicy_set of the given size.
- */
-extern xen_xspolicy_set *
-xen_xspolicy_set_alloc(size_t size);
-
-/**
- * Free the given xen_xspolicy_set. The given set must have been allocated
- * by this library.
- */
-extern void
-xen_xspolicy_set_free(xen_xspolicy_set *set);
-
-
-typedef struct xen_xspolicy_record
-{
- xen_xspolicy handle;
- char *uuid;
- char *repr;
- xs_instantiationflags flags;
- xs_type type;
-} xen_xspolicy_record;
-
-/**
- * Allocate a xen_xspolicy_record.
- */
-extern xen_xspolicy_record *
-xen_xspolicy_record_alloc(void);
-
-/**
- * Free the given xen_xspolicy_record, and all referenced values. The
- * given record must have been allocated by this library.
- */
-extern void
-xen_xspolicy_record_free(xen_xspolicy_record *record);
-
-
-typedef struct xen_xspolicy_record_opt
-{
- bool is_record;
- union
- {
- xen_xspolicy handle;
- xen_xspolicy_record *record;
- } u;
-} xen_xspolicy_record_opt;
-
-/**
- * Allocate a xen_xspolicy_record_opt.
- */
-extern xen_xspolicy_record_opt *
-xen_xspolicy_record_opt_alloc(void);
-
-/**
- * Free the given xen_xspolicy_record_opt, and all referenced values. The
- * given record_opt must have been allocated by this library.
- */
-extern void
-xen_xspolicy_record_opt_free(xen_xspolicy_record_opt *record_opt);
-
-
-typedef struct xen_xspolicy_record_set
-{
- size_t size;
- xen_xspolicy_record *contents[];
-} xen_xspolicy_record_set;
-
-/**
- * Allocate a xen_xspolicy_record_set of the given size.
- */
-extern xen_xspolicy_record_set *
-xen_xspolicy_record_set_alloc(size_t size);
-
-/**
- * Free the given xen_xspolicy_record_set, and all referenced values. The
- * given set must have been allocated by this library.
- */
-extern void
-xen_xspolicy_record_set_free(xen_xspolicy_record_set *set);
-
-/**
- * Data structures and function declarations for an XS Policy's state
- * information.
- */
-typedef struct xen_xs_policystate
-{
- xen_xspolicy_record_opt *xs_ref;
- int64_t xserr;
- char *repr;
- xs_type type;
- xs_instantiationflags flags;
- char *version;
- char *errors;
-} xen_xs_policystate;
-
-extern void
-xen_xs_policystate_free(xen_xs_policystate *state);
-
-
-/**
- * Get the referenced policy's record.
- */
-extern bool
-xen_xspolicy_get_record(xen_session *session, xen_xspolicy_record **result,
- xen_xspolicy xspolicy);
-
-/**
- * Get the UUID field of the given policy.
- */
-extern bool
-xen_xspolicy_get_uuid(xen_session *session, char **result,
- xen_xspolicy xspolicy);
-
-/**
- * Get a policy given it's UUID
- */
-extern bool
-xen_xspolicy_get_by_uuid(xen_session *session, xen_xspolicy *result,
- char *uuid);
-
-
-/**
- * Get the types of policies supported by the system.
- */
-extern bool
-xen_xspolicy_get_xstype(xen_session *session, xs_type *result);
-
-
-/**
- * Get information about the currently managed policy.
- * (The API allows only one policy to be on the system.)
- */
-extern bool
-xen_xspolicy_get_xspolicy(xen_session *session, xen_xs_policystate **result);
-
-/**
- * Activate the referenced policy by loading it into the hypervisor.
- */
-extern bool
-xen_xspolicy_activate_xspolicy(xen_session *session, int64_t *result,
- xen_xspolicy xspolicy,
- xs_instantiationflags flags);
-
-
-/**
- * Set the system's policy to the given information comprising
- * type of policy, the xml representation of the policy, some flags
- * on whether to load the policy immediately and whether to overwrite
- * an existing policy on the system.
- */
-extern bool
-xen_xspolicy_set_xspolicy(xen_session *session, xen_xs_policystate **result,
- xs_type type, char *repr, int64_t flags,
- bool overwrite);
-
-
-
-/**
- * Attempt to reset the system's policy to the DEFAULT policy for the
- * respective policy type. This is done by updating the system and therefore
- * underlies the same restrictions of a policy update. This operation may
- * for example fail if other domains than Domain-0 are running and have
- * different labels than Domain-0.
- */
-extern bool
-xen_xspolicy_reset_xspolicy(xen_session *session, xen_xs_policystate **result,
- xs_type type);
-
-
-/**
- * Remove any policy from having the system booted with.
- */
-extern bool
-xen_xspolicy_rm_xsbootpolicy(xen_session *session);
-
-/**
- * Retrieve all labeled resources.
- */
-extern bool
-xen_xspolicy_get_labeled_resources(xen_session *session,
- xen_string_string_map **resources);
-
-/**
- * Label a resource such as for example a hard drive partition or file
- */
-extern bool
-xen_xspolicy_set_resource_label(xen_session *session,
- char *resource, char *label,
- char *oldlabel);
-
-/**
- * Get the label of a resource.
- */
-extern bool
-xen_xspolicy_get_resource_label(xen_session *session, char **label,
- char *resource);
-
-/**
- * Check whether a VM with the given VM-label could run.
- */
-extern bool
-xen_xspolicy_can_run(xen_session *session, int64_t *result,
- char *security_label);
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2007, IBM Corp.
- * Copyright (c) 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_XSPOLICY_DECL_H
-#define XEN_XSPOLICY_DECL_H
-
-typedef void *xen_xspolicy;
-
-struct xen_xspolicy_set;
-struct xen_xspolicy_record;
-struct xen_xspolicy_record_set;
-struct xen_xspolicy_record_opt;
-struct xen_xspolicy_record_opt_set;
-
-#endif
+++ /dev/null
-/*
- * 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
- */
-
-
-/*
- * Declarations of the abstract types used during demarshalling of enum
- * xen_console_protocol. Internal to this library -- do not use from outside.
- */
-
-
-#ifndef XEN_CONSOLE_PROTOCOL_INTERNAL_H
-#define XEN_CONSOLE_PROTOCOL_INTERNAL_H
-
-
-#include "xen_internal.h"
-
-
-extern const abstract_type xen_console_protocol_abstract_type_;
-extern const abstract_type xen_console_protocol_set_abstract_type_;
-
-
-#endif
+++ /dev/null
-/*
- * 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
- */
-
-
-/*
- * Declarations of the abstract types used during demarshalling of enum
- * xen_event_operation. Internal to this library -- do not use from outside.
- */
-
-
-#ifndef XEN_EVENT_OPERATION_INTERNAL_H
-#define XEN_EVENT_OPERATION_INTERNAL_H
-
-
-#include "xen_internal.h"
-
-
-extern const abstract_type xen_event_operation_abstract_type_;
-extern const abstract_type xen_event_operation_set_abstract_type_;
-
-
-#endif
+++ /dev/null
-/*
- * 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_INTERNAL_H
-#define XEN_INTERNAL_H
-
-
-#include <inttypes.h>
-#include <stdbool.h>
-#include <stdlib.h>
-
-#include <xen/api/xen_common.h>
-
-
-enum abstract_typename
-{
- VOID,
- STRING,
- INT,
- FLOAT,
- BOOL,
- DATETIME,
- SET,
- MAP,
- STRUCT,
- REF,
- ENUM,
- ENUMSET
-};
-
-
-typedef struct
-{
- size_t size;
- void *contents[];
-} arbitrary_set;
-
-
-typedef struct struct_member struct_member;
-
-
-typedef struct abstract_type
-{
- enum abstract_typename typename;
- const struct abstract_type *child;
- const char * (*enum_marshaller)(int);
- int (*enum_demarshaller)(xen_session *, const char *);
- size_t struct_size;
- size_t member_count;
- const struct_member *members;
-} abstract_type;
-
-
-struct struct_member
-{
- const char *key;
- const struct abstract_type *type;
- int offset;
-};
-
-
-extern const abstract_type abstract_type_string;
-extern const abstract_type abstract_type_int;
-extern const abstract_type abstract_type_float;
-extern const abstract_type abstract_type_bool;
-extern const abstract_type abstract_type_datetime;
-extern const abstract_type abstract_type_ref;
-
-extern const abstract_type abstract_type_string_set;
-extern const abstract_type abstract_type_ref_set;
-
-extern const abstract_type abstract_type_string_string_map;
-extern const abstract_type abstract_type_int_float_map;
-extern const abstract_type abstract_type_int_int_map;
-extern const abstract_type abstract_type_int_string_set_map;
-
-
-typedef struct abstract_value
-{
- const abstract_type *type;
- union
- {
- const char *string_val;
- int64_t int_val;
- int enum_val;
- double float_val;
- bool bool_val;
- arbitrary_set *set_val;
- void *struct_val;
- time_t datetime_val;
- } u;
-} abstract_value;
-
-
-extern void
-xen_call_(xen_session *s, const char *method_name, abstract_value params[],
- int param_count, const abstract_type *result_type, void *value);
-
-
-#define XEN_CALL_(method_name__) \
- xen_call_(session, method_name__, param_values, \
- sizeof(param_values) / sizeof(param_values[0]), \
- &result_type, result) \
-
-
-extern char *
-xen_strdup_(const char *in);
-
-
-extern int
-xen_enum_lookup_(xen_session *session, const char *str,
- const char **lookup_table, int n);
-
-#define ENUM_LOOKUP(session__, str__, lookup_table__) \
- xen_enum_lookup_(session__, str__, lookup_table__, \
- sizeof(lookup_table__) / \
- sizeof(lookup_table__[0])) \
-
-#define XEN_ALLOC(type__) \
-type__ * \
-type__ ## _alloc() \
-{ \
- return calloc(1, sizeof(type__)); \
-} \
-
-
-#define XEN_FREE(type__) \
-void \
-type__ ## _free(type__ handle) \
-{ \
- free(handle); \
-} \
-
-
-#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) \
-{ \
- type__ ## _set *result = calloc(1, sizeof(type__ ## _set) + \
- size * sizeof(type__)); \
- result->size = size; \
- return result; \
-}
-
-
-#define XEN_SET_FREE(type__) \
-void type__ ## _set_free(type__ ## _set *set) \
-{ \
- if (set == NULL) \
- return; \
- 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); \
-}
-
-
-#endif
+++ /dev/null
-/*
- * 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
- */
-
-
-/*
- * Declarations of the abstract types used during demarshalling of enum
- * xen_on_crash_behaviour. Internal to this library -- do not use from
- * outside.
- */
-
-
-#ifndef XEN_ON_CRASH_BEHAVIOUR_INTERNAL_H
-#define XEN_ON_CRASH_BEHAVIOUR_INTERNAL_H
-
-
-#include "xen_internal.h"
-
-
-extern const abstract_type xen_on_crash_behaviour_abstract_type_;
-extern const abstract_type xen_on_crash_behaviour_set_abstract_type_;
-
-
-#endif
+++ /dev/null
-/*
- * 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
- */
-
-
-/*
- * Declarations of the abstract types used during demarshalling of enum
- * xen_on_normal_exit. Internal to this library -- do not use from outside.
- */
-
-
-#ifndef XEN_ON_NORMAL_EXIT_INTERNAL_H
-#define XEN_ON_NORMAL_EXIT_INTERNAL_H
-
-
-#include "xen_internal.h"
-
-
-extern const abstract_type xen_on_normal_exit_abstract_type_;
-extern const abstract_type xen_on_normal_exit_set_abstract_type_;
-
-
-#endif
+++ /dev/null
-/*
- * 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
- */
-
-
-/*
- * Declarations of the abstract types used during demarshalling of enum
- * xen_vbd_mode. Internal to this library -- do not use from outside.
- */
-
-
-#ifndef XEN_VBD_MODE_INTERNAL_H
-#define XEN_VBD_MODE_INTERNAL_H
-
-
-#include "xen_internal.h"
-
-
-extern const abstract_type xen_vbd_mode_abstract_type_;
-extern const abstract_type xen_vbd_mode_set_abstract_type_;
-
-
-#endif
+++ /dev/null
-/*
- * 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
- */
-
-
-/*
- * Declarations of the abstract types used during demarshalling of enum
- * xen_vbd_type. Internal to this library -- do not use from outside.
- */
-
-
-#ifndef XEN_VBD_TYPE_INTERNAL_H
-#define XEN_VBD_TYPE_INTERNAL_H
-
-
-#include "xen_internal.h"
-
-
-extern const abstract_type xen_vbd_type_abstract_type_;
-extern const abstract_type xen_vbd_type_set_abstract_type_;
-
-
-#endif
+++ /dev/null
-/*
- * 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
- */
-
-
-/*
- * Declarations of the abstract types used during demarshalling of enum
- * xen_vdi_type. Internal to this library -- do not use from outside.
- */
-
-
-#ifndef XEN_VDI_TYPE_INTERNAL_H
-#define XEN_VDI_TYPE_INTERNAL_H
-
-
-#include "xen_internal.h"
-
-
-extern const abstract_type xen_vdi_type_abstract_type_;
-extern const abstract_type xen_vdi_type_set_abstract_type_;
-
-
-#endif
+++ /dev/null
-/*
- * 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
- */
-
-
-/*
- * Declarations of the abstract types used during demarshalling of enum
- * xen_vm_power_state. Internal to this library -- do not use from outside.
- */
-
-
-#ifndef XEN_VM_POWER_STATE_INTERNAL_H
-#define XEN_VM_POWER_STATE_INTERNAL_H
-
-
-#include "xen_internal.h"
-
-
-extern const abstract_type xen_vm_power_state_abstract_type_;
-extern const abstract_type xen_vm_power_state_set_abstract_type_;
-
-
-#endif
+++ /dev/null
-/*
- * 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
- */
-
-#define _XOPEN_SOURCE
-#include <assert.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-#include <libxml/parser.h>
-#include <libxml/tree.h>
-#include <libxml/xmlsave.h>
-#include <libxml/xmlstring.h>
-#include <libxml/xpath.h>
-
-#include "xen/api/xen_common.h"
-#include "xen/api/xen_host.h"
-#include "xen_internal.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"
-
-
-/*
- * Whether to ignore missing structure entries. This is not something we
- * want to do, once the API has stabilised, as it indicates that the server is
- * broken, but at the moment, complaining is just slowing development down.
- */
-#define PERMISSIVE 1
-
-
-static xmlXPathCompExprPtr responsePath = NULL;
-static xmlXPathCompExprPtr faultPath = NULL;
-
-
-typedef struct
-{
- size_t size;
- void *contents[];
-} arbitrary_map;
-
-
-typedef struct
-{
- void *handle;
-} arbitrary_record;
-
-
-typedef struct
-{
- bool is_record;
- union
- {
- char *handle;
- arbitrary_record *record;
- } u;
-} arbitrary_record_opt;
-
-
-static char *
-make_body(const char *, abstract_value [], int);
-
-static void
-parse_result(xen_session *, const char *, const abstract_type *, void *);
-
-static void
-add_value(xmlNode *, const char *, const char *);
-static void
-add_param(xmlNode *, const char *, const char *);
-
-static xmlNode *
-add_param_struct(xmlNode *);
-static xmlNode *
-add_param_array(xmlNode *);
-static xmlNode *
-add_struct_array(xmlNode *, const char *);
-static xmlNode *
-add_nested_struct(xmlNode *, const char *);
-static void
-add_struct_member(xmlNode *, const char *, const char *, const char *);
-static void
-add_unnamed_value(xmlNode *, const char *, const char *, const char *);
-
-static void
-add_struct_value(const struct abstract_type *, void *,
- void (*)(xmlNode *, const char *, const char *,
- const char *),
- const char *, xmlNode *);
-
-static xmlNode *
-add_container(xmlNode *parent, const char *name);
-
-static void
-call_raw(xen_session *, const char *, abstract_value [], int,
- const abstract_type *, void *);
-
-static void
-parse_structmap_value(xen_session *, xmlNode *, const abstract_type *,
- void *);
-
-static size_t size_of_member(const abstract_type *);
-
-static const char *
-get_val_as_string(const struct abstract_type *, void *, char *, size_t);
-
-
-void
-xen_init(void)
-{
- responsePath =
- xmlXPathCompile(
- BAD_CAST(
- "/methodResponse/params/param/value/struct/member/value"));
- faultPath =
- xmlXPathCompile(
- BAD_CAST("/methodResponse/fault/value/struct/member/value"));
-}
-
-
-void
-xen_fini(void)
-{
- xmlXPathFreeCompExpr(responsePath);
- xmlXPathFreeCompExpr(faultPath);
- responsePath = NULL;
- faultPath = NULL;
-}
-
-
-void
-xen_session_record_free(xen_session_record *record)
-{
- if (record == NULL)
- {
- return;
- }
- free(record->uuid);
- xen_host_record_opt_free(record->this_host);
- free(record->this_user);
- free(record);
-}
-
-
-xen_session *
-xen_session_login_with_password(xen_call_func call_func, void *handle,
- const char *uname, const char *pwd)
-{
- abstract_value params[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = uname },
- { .type = &abstract_type_string,
- .u.string_val = pwd }
- };
-
- xen_session *session = malloc(sizeof(xen_session));
- session->call_func = call_func;
- session->handle = handle;
- session->session_id = NULL;
- session->ok = true;
- session->error_description = NULL;
- session->error_description_count = 0;
-
- call_raw(session, "session.login_with_password", params, 2,
- &abstract_type_string, &session->session_id);
-
- return session;
-}
-
-
-void
-xen_session_logout(xen_session *session)
-{
- abstract_value params[] =
- {
- };
- xen_call_(session, "session.logout", params, 0, NULL, NULL);
-
- if (session->error_description != NULL)
- {
- for (int i = 0; i < session->error_description_count; i++)
- {
- free(session->error_description[i]);
- }
- free(session->error_description);
- }
-
- free((char *)session->session_id);
- free(session);
-}
-
-
-void
-xen_session_clear_error(xen_session *session)
-{
- if (session->error_description != NULL)
- {
- for (int i = 0; i < session->error_description_count; i++)
- {
- free(session->error_description[i]);
- }
- free(session->error_description);
- }
- session->error_description = NULL;
- session->error_description_count = 0;
- session->ok = true;
-}
-
-
-bool
-xen_session_get_uuid(xen_session *session, char **result,
- xen_session *self_session)
-{
- abstract_value params[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = self_session->session_id }
- };
-
- xen_call_(session, "session.get_uuid", params, 1,
- &abstract_type_string, result);
- return session->ok;
-}
-
-
-bool
-xen_session_get_this_host(xen_session *session, xen_host *result,
- xen_session *self_session)
-{
- abstract_value params[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = self_session->session_id }
- };
-
- xen_call_(session, "session.get_this_host", params, 1,
- &abstract_type_string, result);
- return session->ok;
-}
-
-
-bool
-xen_session_get_this_user(xen_session *session, char **result,
- xen_session *self_session)
-{
- abstract_value params[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = self_session->session_id }
- };
-
- xen_call_(session, "session.get_this_user", params, 1,
- &abstract_type_string, result);
- return session->ok;
-}
-
-
-bool
-xen_session_get_last_active(xen_session *session, time_t *result,
- xen_session *self_session)
-{
- abstract_value params[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = self_session->session_id }
- };
-
- xen_call_(session, "session.get_last_active", params, 1,
- &abstract_type_datetime, result);
- return session->ok;
-}
-
-
-static const struct_member xen_session_record_struct_members[] =
- {
- { .key = "uuid",
- .type = &abstract_type_string,
- .offset = offsetof(xen_session_record, uuid) },
- { .key = "this_host",
- .type = &abstract_type_ref,
- .offset = offsetof(xen_session_record, this_host) },
- { .key = "this_user",
- .type = &abstract_type_string,
- .offset = offsetof(xen_session_record, this_user) },
- { .key = "last_active",
- .type = &abstract_type_datetime,
- .offset = offsetof(xen_session_record, last_active) },
- };
-
-const abstract_type xen_session_record_abstract_type_ =
- {
- .typename = STRUCT,
- .struct_size = sizeof(xen_session_record),
- .member_count =
- sizeof(xen_session_record_struct_members) / sizeof(struct_member),
- .members = xen_session_record_struct_members
- };
-
-
-bool
-xen_session_get_record(xen_session *session, xen_session_record **result,
- xen_session *self_session)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = self_session->session_id }
- };
-
- abstract_type result_type = xen_session_record_abstract_type_;
-
- *result = NULL;
- XEN_CALL_("session.get_record");
-
- return session->ok;
-}
-
-
-#define X "%02x"
-#define UUID_FORMAT X X X X "-" X X "-" X X "-" X X "-" X X X X X X
-
-
-bool
-xen_uuid_string_to_bytes(char *uuid, char **bytes)
-{
- unsigned int buf[16];
-
- *bytes = NULL;
-
- if (strlen(uuid) != 36)
- return false;
-
- if (16 != sscanf(uuid, UUID_FORMAT,
- buf + 0, buf + 1, buf + 2, buf + 3,
- buf + 4, buf + 5,
- buf + 6, buf + 7,
- buf + 8, buf + 9,
- buf + 10, buf + 11, buf + 12, buf + 13, buf + 14,
- buf + 15))
- {
- return false;
- }
-
- *bytes = malloc(16);
- if (*bytes == NULL)
- return false;
-
- for (int i = 0; i < 16; i++) {
- (*bytes)[i] = (char)buf[i];
- }
-
- return true;
-}
-
-
-bool
-xen_uuid_bytes_to_string(char *bytes, char **uuid)
-{
- *uuid = malloc(37);
- if (*uuid == NULL)
- return false;
-
- sprintf(*uuid, UUID_FORMAT,
- bytes[0], bytes[1], bytes[2], bytes[3],
- bytes[4], bytes[5],
- bytes[6], bytes[7],
- bytes[8], bytes[9],
- bytes[10], bytes[11], bytes[12], bytes[13], bytes[14], bytes[15]);
-
- return true;
-}
-
-
-#undef UUID_FORMAT
-#undef X
-
-
-void
-xen_uuid_free(char *uuid)
-{
- free(uuid);
-}
-
-
-void
-xen_uuid_bytes_free(char *bytes)
-{
- free(bytes);
-}
-
-
-/**
- * @param value A pointer to the correct location as per the given
- * result_type. Will be populated if the call succeeds. In that case, and if
- * value is a char **, the char * itself must be freed by the caller.
- */
-void
-xen_call_(xen_session *s, const char *method_name,
- abstract_value params[], int param_count,
- const abstract_type *result_type, void *value)
-{
- abstract_value *full_params;
- if (!s->ok)
- {
- return;
- }
-
- full_params = malloc(sizeof(abstract_value) * (param_count + 1));
-
- full_params[0].type = &abstract_type_string;
- full_params[0].u.string_val = s->session_id;
-
- memcpy(full_params + 1, params, param_count * sizeof(abstract_value));
-
- call_raw(s, method_name, full_params, param_count + 1, result_type,
- value);
-
- free(full_params);
-}
-
-
-static bool
-bufferAdd(const void *data, size_t len, void *buffer)
-{
- return 0 == xmlBufferAdd((xmlBufferPtr)buffer, data, len);
-}
-
-
-static void
-call_raw(xen_session *s, const char *method_name,
- abstract_value params[], int param_count,
- const abstract_type *result_type, void *value)
-{
- xmlBufferPtr buffer = xmlBufferCreate();
- char *body = make_body(method_name, params, param_count);
- int error_code =
- s->call_func(body, strlen(body), s->handle, buffer, &bufferAdd);
- free(body);
- if (error_code)
- {
- char **strings = malloc(2 * sizeof(char *));
-
- strings[0] = xen_strdup_("TRANSPORT_FAULT");
- strings[1] = malloc(20);
- snprintf(strings[1], 20, "%d", error_code);
-
- s->ok = false;
- s->error_description = strings;
- s->error_description_count = 2;
- }
- else
- {
- parse_result(s, (char *)xmlBufferContent(buffer), result_type, value);
- }
- xmlBufferFree(buffer);
-}
-
-
-static void server_error(xen_session *session, const char *error_string)
-{
- char **strings;
- if (!session->ok)
- {
- /* Don't wipe out the earlier error message with this one. */
- return;
- }
-
- strings = malloc(2 * sizeof(char *));
-
- strings[0] = xen_strdup_("SERVER_FAULT");
- strings[1] = xen_strdup_(error_string);
-
- session->ok = false;
- session->error_description = strings;
- session->error_description_count = 2;
-}
-
-
-static void server_error_2(xen_session *session, const char *error_string,
- const char *param)
-{
- char **strings;
- if (!session->ok)
- {
- /* Don't wipe out the earlier error message with this one. */
- return;
- }
-
- strings = malloc(3 * sizeof(char *));
-
- strings[0] = xen_strdup_("SERVER_FAULT_2");
- strings[1] = xen_strdup_(error_string);
- strings[2] = xen_strdup_(param);
-
- session->ok = false;
- session->error_description = strings;
- session->error_description_count = 3;
-}
-
-
-static bool is_node(xmlNode *n, char *type)
-{
- return
- n->type == XML_ELEMENT_NODE &&
- 0 == strcmp((char *)n->name, type);
-}
-
-
-static bool is_container_node(xmlNode *n, char *type)
-{
- return
- is_node(n, type) &&
- n->children != NULL &&
- n->children == n->last &&
- n->children->type == XML_ELEMENT_NODE;
-}
-
-
-/**
- * @return The contents of the given value, or NULL if this is not a node with
- * the given type. If not NULL, the result must be freed with xmlFree().
- */
-static xmlChar *string_from_value(xmlNode *n, char *type)
-{
- /*
- <value><type>XYZ</type></value> is normal, but the XML-RPC spec also
- allows <value>XYZ</value> where XYZ is to be interpreted as a string.
- */
-
- if (is_container_node(n, "value") &&
- 0 == strcmp((char *)n->children->name, type))
- {
- return
- n->children->children == NULL ?
- xmlStrdup(BAD_CAST("")) :
- xmlNodeGetContent(n->children->children);
- }
- else if (0 == strcmp(type, "string") && is_node(n, "value"))
- {
- return
- n->children == NULL ?
- xmlStrdup(BAD_CAST("")) :
- xmlNodeGetContent(n->children);
- }
- else
- {
- return NULL;
- }
-}
-
-
-/**
- * Find the name node that is a child of the given one, and return its
- * contents, or NULL if this has no such node. If not NULL, the result must
- * be freed with xmlFree().
- */
-static xmlChar *string_from_name(xmlNode *n)
-{
- xmlNode *cur = n->children;
-
- while (cur != NULL)
- {
- if (0 == strcmp((char *)cur->name, "name"))
- {
- return xmlNodeGetContent(cur);
- }
- cur = cur->next;
- }
-
- return NULL;
-}
-
-
-static int count_children(xmlNode *n, const char *name)
-{
- int result = 0;
- xmlNode *cur = n->children;
-
- while (cur != NULL)
- {
- if (0 == strcmp((char *)cur->name, name))
- {
- result++;
- }
- cur = cur->next;
- }
-
- return result;
-}
-
-
-static void destring(xen_session *s, xmlChar *name, const abstract_type *type,
- void *value)
-{
- switch (type->typename)
- {
- case STRING:
- *((char **)value) = xen_strdup_((const char *)name);
- break;
-
- case INT:
- *((int64_t *)value) = atoll((const char *)name);
- break;
-
- case FLOAT:
- *((double *)value) = atof((const char *)name);
- break;
-
- default:
- server_error(s, "Invalid Map key type");
- }
-}
-
-
-/**
- * result_type : STRING => value : char **, the char * is yours.
- * result_type : ENUM => value : int *
- * result_type : INT => value : int64_t *
- * result_type : FLOAT => value : double *
- * result_type : BOOL => value : bool *
- * result_type : DATETIME => value : time_t *
- * result_type : SET => value : arbitrary_set **, the set is yours.
- * result_type : MAP => value : arbitrary_map **, the map is yours.
- * result_type : OPT => value : arbitrary_record_opt **,
- * the record is yours, the handle is
- * filled.
- * result_type : STRUCT => value : void **, the void * is yours.
- */
-static void parse_into(xen_session *s, xmlNode *value_node,
- const abstract_type *result_type, void *value,
- int slot)
-{
- if (result_type == NULL)
- {
- xmlChar *string = string_from_value(value_node, "string");
- if (string == NULL || strcmp((char *)string, ""))
- {
- server_error(s,
- "Expected Void from the server, but didn't get it");
- }
- else
- {
- free(string);
- }
-
- return;
- }
-
- switch (result_type->typename)
- {
- case STRING:
- {
- xmlChar *string = string_from_value(value_node, "string");
- if (string == NULL)
- {
- server_error(
- s, "Expected a String from the server, but didn't get one");
- }
- else
- {
- ((char **)value)[slot] = xen_strdup_((const char *)string);
- free(string);
- }
- }
- break;
-
- case ENUM:
- {
- xmlChar *string = string_from_value(value_node, "string");
- if (string == NULL)
- {
-#if PERMISSIVE
- fprintf(stderr,
- "Expected an Enum from the server, but didn't get one\n");
- ((int *)value)[slot] = 0;
-#else
- server_error(
- s, "Expected an Enum from the server, but didn't get one");
-#endif
- }
- else
- {
- ((int *)value)[slot] =
- result_type->enum_demarshaller(s, (const char *)string);
- free(string);
- }
- }
- break;
-
- case INT:
- {
- xmlChar *string = string_from_value(value_node, "string");
- if (string == NULL)
- {
- server_error(
- s, "Expected an Int from the server, but didn't get one");
- }
- else
- {
- ((int64_t *)value)[slot] = (int64_t)atoll((char *)string);
- free(string);
- }
- }
- break;
-
- case FLOAT:
- {
- xmlChar *string = string_from_value(value_node, "double");
- if (string == NULL)
- {
-#if PERMISSIVE
- fprintf(stderr,
- "Expected a Float from the server, but didn't get one\n");
- ((double *)value)[slot] = 0.0;
-#else
- server_error(
- s, "Expected a Float from the server, but didn't get one");
-#endif
- }
- else
- {
- ((double *)value)[slot] = atof((char *)string);
- free(string);
- }
- }
- break;
-
- case BOOL:
- {
- xmlChar *string = string_from_value(value_node, "boolean");
- if (string == NULL)
- {
-#if PERMISSIVE
- fprintf(stderr,
- "Expected a Bool from the server, but didn't get one\n");
- ((bool *)value)[slot] = false;
-#else
- server_error(
- s, "Expected a Bool from the server, but didn't get one");
-#endif
- }
- else
- {
- ((bool *)value)[slot] = (0 == strcmp((char *)string, "1"));
- free(string);
- }
- }
- break;
-
- case DATETIME:
- {
- xmlChar *string = string_from_value(value_node, "dateTime.iso8601");
- if (string == NULL)
- {
- server_error(
- s, "Expected an DateTime from the server but didn't get one");
- }
- else
- {
- struct tm tm;
- memset(&tm, 0, sizeof(tm));
- strptime((char *)string, "%Y%m%dT%H:%M:%S", &tm);
- ((time_t *)value)[slot] = (time_t)mktime(&tm);
- free(string);
- }
- }
- break;
-
- case SET:
- {
- if (!is_container_node(value_node, "value") ||
- !is_container_node(value_node->children, "array"))
- {
- server_error(s,
- "Expected Set from the server, but didn't get it");
- }
- else
- {
- arbitrary_set *set;
- xmlNode *cur, *data_node = value_node->children->children;
- int i, n = count_children(data_node, "value");
-
- const abstract_type *member_type = result_type->child;
- size_t member_size = size_of_member(member_type);
-
- set = calloc(1, sizeof(arbitrary_set) + member_size * n);
- set->size = n;
- i = 0;
- cur = data_node->children;
-
- while (cur != NULL)
- {
- if (0 == strcmp((char *)cur->name, "value"))
- {
- parse_into(s, cur, member_type, set->contents, i);
- i++;
- }
- cur = cur->next;
- }
-
- ((arbitrary_set **)value)[slot] = set;
- }
- }
- break;
-
- case MAP:
- {
- if (!is_container_node(value_node, "value") ||
- value_node->children->type != XML_ELEMENT_NODE ||
- 0 != strcmp((char *)value_node->children->name, "struct"))
- {
- server_error(s,
- "Expected Map from the server, but didn't get it");
- }
- else
- {
- arbitrary_map *map;
- xmlNode *cur, *struct_node = value_node->children;
- int i, n = count_children(struct_node, "member");
-
- size_t struct_size = result_type->struct_size;
-
- const struct struct_member *key_member = result_type->members;
- const struct struct_member *val_member = result_type->members + 1;
-
- map = calloc(1, sizeof(arbitrary_map) + struct_size * n);
- map->size = n;
- i = 0;
- cur = struct_node->children;
-
- while (cur != NULL)
- {
- if (0 == strcmp((char *)cur->name, "member"))
- {
- xmlChar *name;
- if (cur->children == NULL || cur->last == cur->children)
- {
- server_error(s, "Malformed Map");
- free(map);
- return;
- }
-
- name = string_from_name(cur);
- if (name == NULL)
- {
- server_error(s, "Malformed Map");
- free(map);
- return;
- }
-
- destring(s, name, key_member->type,
- ((void *)(map + 1)) +
- (i * struct_size) +
- key_member->offset);
- xmlFree(name);
- if (!s->ok)
- {
- free(map);
- return;
- }
-
- parse_structmap_value(s, cur, val_member->type,
- ((void *)(map + 1)) +
- (i * struct_size) +
- val_member->offset);
- if (!s->ok)
- {
- free(map);
- return;
- }
- i++;
- }
- cur = cur->next;
- }
-
- ((arbitrary_map **)value)[slot] = map;
- }
- }
- break;
-
- case STRUCT:
- {
- if (!is_container_node(value_node, "value") ||
- value_node->children->type != XML_ELEMENT_NODE ||
- 0 != strcmp((char *)value_node->children->name, "struct") ||
- value_node->children->children == NULL)
- {
- server_error(s,
- "Expected Map from the server, but didn't get it");
- }
- else
- {
- xmlNode *struct_node = value_node->children;
-
- void *result = calloc(1, result_type->struct_size);
- xmlNode *cur = struct_node->children;
-
- size_t member_count = result_type->member_count;
-
- const struct_member **checklist =
- malloc(sizeof(const struct_member *) * member_count);
- int seen_count = 0;
-
- while (cur != NULL)
- {
- if (0 == strcmp((char *)cur->name, "member"))
- {
- xmlChar *name;
- if (cur->children == NULL || cur->last == cur->children)
- {
- server_error(s, "Malformed Struct");
- free(result);
- free(checklist);
- return;
- }
-
- name = string_from_name(cur);
- if (name == NULL)
- {
- server_error(s, "Malformed Struct");
- free(result);
- free(checklist);
- return;
- }
-
- for (size_t i = 0; i < member_count; i++)
- {
- const struct_member *mem = result_type->members + i;
-
- if (0 == strcmp((char *)name, mem->key))
- {
- parse_structmap_value(s, cur, mem->type,
- result + mem->offset);
- checklist[seen_count] = mem;
- seen_count++;
- break;
- }
- }
-
- /* Note that we're skipping unknown fields implicitly.
- This means that we'll be forward compatible with
- new servers. */
-
- xmlFree(name);
-
- if (!s->ok)
- {
- free(result);
- free(checklist);
- return;
- }
- }
- cur = cur->next;
- }
-
- /* Check that we've filled all fields. */
- for (size_t i = 0; i < member_count; i++)
- {
- const struct_member *mem = result_type->members + i;
- int j;
-
- for (j = 0; j < seen_count; j++)
- {
- if (checklist[j] == mem)
- {
- break;
- }
- }
-
- if (j == seen_count)
- {
-#if PERMISSIVE
- fprintf(stderr,
- "Struct did not contain expected field %s.\n",
- mem->key);
-#else
- server_error_2(s,
- "Struct did not contain expected field",
- mem->key);
- free(result);
- free(checklist);
- return;
-#endif
- }
- }
-
- free(checklist);
- ((void **)value)[slot] = result;
- }
- }
- break;
-
- case REF:
- {
- arbitrary_record_opt *record_opt =
- calloc(1, sizeof(arbitrary_record_opt));
-
- record_opt->is_record = false;
- parse_into(s, value_node, &abstract_type_string,
- &(record_opt->u.handle), 0);
-
- ((arbitrary_record_opt **)value)[slot] = record_opt;
- }
- break;
-
- default:
- assert(false);
- }
-}
-
-
-static size_t size_of_member(const abstract_type *type)
-{
- switch (type->typename)
- {
- case STRING:
- return sizeof(char *);
-
-/*
- case INT:
- return sizeof(int64_t);
-
- case FLOAT:
- return sizeof(double);
-
- case BOOL:
- return sizeof(bool);
-*/
- case ENUM:
- return sizeof(int);
-
- case REF:
- return sizeof(arbitrary_record_opt *);
-
- case STRUCT:
- return type->struct_size;
-
- default:
- assert(false);
- }
-}
-
-
-static void parse_structmap_value(xen_session *s, xmlNode *n,
- const abstract_type *type, void *value)
-{
- xmlNode *cur = n->children;
-
- while (cur != NULL)
- {
- if (0 == strcmp((char *)cur->name, "value"))
- {
- parse_into(s, cur, type, value, 0);
- return;
- }
- cur = cur->next;
- }
-
- server_error(s, "Missing value in Map/Struct");
-}
-
-
-static void parse_fault(xen_session *session, xmlXPathContextPtr xpathCtx)
-{
- xmlNode *fault_node0, *fault_node1;
- xmlChar *fault_code_str, *fault_string_str;
- char **strings;
-
- xmlXPathObjectPtr xpathObj = xmlXPathCompiledEval(faultPath, xpathCtx);
- if (xpathObj == NULL)
- {
- server_error(session, "Method response is neither result nor fault");
- return;
- }
-
- if (xpathObj->type != XPATH_NODESET ||
- xpathObj->nodesetval->nodeNr != 2)
- {
- xmlXPathFreeObject(xpathObj);
- server_error(session, "Method response is neither result nor fault");
- return;
- }
-
- fault_node0 = xpathObj->nodesetval->nodeTab[0];
- fault_node1 = xpathObj->nodesetval->nodeTab[1];
-
- fault_code_str = string_from_value(fault_node0, "int");
- if (fault_code_str == NULL)
- {
- fault_code_str = string_from_value(fault_node0, "i4");
- }
- if (fault_code_str == NULL)
- {
- xmlXPathFreeObject(xpathObj);
- server_error(session, "Fault code is malformed");
- return;
- }
-
- fault_string_str = string_from_value(fault_node1, "string");
- if (fault_string_str == NULL)
- {
- xmlFree(fault_code_str);
- xmlXPathFreeObject(xpathObj);
- server_error(session, "Fault string is malformed");
- return;
- }
-
- strings = malloc(3 * sizeof(char *));
-
- strings[0] = xen_strdup_("FAULT");
- strings[1] = xen_strdup_((char *)fault_code_str);
- strings[2] = xen_strdup_((char *)fault_string_str);
-
- session->ok = false;
- session->error_description = strings;
- session->error_description_count = 3;
-
- xmlFree(fault_code_str);
- xmlFree(fault_string_str);
- xmlXPathFreeObject(xpathObj);
-}
-
-
-static void parse_failure(xen_session *session, xmlNode *node)
-{
- abstract_type error_description_type =
- { .typename = SET,
- .child = &abstract_type_string };
- arbitrary_set *error_descriptions;
-
- parse_into(session, node, &error_description_type, &error_descriptions,
- 0);
-
- if (session->ok)
- {
- char **c, **strings;
- int n;
-
- session->ok = false;
-
- c = (char **)error_descriptions->contents;
- n = error_descriptions->size;
-
- strings = malloc(n * sizeof(char *));
- for (int i = 0; i < n; i++)
- {
- strings[i] = c[i];
- }
-
- session->error_description_count = n;
- session->error_description = strings;
- }
-
- free(error_descriptions);
-}
-
-
-/**
- * Parameters as for xen_call_() above.
- */
-static void parse_result(xen_session *session, const char *result,
- const abstract_type *result_type, void *value)
-{
- xmlDocPtr doc =
- xmlReadMemory(result, strlen(result), "", NULL, XML_PARSE_NONET);
- xmlXPathContextPtr xpathCtx;
- xmlXPathObjectPtr xpathObj;
- xmlNode *node0, *node1;
- xmlChar *status_code;
-
- if (doc == NULL)
- {
- server_error(session, "Couldn't parse the server response");
- return;
- }
-
- xpathCtx = xmlXPathNewContext(doc);
- if (xpathCtx == NULL)
- {
- xmlFreeDoc(doc);
- server_error(session, "Couldn't create XPath context");
- return;
- }
-
- xpathObj = xmlXPathCompiledEval(responsePath, xpathCtx);
- if (xpathObj == NULL)
- {
- parse_fault(session, xpathCtx);
-
- xmlXPathFreeContext(xpathCtx);
- xmlFreeDoc(doc);
- return;
- }
-
- if (xpathObj->type != XPATH_NODESET ||
- xpathObj->nodesetval->nodeNr != 2)
- {
- parse_fault(session, xpathCtx);
-
- xmlXPathFreeObject(xpathObj);
- xmlXPathFreeContext(xpathCtx);
- xmlFreeDoc(doc);
- return;
- }
-
- node0 = xpathObj->nodesetval->nodeTab[0];
- node1 = xpathObj->nodesetval->nodeTab[1];
-
- status_code = string_from_value(node0, "string");
- if (status_code == NULL)
- {
- xmlXPathFreeObject(xpathObj);
- xmlXPathFreeContext(xpathCtx);
- xmlFreeDoc(doc);
- server_error(session, "Server response does not have a Status");
- return;
- }
-
- if (strcmp((char *)status_code, "Success"))
- {
- parse_failure(session, node1);
-
- xmlFree(status_code);
- xmlXPathFreeObject(xpathObj);
- xmlXPathFreeContext(xpathCtx);
- xmlFreeDoc(doc);
- return;
- }
-
- parse_into(session, node1, result_type, value, 0);
-
- xmlFree(status_code);
- xmlXPathFreeObject(xpathObj);
- xmlXPathFreeContext(xpathCtx);
- xmlFreeDoc(doc);
-}
-
-
-static void
-make_body_add_type(enum abstract_typename typename, abstract_value *v,
- xmlNode *params_node)
-{
- char buf[20];
- switch (typename)
- {
- case STRING:
- add_param(params_node, "string", v->u.string_val);
- break;
-
- case INT:
- snprintf(buf, sizeof(buf), "%"PRId64, v->u.int_val);
- add_param(params_node, "string", buf);
- break;
-
- case FLOAT:
- snprintf(buf, sizeof(buf), "%lf", v->u.float_val);
- add_param(params_node, "double", buf);
- break;
-
- case BOOL:
- add_param(params_node, "boolean", v->u.bool_val ? "1" : "0");
- break;
-
- case VOID:
- add_param(params_node, "string", "");
- break;
-
- case ENUM:
- add_param(params_node, "string",
- v->type->enum_marshaller(v->u.enum_val));
- break;
-
- case SET:
- {
- const struct abstract_type *member_type = v->type->child;
- arbitrary_set *set_val = v->u.struct_val;
- abstract_value v;
- xmlNode *data_node = add_param_array(params_node);
-
- for (size_t i = 0; i < set_val->size; i++)
- {
- switch (member_type->typename) {
- case STRING:
- v.u.string_val = (char *)set_val->contents[i];
- make_body_add_type(member_type->typename, &v, data_node);
- break;
- default:
- assert(false);
- }
- }
- }
- break;
-
- case STRUCT:
- {
- size_t member_count = v->type->member_count;
-
- xmlNode *struct_node = add_param_struct(params_node);
-
- for (size_t i = 0; i < member_count; i++)
- {
- const struct struct_member *mem = v->type->members + i;
- const char *key = mem->key;
- void *struct_value = v->u.struct_val;
-
- add_struct_value(mem->type, struct_value + mem->offset,
- add_struct_member, key, struct_node);
- }
- }
- break;
-
- case MAP:
- {
- const struct struct_member *member = v->type->members;
- arbitrary_map *map_val = v->u.struct_val;
- xmlNode *param_node = add_param_struct(params_node);
- for (size_t i = 0; i < map_val->size; i++) {
- enum abstract_typename typename_key = member[0].type->typename;
- enum abstract_typename typename_val = member[1].type->typename;
- int offset_key = member[0].offset;
- int offset_val = member[1].offset;
- int struct_size = v->type->struct_size;
-
- switch (typename_key) {
- case STRING: {
- char **addr = (void *)(map_val + 1) +
- (i * struct_size) +
- offset_key;
- char *key = *addr;
-
- switch (typename_val) {
- case STRING: {
- char *val;
- addr = (void *)(map_val + 1) +
- (i * struct_size) +
- offset_val;
- val = *addr;
- add_struct_member(param_node, key, "string", val);
- break;
- }
- default:
- assert(false);
- }
- break;
- }
- default:
- assert(false);
- }
- }
- }
- break;
-
-
- default:
- assert(false);
- }
-}
-
-
-static char *
-make_body(const char *method_name, abstract_value params[], int param_count)
-{
- xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0");
- xmlNode *params_node, *methodCall = xmlNewNode(NULL, BAD_CAST "methodCall");
- xmlBufferPtr buffer;
- xmlSaveCtxtPtr save_ctxt;
- xmlChar *content;
-
- xmlDocSetRootElement(doc, methodCall);
-
- xmlNewChild(methodCall, NULL, BAD_CAST "methodName",
- BAD_CAST method_name);
-
- params_node = xmlNewChild(methodCall, NULL, BAD_CAST "params", NULL);
-
- for (int p = 0; p < param_count; p++)
- {
- abstract_value *v = params + p;
- make_body_add_type(v->type->typename, v, params_node);
- }
-
- buffer = xmlBufferCreate();
- save_ctxt = xmlSaveToBuffer(buffer, NULL, XML_SAVE_NO_XHTML);
-
- if (xmlSaveDoc(save_ctxt, doc) == -1)
- {
- return NULL;
- }
-
- xmlFreeDoc(doc);
- xmlSaveClose(save_ctxt);
- content = xmlStrdup(xmlBufferContent(buffer));
- xmlBufferFree(buffer);
- return (char *)content;
-}
-
-
-static void
-add_struct_value(const struct abstract_type *type, void *value,
- void (*adder)(xmlNode *node, const char *key,
- const char *type, const char *val),
- const char *key, xmlNode *node)
-{
- char buf[20];
-
- switch (type->typename)
- {
- case REF:
- case STRING:
- case INT:
- case ENUM:
- {
- const char *val_as_string =
- get_val_as_string(type, value, buf, sizeof(buf));
- adder(node, key, "string", val_as_string);
- }
- break;
-
- case FLOAT:
- {
- double val = *(double *)value;
- snprintf(buf, sizeof(buf), "%lf", val);
- adder(node, key, "double", buf);
- }
- break;
-
- case BOOL:
- {
- bool val = *(bool *)value;
- adder(node, key, "boolean", val ? "1" : "0");
- }
- break;
-
- case SET:
- {
- const struct abstract_type *member_type = type->child;
- size_t member_size = size_of_member(member_type);
- arbitrary_set *set_val = *(arbitrary_set **)value;
-
- if (set_val != NULL)
- {
- xmlNode *data_node = add_struct_array(node, key);
-
- for (size_t i = 0; i < set_val->size; i++)
- {
- void *member_value = (char *)set_val->contents +
- (i * member_size);
- add_struct_value(member_type, member_value,
- add_unnamed_value, NULL, data_node);
- }
- }
- }
- break;
-
- case STRUCT:
- {
- assert(false);
- /* XXX Nested structures aren't supported yet, but
- fortunately we don't need them, because we don't have
- any "deep create" calls. This will need to be
- fixed. */
- }
- break;
-
- case MAP:
- {
- size_t member_size = type->struct_size;
- const struct abstract_type *l_type = type->members[0].type;
- const struct abstract_type *r_type = type->members[1].type;
- int l_offset = type->members[0].offset;
- int r_offset = type->members[1].offset;
-
- arbitrary_map *map_val = *(arbitrary_map **)value;
-
- if (map_val != NULL)
- {
- xmlNode *struct_node = add_nested_struct(node, key);
-
- for (size_t i = 0; i < map_val->size; i++)
- {
- void *contents = (void *)map_val->contents;
- void *l_value = contents + (i * member_size) + l_offset;
- void *r_value = contents + (i * member_size) + r_offset;
-
- const char *l_value_as_string =
- get_val_as_string(l_type, l_value, buf, sizeof(buf));
-
- add_struct_value(r_type, r_value, add_struct_member,
- l_value_as_string, struct_node);
- }
- }
- }
- break;
-
- default:
- assert(false);
- }
-}
-
-
-static const char *
-get_val_as_string(const struct abstract_type *type, void *value, char *buf,
- size_t bufsize)
-{
- switch (type->typename)
- {
- case REF:
- {
- arbitrary_record_opt *val = *(arbitrary_record_opt **)value;
- if (val != NULL)
- {
- if (val->is_record)
- {
- return val->u.record->handle;
- }
- else
- {
- return val->u.handle;
- }
- }
- else
- {
- return NULL;
- }
- }
- break;
-
- case STRING:
- {
- return *(char **)value;
- }
- break;
-
- case INT:
- {
- int64_t val = *(int64_t *)value;
- snprintf(buf, bufsize, "%"PRId64, val);
- return buf;
- }
- break;
-
- case ENUM:
- {
- int val = *(int *)value;
- return type->enum_marshaller(val);
- }
- break;
-
- default:
- assert(false);
- }
-}
-
-
-static xmlNode *
-add_container(xmlNode *parent, const char *name)
-{
- return xmlNewChild(parent, NULL, BAD_CAST name, NULL);
-}
-
-
-static void
-add_param(xmlNode *params_node, const char *type, const char *value)
-{
- xmlNode *param_node = add_container(params_node, "param");
- add_value(param_node, type, value);
-}
-
-
-static void
-add_value(xmlNode *parent, const char *type, const char *value)
-{
- xmlNode *value_node = add_container(parent, "value");
- xmlNewChild(value_node, NULL, BAD_CAST type, BAD_CAST value);
-}
-
-
-static void
-add_unnamed_value(xmlNode *parent, const char *name, const char *type,
- const char *value)
-{
- (void)name;
- add_value(parent, type, value);
-}
-
-
-static xmlNode *
-add_param_struct(xmlNode *params_node)
-{
- xmlNode *param_node = add_container(params_node, "param");
- xmlNode *value_node = add_container(param_node, "value");
-
- return xmlNewChild(value_node, NULL, BAD_CAST "struct", NULL);
-}
-
-
-static xmlNode *
-add_param_array(xmlNode *params_node)
-{
- xmlNode *param_node = add_container(params_node, "param");
- xmlNode *value_node = add_container(param_node, "value");
-
- return xmlNewChild(value_node, NULL, BAD_CAST "array", NULL);
-}
-
-
-static void
-add_struct_member(xmlNode *struct_node, const char *name, const char *type,
- const char *value)
-{
- xmlNode *member_node = add_container(struct_node, "member");
-
- xmlNewChild(member_node, NULL, BAD_CAST "name", BAD_CAST name);
-
- add_value(member_node, type, value);
-}
-
-
-static xmlNode *
-add_struct_array(xmlNode *struct_node, const char *name)
-{
- xmlNode *member_node = add_container(struct_node, "member");
- xmlNode *value_node, *array_node;
-
- xmlNewChild(member_node, NULL, BAD_CAST "name", BAD_CAST name);
-
- value_node = add_container(member_node, "value");
- array_node = add_container(value_node, "array");
-
- return add_container(array_node, "data");
-}
-
-
-static xmlNode *
-add_nested_struct(xmlNode *struct_node, const char *name)
-{
- xmlNode *member_node = add_container(struct_node, "member");
- xmlNode *value_node;
-
- xmlNewChild(member_node, NULL, BAD_CAST "name", BAD_CAST name);
-
- value_node = add_container(member_node, "value");
-
- return add_container(value_node, "struct");
-}
-
-
-int xen_enum_lookup_(xen_session *session, const char *str,
- const char **lookup_table, int n)
-{
- if (str != NULL)
- {
- for (int i = 0; i < n; i++)
- {
- if (0 == strcmp(str, lookup_table[i]))
- {
- return i;
- }
- }
- }
-
- server_error_2(session, "Bad enum string", str);
- return 0;
-}
-
-
-char *
-xen_strdup_(const char *in)
-{
- char *result = malloc(strlen(in) + 1);
- strcpy(result, in);
- return result;
-}
-
-
-const abstract_type abstract_type_string = { .typename = STRING };
-const abstract_type abstract_type_int = { .typename = INT };
-const abstract_type abstract_type_float = { .typename = FLOAT };
-const abstract_type abstract_type_bool = { .typename = BOOL };
-const abstract_type abstract_type_datetime = { .typename = DATETIME };
-const abstract_type abstract_type_ref = { .typename = REF };
-
-const abstract_type abstract_type_string_set =
- {
- .typename = SET,
- .child = &abstract_type_string
- };
-
-const abstract_type abstract_type_ref_set =
- {
- .typename = SET,
- .child = &abstract_type_ref
- };
-
-static const struct struct_member string_string_members[] =
-{
- {
- .type = &abstract_type_string,
- .offset = offsetof(xen_string_string_map_contents, key)
- },
- {
- .type = &abstract_type_string,
- .offset = offsetof(xen_string_string_map_contents, val)
- }
-};
-const abstract_type abstract_type_string_string_map =
- {
- .typename = MAP,
- .struct_size = sizeof(xen_string_string_map_contents),
- .members = string_string_members
- };
-
-static struct struct_member int_float_members[] =
-{
- {
- .type = &abstract_type_int,
- .offset = offsetof(xen_int_float_map_contents, key)
- },
- {
- .type = &abstract_type_float,
- .offset = offsetof(xen_int_float_map_contents, val)
- }
-};
-const abstract_type abstract_type_int_float_map =
- {
- .typename = MAP,
- .struct_size = sizeof(xen_int_float_map_contents),
- .members = int_float_members
- };
-
-static struct struct_member int_int_members[] =
-{
- {
- .type = &abstract_type_int,
- .offset = offsetof(xen_int_int_map_contents, key)
- },
- {
- .type = &abstract_type_int,
- .offset = offsetof(xen_int_int_map_contents, val)
- }
-};
-const abstract_type abstract_type_int_int_map =
- {
- .typename = MAP,
- .struct_size = sizeof(xen_int_int_map_contents),
- .members = int_int_members
- };
-
-static struct struct_member int_string_set_members[] =
-{
- {
- .type = &abstract_type_int,
- .offset = offsetof(xen_int_string_set_map_contents, key)
- },
- {
- .type = &abstract_type_string_set,
- .offset = offsetof(xen_int_string_set_map_contents, val)
- }
-};
-const abstract_type abstract_type_int_string_set_map =
- {
- .typename = MAP,
- .struct_size = sizeof(xen_int_string_set_map_contents),
- .members = int_string_set_members
- };
+++ /dev/null
-/*
- * 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
- */
-
-
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "xen_console_protocol_internal.h"
-#include "xen_internal.h"
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_console.h>
-#include <xen/api/xen_string_string_map.h>
-#include <xen/api/xen_vm.h>
-
-
-XEN_FREE(xen_console)
-XEN_SET_ALLOC_FREE(xen_console)
-XEN_ALLOC(xen_console_record)
-XEN_SET_ALLOC_FREE(xen_console_record)
-XEN_ALLOC(xen_console_record_opt)
-XEN_RECORD_OPT_FREE(xen_console)
-XEN_SET_ALLOC_FREE(xen_console_record_opt)
-
-
-static const struct_member xen_console_record_struct_members[] =
- {
- { .key = "uuid",
- .type = &abstract_type_string,
- .offset = offsetof(xen_console_record, uuid) },
- { .key = "protocol",
- .type = &xen_console_protocol_abstract_type_,
- .offset = offsetof(xen_console_record, protocol) },
- { .key = "location",
- .type = &abstract_type_string,
- .offset = offsetof(xen_console_record, location) },
- { .key = "VM",
- .type = &abstract_type_ref,
- .offset = offsetof(xen_console_record, vm) },
- { .key = "other_config",
- .type = &abstract_type_string_string_map,
- .offset = offsetof(xen_console_record, other_config) }
- };
-
-const abstract_type xen_console_record_abstract_type_ =
- {
- .typename = STRUCT,
- .struct_size = sizeof(xen_console_record),
- .member_count =
- sizeof(xen_console_record_struct_members) / sizeof(struct_member),
- .members = xen_console_record_struct_members
- };
-
-
-void
-xen_console_record_free(xen_console_record *record)
-{
- if (record == NULL)
- {
- return;
- }
- free(record->handle);
- free(record->uuid);
- free(record->location);
- xen_vm_record_opt_free(record->vm);
- xen_string_string_map_free(record->other_config);
- free(record);
-}
-
-
-bool
-xen_console_get_record(xen_session *session, xen_console_record **result, xen_console console)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = console }
- };
-
- abstract_type result_type = xen_console_record_abstract_type_;
-
- *result = NULL;
- XEN_CALL_("console.get_record");
-
- if (session->ok)
- {
- (*result)->handle = xen_strdup_((*result)->uuid);
- }
-
- return session->ok;
-}
-
-
-bool
-xen_console_get_by_uuid(xen_session *session, xen_console *result, char *uuid)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = uuid }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("console.get_by_uuid");
- return session->ok;
-}
-
-
-bool
-xen_console_create(xen_session *session, xen_console *result, xen_console_record *record)
-{
- abstract_value param_values[] =
- {
- { .type = &xen_console_record_abstract_type_,
- .u.struct_val = record }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("console.create");
- return session->ok;
-}
-
-
-bool
-xen_console_destroy(xen_session *session, xen_console console)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = console }
- };
-
- xen_call_(session, "console.destroy", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_console_get_protocol(xen_session *session, enum xen_console_protocol *result, xen_console console)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = console }
- };
-
- abstract_type result_type = xen_console_protocol_abstract_type_;
- XEN_CALL_("console.get_protocol");
- return session->ok;
-}
-
-
-bool
-xen_console_get_location(xen_session *session, char **result, xen_console console)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = console }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("console.get_location");
- return session->ok;
-}
-
-
-bool
-xen_console_get_vm(xen_session *session, xen_vm *result, xen_console console)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = console }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("console.get_VM");
- return session->ok;
-}
-
-
-bool
-xen_console_get_other_config(xen_session *session, xen_string_string_map **result, xen_console console)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = console }
- };
-
- abstract_type result_type = abstract_type_string_string_map;
-
- *result = NULL;
- XEN_CALL_("console.get_other_config");
- return session->ok;
-}
-
-
-bool
-xen_console_set_other_config(xen_session *session, xen_console console, xen_string_string_map *other_config)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = console },
- { .type = &abstract_type_string_string_map,
- .u.set_val = (arbitrary_set *)other_config }
- };
-
- xen_call_(session, "console.set_other_config", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_console_add_to_other_config(xen_session *session, xen_console console, char *key, char *value)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = console },
- { .type = &abstract_type_string,
- .u.string_val = key },
- { .type = &abstract_type_string,
- .u.string_val = value }
- };
-
- xen_call_(session, "console.add_to_other_config", param_values, 3, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_console_remove_from_other_config(xen_session *session, xen_console console, char *key)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = console },
- { .type = &abstract_type_string,
- .u.string_val = key }
- };
-
- xen_call_(session, "console.remove_from_other_config", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_console_get_all(xen_session *session, struct xen_console_set **result)
-{
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- xen_call_(session, "console.get_all", NULL, 0, &result_type, result);
- return session->ok;
-}
-
-
-bool
-xen_console_get_uuid(xen_session *session, char **result, xen_console console)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = console }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("console.get_uuid");
- return session->ok;
-}
+++ /dev/null
-/*
- * 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
- */
-
-#include <string.h>
-
-#include "xen_internal.h"
-#include <xen/api/xen_console_protocol.h>
-#include "xen_console_protocol_internal.h"
-
-
-/*
- * Maintain this in the same order as the enum declaration!
- */
-static const char *lookup_table[] =
-{
- "vt100",
- "rfb",
- "rdp"
-};
-
-
-extern xen_console_protocol_set *
-xen_console_protocol_set_alloc(size_t size)
-{
- return calloc(1, sizeof(xen_console_protocol_set) +
- size * sizeof(enum xen_console_protocol));
-}
-
-
-extern void
-xen_console_protocol_set_free(xen_console_protocol_set *set)
-{
- free(set);
-}
-
-
-const char *
-xen_console_protocol_to_string(enum xen_console_protocol val)
-{
- return lookup_table[val];
-}
-
-
-extern enum xen_console_protocol
-xen_console_protocol_from_string(xen_session *session, const char *str)
-{
- return ENUM_LOOKUP(session, str, lookup_table);
-}
-
-
-const abstract_type xen_console_protocol_abstract_type_ =
- {
- .typename = ENUM,
- .enum_marshaller =
- (const char *(*)(int))&xen_console_protocol_to_string,
- .enum_demarshaller =
- (int (*)(xen_session *, const char *))&xen_console_protocol_from_string
- };
-
-
-const abstract_type xen_console_protocol_set_abstract_type_ =
- {
- .typename = SET,
- .child = &xen_console_protocol_abstract_type_
- };
-
-
+++ /dev/null
-/*
- * 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
- */
-
-
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "xen_internal.h"
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_cpu_pool.h>
-#include <xen/api/xen_host_cpu.h>
-
-XEN_FREE(xen_cpu_pool)
-XEN_SET_ALLOC_FREE(xen_cpu_pool)
-XEN_ALLOC(xen_cpu_pool_record)
-XEN_SET_ALLOC_FREE(xen_cpu_pool_record)
-XEN_ALLOC(xen_cpu_pool_record_opt)
-XEN_RECORD_OPT_FREE(xen_cpu_pool)
-XEN_SET_ALLOC_FREE(xen_cpu_pool_record_opt)
-
-
-static const struct_member xen_cpu_pool_record_struct_members[] =
- {
- { .key = "uuid",
- .type = &abstract_type_string,
- .offset = offsetof(xen_cpu_pool_record, uuid) },
- { .key = "name_label",
- .type = &abstract_type_string,
- .offset = offsetof(xen_cpu_pool_record, name_label) },
- { .key = "name_description",
- .type = &abstract_type_string,
- .offset = offsetof(xen_cpu_pool_record, name_description) },
- { .key = "resident_on",
- .type = &abstract_type_ref,
- .offset = offsetof(xen_cpu_pool_record, resident_on) },
- { .key = "auto_power_on",
- .type = &abstract_type_bool,
- .offset = offsetof(xen_cpu_pool_record, auto_power_on) },
- { .key = "started_VMs",
- .type = &abstract_type_ref_set,
- .offset = offsetof(xen_cpu_pool_record, started_vms) },
- { .key = "ncpu",
- .type = &abstract_type_int,
- .offset = offsetof(xen_cpu_pool_record, ncpu) },
- { .key = "sched_policy",
- .type = &abstract_type_string,
- .offset = offsetof(xen_cpu_pool_record, sched_policy) },
- { .key = "proposed_CPUs",
- .type = &abstract_type_string_set,
- .offset = offsetof(xen_cpu_pool_record, proposed_cpus) },
- { .key = "host_CPUs",
- .type = &abstract_type_ref_set,
- .offset = offsetof(xen_cpu_pool_record, host_cpus) },
- { .key = "activated",
- .type = &abstract_type_bool,
- .offset = offsetof(xen_cpu_pool_record, activated) },
- { .key = "other_config",
- .type = &abstract_type_string_string_map,
- .offset = offsetof(xen_cpu_pool_record, other_config) },
- };
-
-
-const abstract_type xen_cpu_pool_record_abstract_type_ =
- {
- .typename = STRUCT,
- .struct_size = sizeof(xen_cpu_pool_record),
- .member_count =
- sizeof(xen_cpu_pool_record_struct_members) / sizeof(struct_member),
- .members = xen_cpu_pool_record_struct_members
- };
-
-
-void
-xen_cpu_pool_record_free(xen_cpu_pool_record *record)
-{
- if (record == NULL)
- {
- return;
- }
- free(record->handle);
- free(record->uuid);
- free(record->name_label);
- free(record->name_description);
- xen_host_record_opt_free(record->resident_on);
- xen_vm_record_opt_set_free(record->started_vms);
- free(record->sched_policy);
- xen_string_set_free(record->proposed_cpus);
- xen_host_cpu_record_opt_set_free(record->host_cpus);
- xen_string_string_map_free(record->other_config);
- free(record);
-}
-
-
-bool
-xen_cpu_pool_get_record(xen_session *session, xen_cpu_pool_record **result,
- xen_cpu_pool cpu_pool)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool }
- };
-
- abstract_type result_type = xen_cpu_pool_record_abstract_type_;
-
- *result = NULL;
- XEN_CALL_("cpu_pool.get_record");
-
- if (session->ok)
- {
- (*result)->handle = xen_strdup_((*result)->uuid);
- }
-
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_get_by_uuid(xen_session *session, xen_cpu_pool *result, char *uuid)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = uuid }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("cpu_pool.get_by_uuid");
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_create(xen_session *session, xen_cpu_pool *result,
- xen_cpu_pool_record *record)
-{
- abstract_value param_values[] =
- {
- { .type = &xen_cpu_pool_record_abstract_type_,
- .u.struct_val = record }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("cpu_pool.create");
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_destroy(xen_session *session, xen_cpu_pool cpu_pool)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool }
- };
-
- xen_call_(session, "cpu_pool.destroy", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_get_uuid(xen_session *session, char **result, xen_cpu_pool cpu_pool)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("cpu_pool.get_uuid");
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_deactivate(xen_session *session, xen_cpu_pool cpu_pool)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool },
- };
-
- xen_call_(session, "cpu_pool.deactivate", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_activate(xen_session *session, xen_cpu_pool cpu_pool)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool },
- };
-
- xen_call_(session, "cpu_pool.activate", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_add_host_CPU_live(xen_session *session, xen_cpu_pool cpu_pool,
- xen_host_cpu host_cpu)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool },
- { .type = &abstract_type_string,
- .u.string_val = host_cpu },
- };
-
- xen_call_(session, "cpu_pool.add_host_CPU_live", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_remove_host_CPU_live(xen_session *session, xen_cpu_pool cpu_pool,
- xen_host_cpu host_cpu)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool },
- { .type = &abstract_type_string,
- .u.string_val = host_cpu },
- };
-
- xen_call_(session, "cpu_pool.remove_host_CPU_live", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_get_all(xen_session *session, struct xen_cpu_pool_set **result)
-{
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- xen_call_(session, "cpu_pool.get_all", NULL, 0, &result_type, result);
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_get_by_name_label(xen_session *session,
- struct xen_cpu_pool_set **result, char *label)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = label }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("cpu_pool.get_by_name_label");
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_get_activated(xen_session *session, bool *result,
- xen_cpu_pool cpu_pool)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool }
- };
-
- abstract_type result_type = abstract_type_bool;
-
- XEN_CALL_("cpu_pool.get_activated");
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_get_auto_power_on(xen_session *session, bool *result,
- xen_cpu_pool cpu_pool)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool }
- };
-
- abstract_type result_type = abstract_type_bool;
-
- XEN_CALL_("cpu_pool.get_auto_power_on");
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_get_host_CPUs(xen_session *session, struct xen_host_cpu_set **result,
- xen_cpu_pool cpu_pool)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("cpu_pool.get_host_CPUs");
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_get_name_description(xen_session *session, char **result,
- xen_cpu_pool cpu_pool)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("cpu_pool.get_name_description");
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_get_name_label(xen_session *session, char **result,
- xen_cpu_pool cpu_pool)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("cpu_pool.get_name_label");
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_get_ncpu(xen_session *session, int64_t *result,
- xen_cpu_pool cpu_pool)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool }
- };
-
- abstract_type result_type = abstract_type_int;
-
- XEN_CALL_("cpu_pool.get_ncpu");
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_get_proposed_CPUs(xen_session *session, struct xen_string_set **result,
- xen_cpu_pool cpu_pool)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("cpu_pool.get_proposed_CPUs");
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_get_other_config(xen_session *session, xen_string_string_map **result,
- xen_cpu_pool cpu_pool)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool }
- };
-
- abstract_type result_type = abstract_type_string_string_map;
-
- *result = NULL;
- XEN_CALL_("cpu_pool.get_other_config");
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_get_resident_on(xen_session *session, xen_host *result,
- xen_cpu_pool cpu_pool)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("cpu_pool.get_resident_on");
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_get_sched_policy(xen_session *session, char **result,
- xen_cpu_pool cpu_pool)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("cpu_pool.get_sched_policy");
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_get_started_VMs(xen_session *session, xen_vm_set **result,
- xen_cpu_pool cpu_pool)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("cpu_pool.get_started_VMs");
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_set_auto_power_on(xen_session *session, xen_cpu_pool cpu_pool,
- bool auto_power_on)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool },
- { .type = &abstract_type_bool,
- .u.bool_val = auto_power_on }
- };
-
- xen_call_(session, "cpu_pool.set_auto_power_on", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_set_proposed_CPUs(xen_session *session, xen_cpu_pool cpu_pool,
- xen_string_set *proposed_cpus)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool },
- { .type = &abstract_type_string_set,
- .u.set_val = (arbitrary_set *)proposed_cpus }
- };
-
- xen_call_(session, "cpu_pool.set_proposed_CPUs", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_add_to_proposed_CPUs(xen_session *session, xen_cpu_pool cpu_pool,
- char* proposed_cpu)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool },
- { .type = &abstract_type_string,
- .u.string_val = proposed_cpu }
- };
-
- xen_call_(session, "cpu_pool.add_to_proposed_CPUs", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_remove_from_proposed_CPUs(xen_session *session, xen_cpu_pool cpu_pool,
- char* proposed_cpu)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool },
- { .type = &abstract_type_string,
- .u.string_val = proposed_cpu }
- };
-
- xen_call_(session, "cpu_pool.remove_from_proposed_CPUs", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_set_name_label(xen_session *session, xen_cpu_pool cpu_pool,
- char *label)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool },
- { .type = &abstract_type_string,
- .u.string_val = label }
- };
-
- xen_call_(session, "cpu_pool.set_name_label", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_set_name_description(xen_session *session, xen_cpu_pool cpu_pool,
- char *descr)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool },
- { .type = &abstract_type_string,
- .u.string_val = descr }
- };
-
- xen_call_(session, "cpu_pool.set_name_description", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_set_ncpu(xen_session *session, xen_cpu_pool cpu_pool, int64_t ncpu)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool },
- { .type = &abstract_type_int,
- .u.int_val = ncpu }
- };
-
- xen_call_(session, "cpu_pool.set_ncpu", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_set_other_config(xen_session *session, xen_cpu_pool cpu_pool,
- xen_string_string_map *other_config)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool },
- { .type = &abstract_type_string_string_map,
- .u.set_val = (arbitrary_set *)other_config }
- };
-
- xen_call_(session, "cpu_pool.set_other_config", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_add_to_other_config(xen_session *session, xen_cpu_pool cpu_pool,
- char *key, char *value)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool },
- { .type = &abstract_type_string,
- .u.string_val = key },
- { .type = &abstract_type_string,
- .u.string_val = value }
- };
-
- xen_call_(session, "cpu_pool.add_to_other_config", param_values, 3, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_remove_from_other_config(xen_session *session, xen_cpu_pool cpu_pool,
- char *key)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool },
- { .type = &abstract_type_string,
- .u.string_val = key }
- };
-
- xen_call_(session, "cpu_pool.remove_from_other_config", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_cpu_pool_set_sched_policy(xen_session *session, xen_cpu_pool cpu_pool,
- char *sched_policy)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool },
- { .type = &abstract_type_string,
- .u.string_val = sched_policy }
- };
-
- xen_call_(session, "cpu_pool.set_sched_policy", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
+++ /dev/null
-/*
- * 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
- */
-
-
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "xen_internal.h"
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_crashdump.h>
-#include <xen/api/xen_vdi.h>
-#include <xen/api/xen_vm.h>
-
-
-XEN_FREE(xen_crashdump)
-XEN_SET_ALLOC_FREE(xen_crashdump)
-XEN_ALLOC(xen_crashdump_record)
-XEN_SET_ALLOC_FREE(xen_crashdump_record)
-XEN_ALLOC(xen_crashdump_record_opt)
-XEN_RECORD_OPT_FREE(xen_crashdump)
-XEN_SET_ALLOC_FREE(xen_crashdump_record_opt)
-
-
-static const struct_member xen_crashdump_record_struct_members[] =
- {
- { .key = "uuid",
- .type = &abstract_type_string,
- .offset = offsetof(xen_crashdump_record, uuid) },
- { .key = "VM",
- .type = &abstract_type_ref,
- .offset = offsetof(xen_crashdump_record, vm) },
- { .key = "VDI",
- .type = &abstract_type_ref,
- .offset = offsetof(xen_crashdump_record, vdi) }
- };
-
-const abstract_type xen_crashdump_record_abstract_type_ =
- {
- .typename = STRUCT,
- .struct_size = sizeof(xen_crashdump_record),
- .member_count =
- sizeof(xen_crashdump_record_struct_members) / sizeof(struct_member),
- .members = xen_crashdump_record_struct_members
- };
-
-
-void
-xen_crashdump_record_free(xen_crashdump_record *record)
-{
- if (record == NULL)
- {
- return;
- }
- free(record->handle);
- free(record->uuid);
- xen_vm_record_opt_free(record->vm);
- xen_vdi_record_opt_free(record->vdi);
- free(record);
-}
-
-
-bool
-xen_crashdump_get_record(xen_session *session, xen_crashdump_record **result, xen_crashdump crashdump)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = crashdump }
- };
-
- abstract_type result_type = xen_crashdump_record_abstract_type_;
-
- *result = NULL;
- XEN_CALL_("crashdump.get_record");
-
- if (session->ok)
- {
- (*result)->handle = xen_strdup_((*result)->uuid);
- }
-
- return session->ok;
-}
-
-
-bool
-xen_crashdump_get_by_uuid(xen_session *session, xen_crashdump *result, char *uuid)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = uuid }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("crashdump.get_by_uuid");
- return session->ok;
-}
-
-
-bool
-xen_crashdump_get_vm(xen_session *session, xen_vm *result, xen_crashdump crashdump)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = crashdump }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("crashdump.get_VM");
- return session->ok;
-}
-
-
-bool
-xen_crashdump_get_vdi(xen_session *session, xen_vdi *result, xen_crashdump crashdump)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = crashdump }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("crashdump.get_VDI");
- return session->ok;
-}
-
-
-bool
-xen_crashdump_destroy(xen_session *session, xen_crashdump self)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = self }
- };
-
- xen_call_(session, "crashdump.destroy", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_crashdump_get_all(xen_session *session, struct xen_crashdump_set **result)
-{
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- xen_call_(session, "crashdump.get_all", NULL, 0, &result_type, result);
- return session->ok;
-}
-
-
-bool
-xen_crashdump_get_uuid(xen_session *session, char **result, xen_crashdump crashdump)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = crashdump }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("crashdump.get_uuid");
- return session->ok;
-}
+++ /dev/null
-/*
- * 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
- */
-
-
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "xen_event_operation_internal.h"
-#include "xen_internal.h"
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_event.h>
-
-
-XEN_ALLOC(xen_event_record)
-XEN_SET_ALLOC_FREE(xen_event_record)
-
-
-static const struct_member xen_event_record_struct_members[] =
- {
- { .key = "id",
- .type = &abstract_type_int,
- .offset = offsetof(xen_event_record, id) },
- { .key = "timestamp",
- .type = &abstract_type_datetime,
- .offset = offsetof(xen_event_record, timestamp) },
- { .key = "class",
- .type = &abstract_type_string,
- .offset = offsetof(xen_event_record, class) },
- { .key = "operation",
- .type = &xen_event_operation_abstract_type_,
- .offset = offsetof(xen_event_record, operation) },
- { .key = "ref",
- .type = &abstract_type_string,
- .offset = offsetof(xen_event_record, ref) },
- { .key = "obj_uuid",
- .type = &abstract_type_string,
- .offset = offsetof(xen_event_record, obj_uuid) }
- };
-
-const abstract_type xen_event_record_abstract_type_ =
- {
- .typename = STRUCT,
- .struct_size = sizeof(xen_event_record),
- .member_count =
- sizeof(xen_event_record_struct_members) / sizeof(struct_member),
- .members = xen_event_record_struct_members
- };
-
-
-const abstract_type xen_event_record_set_abstract_type_ =
- {
- .typename = SET,
- .child = &xen_event_record_abstract_type_
- };
-
-
-void
-xen_event_record_free(xen_event_record *record)
-{
- if (record == NULL)
- {
- return;
- }
- free(record->class);
- free(record->ref);
- free(record->obj_uuid);
- free(record);
-}
-
-
-bool
-xen_event_register(xen_session *session, struct xen_string_set *classes)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string_set,
- .u.set_val = (arbitrary_set *)classes }
- };
-
- xen_call_(session, "event.register", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_event_unregister(xen_session *session, struct xen_string_set *classes)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string_set,
- .u.set_val = (arbitrary_set *)classes }
- };
-
- xen_call_(session, "event.unregister", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_event_next(xen_session *session, struct xen_event_record_set **result)
-{
-
- abstract_type result_type = xen_event_record_set_abstract_type_;
-
- *result = NULL;
- xen_call_(session, "event.next", NULL, 0, &result_type, result);
- return session->ok;
-}
+++ /dev/null
-/*
- * 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
- */
-
-#include <string.h>
-
-#include "xen_internal.h"
-#include <xen/api/xen_event_operation.h>
-#include "xen_event_operation_internal.h"
-
-
-/*
- * Maintain this in the same order as the enum declaration!
- */
-static const char *lookup_table[] =
-{
- "add",
- "del",
- "mod"
-};
-
-
-extern xen_event_operation_set *
-xen_event_operation_set_alloc(size_t size)
-{
- return calloc(1, sizeof(xen_event_operation_set) +
- size * sizeof(enum xen_event_operation));
-}
-
-
-extern void
-xen_event_operation_set_free(xen_event_operation_set *set)
-{
- free(set);
-}
-
-
-const char *
-xen_event_operation_to_string(enum xen_event_operation val)
-{
- return lookup_table[val];
-}
-
-
-extern enum xen_event_operation
-xen_event_operation_from_string(xen_session *session, const char *str)
-{
- return ENUM_LOOKUP(session, str, lookup_table);
-}
-
-
-const abstract_type xen_event_operation_abstract_type_ =
- {
- .typename = ENUM,
- .enum_marshaller =
- (const char *(*)(int))&xen_event_operation_to_string,
- .enum_demarshaller =
- (int (*)(xen_session *, const char *))&xen_event_operation_from_string
- };
-
-
+++ /dev/null
-/*
- * 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
- */
-
-
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "xen_internal.h"
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_host.h>
-#include <xen/api/xen_host_cpu.h>
-#include <xen/api/xen_host_metrics.h>
-#include <xen/api/xen_pbd.h>
-#include <xen/api/xen_pif.h>
-#include <xen/api/xen_sr.h>
-#include <xen/api/xen_string_string_map.h>
-#include <xen/api/xen_vm.h>
-#include <xen/api/xen_cpu_pool.h>
-
-
-XEN_FREE(xen_host)
-XEN_SET_ALLOC_FREE(xen_host)
-XEN_ALLOC(xen_host_record)
-XEN_SET_ALLOC_FREE(xen_host_record)
-XEN_ALLOC(xen_host_record_opt)
-XEN_RECORD_OPT_FREE(xen_host)
-XEN_SET_ALLOC_FREE(xen_host_record_opt)
-
-
-static const struct_member xen_host_record_struct_members[] =
- {
- { .key = "uuid",
- .type = &abstract_type_string,
- .offset = offsetof(xen_host_record, uuid) },
- { .key = "name_label",
- .type = &abstract_type_string,
- .offset = offsetof(xen_host_record, name_label) },
- { .key = "name_description",
- .type = &abstract_type_string,
- .offset = offsetof(xen_host_record, name_description) },
- { .key = "API_version_major",
- .type = &abstract_type_int,
- .offset = offsetof(xen_host_record, api_version_major) },
- { .key = "API_version_minor",
- .type = &abstract_type_int,
- .offset = offsetof(xen_host_record, api_version_minor) },
- { .key = "API_version_vendor",
- .type = &abstract_type_string,
- .offset = offsetof(xen_host_record, api_version_vendor) },
- { .key = "API_version_vendor_implementation",
- .type = &abstract_type_string_string_map,
- .offset = offsetof(xen_host_record, api_version_vendor_implementation) },
- { .key = "enabled",
- .type = &abstract_type_bool,
- .offset = offsetof(xen_host_record, enabled) },
- { .key = "software_version",
- .type = &abstract_type_string_string_map,
- .offset = offsetof(xen_host_record, software_version) },
- { .key = "other_config",
- .type = &abstract_type_string_string_map,
- .offset = offsetof(xen_host_record, other_config) },
- { .key = "capabilities",
- .type = &abstract_type_string_set,
- .offset = offsetof(xen_host_record, capabilities) },
- { .key = "cpu_configuration",
- .type = &abstract_type_string_string_map,
- .offset = offsetof(xen_host_record, cpu_configuration) },
- { .key = "sched_policy",
- .type = &abstract_type_string,
- .offset = offsetof(xen_host_record, sched_policy) },
- { .key = "supported_bootloaders",
- .type = &abstract_type_string_set,
- .offset = offsetof(xen_host_record, supported_bootloaders) },
- { .key = "resident_VMs",
- .type = &abstract_type_ref_set,
- .offset = offsetof(xen_host_record, resident_vms) },
- { .key = "logging",
- .type = &abstract_type_string_string_map,
- .offset = offsetof(xen_host_record, logging) },
- { .key = "PIFs",
- .type = &abstract_type_ref_set,
- .offset = offsetof(xen_host_record, pifs) },
- { .key = "suspend_image_sr",
- .type = &abstract_type_ref,
- .offset = offsetof(xen_host_record, suspend_image_sr) },
- { .key = "crash_dump_sr",
- .type = &abstract_type_ref,
- .offset = offsetof(xen_host_record, crash_dump_sr) },
- { .key = "PBDs",
- .type = &abstract_type_ref_set,
- .offset = offsetof(xen_host_record, pbds) },
- { .key = "host_CPUs",
- .type = &abstract_type_ref_set,
- .offset = offsetof(xen_host_record, host_cpus) },
- { .key = "metrics",
- .type = &abstract_type_ref,
- .offset = offsetof(xen_host_record, metrics) },
- { .key = "resident_cpu_pools",
- .type = &abstract_type_ref_set,
- .offset = offsetof(xen_host_record, resident_cpu_pools) }
- };
-
-const abstract_type xen_host_record_abstract_type_ =
- {
- .typename = STRUCT,
- .struct_size = sizeof(xen_host_record),
- .member_count =
- sizeof(xen_host_record_struct_members) / sizeof(struct_member),
- .members = xen_host_record_struct_members
- };
-
-
-void
-xen_host_record_free(xen_host_record *record)
-{
- if (record == NULL)
- {
- return;
- }
- free(record->handle);
- free(record->uuid);
- free(record->name_label);
- free(record->name_description);
- free(record->api_version_vendor);
- xen_string_string_map_free(record->api_version_vendor_implementation);
- xen_string_string_map_free(record->software_version);
- xen_string_string_map_free(record->other_config);
- xen_string_set_free(record->capabilities);
- xen_string_string_map_free(record->cpu_configuration);
- free(record->sched_policy);
- xen_string_set_free(record->supported_bootloaders);
- xen_vm_record_opt_set_free(record->resident_vms);
- xen_string_string_map_free(record->logging);
- xen_pif_record_opt_set_free(record->pifs);
- xen_sr_record_opt_free(record->suspend_image_sr);
- xen_sr_record_opt_free(record->crash_dump_sr);
- xen_pbd_record_opt_set_free(record->pbds);
- xen_host_cpu_record_opt_set_free(record->host_cpus);
- xen_host_metrics_record_opt_free(record->metrics);
- xen_cpu_pool_record_opt_set_free(record->resident_cpu_pools);
- free(record);
-}
-
-
-bool
-xen_host_get_record(xen_session *session, xen_host_record **result, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- abstract_type result_type = xen_host_record_abstract_type_;
-
- *result = NULL;
- XEN_CALL_("host.get_record");
-
- if (session->ok)
- {
- (*result)->handle = xen_strdup_((*result)->uuid);
- }
-
- return session->ok;
-}
-
-
-bool
-xen_host_get_by_uuid(xen_session *session, xen_host *result, char *uuid)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = uuid }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("host.get_by_uuid");
- return session->ok;
-}
-
-
-bool
-xen_host_get_by_name_label(xen_session *session, struct xen_host_set **result, char *label)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = label }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("host.get_by_name_label");
- return session->ok;
-}
-
-
-bool
-xen_host_get_name_label(xen_session *session, char **result, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("host.get_name_label");
- return session->ok;
-}
-
-
-bool
-xen_host_get_name_description(xen_session *session, char **result, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("host.get_name_description");
- return session->ok;
-}
-
-
-bool
-xen_host_get_api_version_major(xen_session *session, int64_t *result, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- abstract_type result_type = abstract_type_int;
-
- XEN_CALL_("host.get_API_version_major");
- return session->ok;
-}
-
-
-bool
-xen_host_get_api_version_minor(xen_session *session, int64_t *result, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- abstract_type result_type = abstract_type_int;
-
- XEN_CALL_("host.get_API_version_minor");
- return session->ok;
-}
-
-
-bool
-xen_host_get_api_version_vendor(xen_session *session, char **result, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("host.get_API_version_vendor");
- return session->ok;
-}
-
-
-bool
-xen_host_get_api_version_vendor_implementation(xen_session *session, xen_string_string_map **result, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- abstract_type result_type = abstract_type_string_string_map;
-
- *result = NULL;
- XEN_CALL_("host.get_API_version_vendor_implementation");
- return session->ok;
-}
-
-
-bool
-xen_host_get_enabled(xen_session *session, bool *result, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- abstract_type result_type = abstract_type_bool;
-
- XEN_CALL_("host.get_enabled");
- return session->ok;
-}
-
-
-bool
-xen_host_get_software_version(xen_session *session, xen_string_string_map **result, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- abstract_type result_type = abstract_type_string_string_map;
-
- *result = NULL;
- XEN_CALL_("host.get_software_version");
- return session->ok;
-}
-
-
-bool
-xen_host_get_other_config(xen_session *session, xen_string_string_map **result, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- abstract_type result_type = abstract_type_string_string_map;
-
- *result = NULL;
- XEN_CALL_("host.get_other_config");
- return session->ok;
-}
-
-
-bool
-xen_host_get_capabilities(xen_session *session, struct xen_string_set **result, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("host.get_capabilities");
- return session->ok;
-}
-
-
-bool
-xen_host_get_cpu_configuration(xen_session *session, xen_string_string_map **result, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- abstract_type result_type = abstract_type_string_string_map;
-
- *result = NULL;
- XEN_CALL_("host.get_cpu_configuration");
- return session->ok;
-}
-
-
-bool
-xen_host_get_sched_policy(xen_session *session, char **result, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("host.get_sched_policy");
- return session->ok;
-}
-
-
-bool
-xen_host_get_supported_bootloaders(xen_session *session, struct xen_string_set **result, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("host.get_supported_bootloaders");
- return session->ok;
-}
-
-
-bool
-xen_host_get_resident_vms(xen_session *session, struct xen_vm_set **result, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("host.get_resident_VMs");
- return session->ok;
-}
-
-
-bool
-xen_host_get_logging(xen_session *session, xen_string_string_map **result, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- abstract_type result_type = abstract_type_string_string_map;
-
- *result = NULL;
- XEN_CALL_("host.get_logging");
- return session->ok;
-}
-
-
-bool
-xen_host_get_pifs(xen_session *session, struct xen_pif_set **result, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("host.get_PIFs");
- return session->ok;
-}
-
-
-bool
-xen_host_get_suspend_image_sr(xen_session *session, xen_sr *result, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("host.get_suspend_image_sr");
- return session->ok;
-}
-
-
-bool
-xen_host_get_crash_dump_sr(xen_session *session, xen_sr *result, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("host.get_crash_dump_sr");
- return session->ok;
-}
-
-
-bool
-xen_host_get_pbds(xen_session *session, struct xen_pbd_set **result, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("host.get_PBDs");
- return session->ok;
-}
-
-
-bool
-xen_host_get_host_cpus(xen_session *session, struct xen_host_cpu_set **result, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("host.get_host_CPUs");
- return session->ok;
-}
-
-
-bool
-xen_host_get_metrics(xen_session *session, xen_host_metrics *result, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("host.get_metrics");
- return session->ok;
-}
-
-
-bool
-xen_host_set_name_label(xen_session *session, xen_host host, char *label)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host },
- { .type = &abstract_type_string,
- .u.string_val = label }
- };
-
- xen_call_(session, "host.set_name_label", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_host_set_name_description(xen_session *session, xen_host host, char *description)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host },
- { .type = &abstract_type_string,
- .u.string_val = description }
- };
-
- xen_call_(session, "host.set_name_description", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_host_set_other_config(xen_session *session, xen_host host, xen_string_string_map *other_config)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host },
- { .type = &abstract_type_string_string_map,
- .u.set_val = (arbitrary_set *)other_config }
- };
-
- xen_call_(session, "host.set_other_config", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_host_add_to_other_config(xen_session *session, xen_host host, char *key, char *value)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host },
- { .type = &abstract_type_string,
- .u.string_val = key },
- { .type = &abstract_type_string,
- .u.string_val = value }
- };
-
- xen_call_(session, "host.add_to_other_config", param_values, 3, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_host_remove_from_other_config(xen_session *session, xen_host host, char *key)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host },
- { .type = &abstract_type_string,
- .u.string_val = key }
- };
-
- xen_call_(session, "host.remove_from_other_config", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_host_set_logging(xen_session *session, xen_host host, xen_string_string_map *logging)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host },
- { .type = &abstract_type_string_string_map,
- .u.set_val = (arbitrary_set *)logging }
- };
-
- xen_call_(session, "host.set_logging", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_host_add_to_logging(xen_session *session, xen_host host, char *key, char *value)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host },
- { .type = &abstract_type_string,
- .u.string_val = key },
- { .type = &abstract_type_string,
- .u.string_val = value }
- };
-
- xen_call_(session, "host.add_to_logging", param_values, 3, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_host_remove_from_logging(xen_session *session, xen_host host, char *key)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host },
- { .type = &abstract_type_string,
- .u.string_val = key }
- };
-
- xen_call_(session, "host.remove_from_logging", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_host_set_suspend_image_sr(xen_session *session, xen_host host, xen_sr suspend_image_sr)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host },
- { .type = &abstract_type_string,
- .u.string_val = suspend_image_sr }
- };
-
- xen_call_(session, "host.set_suspend_image_sr", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_host_set_crash_dump_sr(xen_session *session, xen_host host, xen_sr crash_dump_sr)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host },
- { .type = &abstract_type_string,
- .u.string_val = crash_dump_sr }
- };
-
- xen_call_(session, "host.set_crash_dump_sr", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_host_disable(xen_session *session, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- xen_call_(session, "host.disable", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_host_enable(xen_session *session, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- xen_call_(session, "host.enable", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_host_shutdown(xen_session *session, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- xen_call_(session, "host.shutdown", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_host_reboot(xen_session *session, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- xen_call_(session, "host.reboot", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_host_dmesg(xen_session *session, char **result, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("host.dmesg");
- return session->ok;
-}
-
-
-bool
-xen_host_dmesg_clear(xen_session *session, char **result, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("host.dmesg_clear");
- return session->ok;
-}
-
-
-bool
-xen_host_get_log(xen_session *session, char **result, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("host.get_log");
- return session->ok;
-}
-
-
-bool
-xen_host_send_debug_keys(xen_session *session, xen_host host, char *keys)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host },
- { .type = &abstract_type_string,
- .u.string_val = keys }
- };
-
- xen_call_(session, "host.send_debug_keys", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_host_list_methods(xen_session *session, struct xen_string_set **result)
-{
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- xen_call_(session, "host.list_methods", NULL, 0, &result_type, result);
- return session->ok;
-}
-
-
-bool
-xen_host_get_all(xen_session *session, struct xen_host_set **result)
-{
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- xen_call_(session, "host.get_all", NULL, 0, &result_type, result);
- return session->ok;
-}
-
-
-bool
-xen_host_get_uuid(xen_session *session, char **result, xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("host.get_uuid");
- return session->ok;
-}
-
-
-bool
-xen_host_get_resident_cpu_pools(xen_session *session, struct xen_cpu_pool_set **result,
- xen_host host)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("host.get_resident_cpu_pools");
- return session->ok;
-}
-
+++ /dev/null
-/*
- * 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
- */
-
-
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "xen_internal.h"
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_host.h>
-#include <xen/api/xen_host_cpu.h>
-#include <xen/api/xen_cpu_pool.h>
-
-
-XEN_FREE(xen_host_cpu)
-XEN_SET_ALLOC_FREE(xen_host_cpu)
-XEN_ALLOC(xen_host_cpu_record)
-XEN_SET_ALLOC_FREE(xen_host_cpu_record)
-XEN_ALLOC(xen_host_cpu_record_opt)
-XEN_RECORD_OPT_FREE(xen_host_cpu)
-XEN_SET_ALLOC_FREE(xen_host_cpu_record_opt)
-
-
-static const struct_member xen_host_cpu_record_struct_members[] =
- {
- { .key = "uuid",
- .type = &abstract_type_string,
- .offset = offsetof(xen_host_cpu_record, uuid) },
- { .key = "host",
- .type = &abstract_type_ref,
- .offset = offsetof(xen_host_cpu_record, host) },
- { .key = "number",
- .type = &abstract_type_int,
- .offset = offsetof(xen_host_cpu_record, number) },
- { .key = "vendor",
- .type = &abstract_type_string,
- .offset = offsetof(xen_host_cpu_record, vendor) },
- { .key = "speed",
- .type = &abstract_type_int,
- .offset = offsetof(xen_host_cpu_record, speed) },
- { .key = "modelname",
- .type = &abstract_type_string,
- .offset = offsetof(xen_host_cpu_record, modelname) },
- { .key = "stepping",
- .type = &abstract_type_string,
- .offset = offsetof(xen_host_cpu_record, stepping) },
- { .key = "flags",
- .type = &abstract_type_string,
- .offset = offsetof(xen_host_cpu_record, flags) },
- { .key = "features",
- .type = &abstract_type_string,
- .offset = offsetof(xen_host_cpu_record, features) },
- { .key = "utilisation",
- .type = &abstract_type_float,
- .offset = offsetof(xen_host_cpu_record, utilisation) },
- { .key = "cpu_pool",
- .type = &abstract_type_ref_set,
- .offset = offsetof(xen_host_cpu_record, cpu_pools) },
- };
-
-const abstract_type xen_host_cpu_record_abstract_type_ =
- {
- .typename = STRUCT,
- .struct_size = sizeof(xen_host_cpu_record),
- .member_count =
- sizeof(xen_host_cpu_record_struct_members) / sizeof(struct_member),
- .members = xen_host_cpu_record_struct_members
- };
-
-
-void
-xen_host_cpu_record_free(xen_host_cpu_record *record)
-{
- if (record == NULL)
- {
- return;
- }
- free(record->handle);
- free(record->uuid);
- xen_host_record_opt_free(record->host);
- free(record->vendor);
- free(record->modelname);
- free(record->stepping);
- free(record->flags);
- free(record->features);
- xen_cpu_pool_record_opt_set_free(record->cpu_pools);
- free(record);
-}
-
-
-bool
-xen_host_cpu_get_record(xen_session *session, xen_host_cpu_record **result, xen_host_cpu host_cpu)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host_cpu }
- };
-
- abstract_type result_type = xen_host_cpu_record_abstract_type_;
-
- *result = NULL;
- XEN_CALL_("host_cpu.get_record");
-
- if (session->ok)
- {
- (*result)->handle = xen_strdup_((*result)->uuid);
- }
-
- return session->ok;
-}
-
-
-bool
-xen_host_cpu_get_by_uuid(xen_session *session, xen_host_cpu *result, char *uuid)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = uuid }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("host_cpu.get_by_uuid");
- return session->ok;
-}
-
-
-bool
-xen_host_cpu_get_host(xen_session *session, xen_host *result, xen_host_cpu host_cpu)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host_cpu }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("host_cpu.get_host");
- return session->ok;
-}
-
-
-bool
-xen_host_cpu_get_number(xen_session *session, int64_t *result, xen_host_cpu host_cpu)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host_cpu }
- };
-
- abstract_type result_type = abstract_type_int;
-
- XEN_CALL_("host_cpu.get_number");
- return session->ok;
-}
-
-
-bool
-xen_host_cpu_get_vendor(xen_session *session, char **result, xen_host_cpu host_cpu)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host_cpu }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("host_cpu.get_vendor");
- return session->ok;
-}
-
-
-bool
-xen_host_cpu_get_speed(xen_session *session, int64_t *result, xen_host_cpu host_cpu)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host_cpu }
- };
-
- abstract_type result_type = abstract_type_int;
-
- XEN_CALL_("host_cpu.get_speed");
- return session->ok;
-}
-
-
-bool
-xen_host_cpu_get_modelname(xen_session *session, char **result, xen_host_cpu host_cpu)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host_cpu }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("host_cpu.get_modelname");
- return session->ok;
-}
-
-
-bool
-xen_host_cpu_get_stepping(xen_session *session, char **result, xen_host_cpu host_cpu)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host_cpu }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("host_cpu.get_stepping");
- return session->ok;
-}
-
-
-bool
-xen_host_cpu_get_flags(xen_session *session, char **result, xen_host_cpu host_cpu)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host_cpu }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("host_cpu.get_flags");
- return session->ok;
-}
-
-
-bool
-xen_host_cpu_get_features(xen_session *session, char **result, xen_host_cpu host_cpu)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host_cpu }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("host_cpu.get_features");
- return session->ok;
-}
-
-
-bool
-xen_host_cpu_get_utilisation(xen_session *session, double *result, xen_host_cpu host_cpu)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host_cpu }
- };
-
- abstract_type result_type = abstract_type_float;
-
- XEN_CALL_("host_cpu.get_utilisation");
- return session->ok;
-}
-
-
-bool
-xen_host_cpu_get_all(xen_session *session, struct xen_host_cpu_set **result)
-{
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- xen_call_(session, "host_cpu.get_all", NULL, 0, &result_type, result);
- return session->ok;
-}
-
-
-bool
-xen_host_cpu_get_uuid(xen_session *session, char **result, xen_host_cpu host_cpu)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host_cpu }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("host_cpu.get_uuid");
- return session->ok;
-}
-
-
-bool
-xen_host_cpu_get_cpu_pool(xen_session *session, struct xen_cpu_pool_set **result, xen_host_cpu host_cpu)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host_cpu }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("host_cpu.get_cpu_pool");
- return session->ok;
-}
-
-
-bool
-xen_host_cpu_get_unassigned_cpus(xen_session *session, struct xen_host_cpu_set **result)
-{
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- xen_call_(session, "host_cpu.get_unassigned_cpus", NULL, 0, &result_type, result);
- return session->ok;
-}
-
-
-
+++ /dev/null
-/*
- * 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
- */
-
-
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "xen_internal.h"
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_host_metrics.h>
-
-
-XEN_FREE(xen_host_metrics)
-XEN_SET_ALLOC_FREE(xen_host_metrics)
-XEN_ALLOC(xen_host_metrics_record)
-XEN_SET_ALLOC_FREE(xen_host_metrics_record)
-XEN_ALLOC(xen_host_metrics_record_opt)
-XEN_RECORD_OPT_FREE(xen_host_metrics)
-XEN_SET_ALLOC_FREE(xen_host_metrics_record_opt)
-
-
-static const struct_member xen_host_metrics_record_struct_members[] =
- {
- { .key = "uuid",
- .type = &abstract_type_string,
- .offset = offsetof(xen_host_metrics_record, uuid) },
- { .key = "memory_total",
- .type = &abstract_type_int,
- .offset = offsetof(xen_host_metrics_record, memory_total) },
- { .key = "memory_free",
- .type = &abstract_type_int,
- .offset = offsetof(xen_host_metrics_record, memory_free) },
- { .key = "last_updated",
- .type = &abstract_type_datetime,
- .offset = offsetof(xen_host_metrics_record, last_updated) }
- };
-
-const abstract_type xen_host_metrics_record_abstract_type_ =
- {
- .typename = STRUCT,
- .struct_size = sizeof(xen_host_metrics_record),
- .member_count =
- sizeof(xen_host_metrics_record_struct_members) / sizeof(struct_member),
- .members = xen_host_metrics_record_struct_members
- };
-
-
-void
-xen_host_metrics_record_free(xen_host_metrics_record *record)
-{
- if (record == NULL)
- {
- return;
- }
- free(record->handle);
- free(record->uuid);
- free(record);
-}
-
-
-bool
-xen_host_metrics_get_record(xen_session *session, xen_host_metrics_record **result, xen_host_metrics host_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host_metrics }
- };
-
- abstract_type result_type = xen_host_metrics_record_abstract_type_;
-
- *result = NULL;
- XEN_CALL_("host_metrics.get_record");
-
- if (session->ok)
- {
- (*result)->handle = xen_strdup_((*result)->uuid);
- }
-
- return session->ok;
-}
-
-
-bool
-xen_host_metrics_get_by_uuid(xen_session *session, xen_host_metrics *result, char *uuid)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = uuid }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("host_metrics.get_by_uuid");
- return session->ok;
-}
-
-
-bool
-xen_host_metrics_get_memory_total(xen_session *session, int64_t *result, xen_host_metrics host_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host_metrics }
- };
-
- abstract_type result_type = abstract_type_int;
-
- XEN_CALL_("host_metrics.get_memory_total");
- return session->ok;
-}
-
-
-bool
-xen_host_metrics_get_memory_free(xen_session *session, int64_t *result, xen_host_metrics host_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host_metrics }
- };
-
- abstract_type result_type = abstract_type_int;
-
- XEN_CALL_("host_metrics.get_memory_free");
- return session->ok;
-}
-
-
-bool
-xen_host_metrics_get_last_updated(xen_session *session, time_t *result, xen_host_metrics host_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host_metrics }
- };
-
- abstract_type result_type = abstract_type_datetime;
-
- XEN_CALL_("host_metrics.get_last_updated");
- return session->ok;
-}
-
-
-bool
-xen_host_metrics_get_all(xen_session *session, struct xen_host_metrics_set **result)
-{
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- xen_call_(session, "host_metrics.get_all", NULL, 0, &result_type, result);
- return session->ok;
-}
-
-
-bool
-xen_host_metrics_get_uuid(xen_session *session, char **result, xen_host_metrics host_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = host_metrics }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("host_metrics.get_uuid");
- return session->ok;
-}
+++ /dev/null
-/*
- * 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
- */
-
-
-#include "xen_internal.h"
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_int_float_map.h>
-
-
-xen_int_float_map *
-xen_int_float_map_alloc(size_t size)
-{
- xen_int_float_map *result = calloc(1, sizeof(xen_int_float_map) +
- size * sizeof(struct xen_int_float_map_contents));
- result->size = size;
- return result;
-}
-
-
-void
-xen_int_float_map_free(xen_int_float_map *map)
-{
- free(map);
-}
+++ /dev/null
-/*
- * 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
- */
-
-
-#include "xen_internal.h"
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_int_int_map.h>
-
-
-xen_int_int_map *
-xen_int_int_map_alloc(size_t size)
-{
- xen_int_int_map *result = calloc(1, sizeof(xen_int_int_map) +
- size * sizeof(struct xen_int_int_map_contents));
- result->size = size;
- return result;
-}
-
-
-void
-xen_int_int_map_free(xen_int_int_map *map)
-{
- free(map);
-}
+++ /dev/null
-/*
- * 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
- */
-
-
-#include "xen_internal.h"
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_int_string_set_map.h>
-#include <xen/api/xen_string_set.h>
-
-
-xen_int_string_set_map *
-xen_int_string_set_map_alloc(size_t size)
-{
- xen_int_string_set_map *result = calloc(1, sizeof(xen_int_string_set_map) +
- size * sizeof(struct xen_int_string_set_map_contents));
- result->size = size;
- return result;
-}
-
-
-void
-xen_int_string_set_map_free(xen_int_string_set_map *map)
-{
- size_t n;
-
- if (map == NULL)
- {
- return;
- }
-
- n = map->size;
- for (size_t i = 0; i < n; i++)
- {
-
- xen_string_set_free(map->contents[i].val);
- }
-
- free(map);
-}
+++ /dev/null
-/*
- * 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
- */
-
-
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "xen_internal.h"
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_network.h>
-#include <xen/api/xen_pif.h>
-#include <xen/api/xen_string_string_map.h>
-#include <xen/api/xen_vif.h>
-
-
-XEN_FREE(xen_network)
-XEN_SET_ALLOC_FREE(xen_network)
-XEN_ALLOC(xen_network_record)
-XEN_SET_ALLOC_FREE(xen_network_record)
-XEN_ALLOC(xen_network_record_opt)
-XEN_RECORD_OPT_FREE(xen_network)
-XEN_SET_ALLOC_FREE(xen_network_record_opt)
-
-
-static const struct_member xen_network_record_struct_members[] =
- {
- { .key = "uuid",
- .type = &abstract_type_string,
- .offset = offsetof(xen_network_record, uuid) },
- { .key = "name_label",
- .type = &abstract_type_string,
- .offset = offsetof(xen_network_record, name_label) },
- { .key = "name_description",
- .type = &abstract_type_string,
- .offset = offsetof(xen_network_record, name_description) },
- { .key = "VIFs",
- .type = &abstract_type_ref_set,
- .offset = offsetof(xen_network_record, vifs) },
- { .key = "PIFs",
- .type = &abstract_type_ref_set,
- .offset = offsetof(xen_network_record, pifs) },
- { .key = "other_config",
- .type = &abstract_type_string_string_map,
- .offset = offsetof(xen_network_record, other_config) }
- };
-
-const abstract_type xen_network_record_abstract_type_ =
- {
- .typename = STRUCT,
- .struct_size = sizeof(xen_network_record),
- .member_count =
- sizeof(xen_network_record_struct_members) / sizeof(struct_member),
- .members = xen_network_record_struct_members
- };
-
-
-void
-xen_network_record_free(xen_network_record *record)
-{
- if (record == NULL)
- {
- return;
- }
- free(record->handle);
- free(record->uuid);
- free(record->name_label);
- free(record->name_description);
- xen_vif_record_opt_set_free(record->vifs);
- xen_pif_record_opt_set_free(record->pifs);
- xen_string_string_map_free(record->other_config);
- free(record);
-}
-
-
-bool
-xen_network_get_record(xen_session *session, xen_network_record **result, xen_network network)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = network }
- };
-
- abstract_type result_type = xen_network_record_abstract_type_;
-
- *result = NULL;
- XEN_CALL_("network.get_record");
-
- if (session->ok)
- {
- (*result)->handle = xen_strdup_((*result)->uuid);
- }
-
- return session->ok;
-}
-
-
-bool
-xen_network_get_by_uuid(xen_session *session, xen_network *result, char *uuid)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = uuid }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("network.get_by_uuid");
- return session->ok;
-}
-
-
-bool
-xen_network_create(xen_session *session, xen_network *result, xen_network_record *record)
-{
- abstract_value param_values[] =
- {
- { .type = &xen_network_record_abstract_type_,
- .u.struct_val = record }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("network.create");
- return session->ok;
-}
-
-
-bool
-xen_network_destroy(xen_session *session, xen_network network)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = network }
- };
-
- xen_call_(session, "network.destroy", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_network_get_by_name_label(xen_session *session, struct xen_network_set **result, char *label)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = label }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("network.get_by_name_label");
- return session->ok;
-}
-
-
-bool
-xen_network_get_name_label(xen_session *session, char **result, xen_network network)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = network }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("network.get_name_label");
- return session->ok;
-}
-
-
-bool
-xen_network_get_name_description(xen_session *session, char **result, xen_network network)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = network }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("network.get_name_description");
- return session->ok;
-}
-
-
-bool
-xen_network_get_vifs(xen_session *session, struct xen_vif_set **result, xen_network network)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = network }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("network.get_VIFs");
- return session->ok;
-}
-
-
-bool
-xen_network_get_pifs(xen_session *session, struct xen_pif_set **result, xen_network network)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = network }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("network.get_PIFs");
- return session->ok;
-}
-
-
-bool
-xen_network_get_other_config(xen_session *session, xen_string_string_map **result, xen_network network)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = network }
- };
-
- abstract_type result_type = abstract_type_string_string_map;
-
- *result = NULL;
- XEN_CALL_("network.get_other_config");
- return session->ok;
-}
-
-
-bool
-xen_network_set_name_label(xen_session *session, xen_network network, char *label)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = network },
- { .type = &abstract_type_string,
- .u.string_val = label }
- };
-
- xen_call_(session, "network.set_name_label", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_network_set_name_description(xen_session *session, xen_network network, char *description)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = network },
- { .type = &abstract_type_string,
- .u.string_val = description }
- };
-
- xen_call_(session, "network.set_name_description", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_network_set_other_config(xen_session *session, xen_network network, xen_string_string_map *other_config)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = network },
- { .type = &abstract_type_string_string_map,
- .u.set_val = (arbitrary_set *)other_config }
- };
-
- xen_call_(session, "network.set_other_config", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_network_add_to_other_config(xen_session *session, xen_network network, char *key, char *value)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = network },
- { .type = &abstract_type_string,
- .u.string_val = key },
- { .type = &abstract_type_string,
- .u.string_val = value }
- };
-
- xen_call_(session, "network.add_to_other_config", param_values, 3, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_network_remove_from_other_config(xen_session *session, xen_network network, char *key)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = network },
- { .type = &abstract_type_string,
- .u.string_val = key }
- };
-
- xen_call_(session, "network.remove_from_other_config", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_network_get_all(xen_session *session, struct xen_network_set **result)
-{
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- xen_call_(session, "network.get_all", NULL, 0, &result_type, result);
- return session->ok;
-}
-
-
-bool
-xen_network_get_uuid(xen_session *session, char **result, xen_network network)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = network }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("network.get_uuid");
- return session->ok;
-}
+++ /dev/null
-/*
- * 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
- */
-
-#include <string.h>
-
-#include "xen_internal.h"
-#include <xen/api/xen_on_crash_behaviour.h>
-#include "xen_on_crash_behaviour_internal.h"
-
-
-/*
- * Maintain this in the same order as the enum declaration!
- */
-static const char *lookup_table[] =
-{
- "destroy",
- "coredump_and_destroy",
- "restart",
- "coredump_and_restart",
- "preserve",
- "rename_restart"
-};
-
-
-extern xen_on_crash_behaviour_set *
-xen_on_crash_behaviour_set_alloc(size_t size)
-{
- return calloc(1, sizeof(xen_on_crash_behaviour_set) +
- size * sizeof(enum xen_on_crash_behaviour));
-}
-
-
-extern void
-xen_on_crash_behaviour_set_free(xen_on_crash_behaviour_set *set)
-{
- free(set);
-}
-
-
-const char *
-xen_on_crash_behaviour_to_string(enum xen_on_crash_behaviour val)
-{
- return lookup_table[val];
-}
-
-
-extern enum xen_on_crash_behaviour
-xen_on_crash_behaviour_from_string(xen_session *session, const char *str)
-{
- return ENUM_LOOKUP(session, str, lookup_table);
-}
-
-
-const abstract_type xen_on_crash_behaviour_abstract_type_ =
- {
- .typename = ENUM,
- .enum_marshaller =
- (const char *(*)(int))&xen_on_crash_behaviour_to_string,
- .enum_demarshaller =
- (int (*)(xen_session *, const char *))&xen_on_crash_behaviour_from_string
- };
-
-
-const abstract_type xen_on_crash_behaviour_set_abstract_type_ =
- {
- .typename = SET,
- .child = &xen_on_crash_behaviour_abstract_type_
- };
-
-
+++ /dev/null
-/*
- * 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
- */
-
-#include <string.h>
-
-#include "xen_internal.h"
-#include <xen/api/xen_on_normal_exit.h>
-#include "xen_on_normal_exit_internal.h"
-
-
-/*
- * Maintain this in the same order as the enum declaration!
- */
-static const char *lookup_table[] =
-{
- "destroy",
- "restart"
-};
-
-
-extern xen_on_normal_exit_set *
-xen_on_normal_exit_set_alloc(size_t size)
-{
- return calloc(1, sizeof(xen_on_normal_exit_set) +
- size * sizeof(enum xen_on_normal_exit));
-}
-
-
-extern void
-xen_on_normal_exit_set_free(xen_on_normal_exit_set *set)
-{
- free(set);
-}
-
-
-const char *
-xen_on_normal_exit_to_string(enum xen_on_normal_exit val)
-{
- return lookup_table[val];
-}
-
-
-extern enum xen_on_normal_exit
-xen_on_normal_exit_from_string(xen_session *session, const char *str)
-{
- return ENUM_LOOKUP(session, str, lookup_table);
-}
-
-
-const abstract_type xen_on_normal_exit_abstract_type_ =
- {
- .typename = ENUM,
- .enum_marshaller =
- (const char *(*)(int))&xen_on_normal_exit_to_string,
- .enum_demarshaller =
- (int (*)(xen_session *, const char *))&xen_on_normal_exit_from_string
- };
-
-
-const abstract_type xen_on_normal_exit_set_abstract_type_ =
- {
- .typename = SET,
- .child = &xen_on_normal_exit_abstract_type_
- };
-
-
+++ /dev/null
-/*
- * 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
- */
-
-
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "xen_internal.h"
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_host.h>
-#include <xen/api/xen_pbd.h>
-#include <xen/api/xen_sr.h>
-#include <xen/api/xen_string_string_map.h>
-
-
-XEN_FREE(xen_pbd)
-XEN_SET_ALLOC_FREE(xen_pbd)
-XEN_ALLOC(xen_pbd_record)
-XEN_SET_ALLOC_FREE(xen_pbd_record)
-XEN_ALLOC(xen_pbd_record_opt)
-XEN_RECORD_OPT_FREE(xen_pbd)
-XEN_SET_ALLOC_FREE(xen_pbd_record_opt)
-
-
-static const struct_member xen_pbd_record_struct_members[] =
- {
- { .key = "uuid",
- .type = &abstract_type_string,
- .offset = offsetof(xen_pbd_record, uuid) },
- { .key = "host",
- .type = &abstract_type_ref,
- .offset = offsetof(xen_pbd_record, host) },
- { .key = "SR",
- .type = &abstract_type_ref,
- .offset = offsetof(xen_pbd_record, sr) },
- { .key = "device_config",
- .type = &abstract_type_string_string_map,
- .offset = offsetof(xen_pbd_record, device_config) },
- { .key = "currently_attached",
- .type = &abstract_type_bool,
- .offset = offsetof(xen_pbd_record, currently_attached) }
- };
-
-const abstract_type xen_pbd_record_abstract_type_ =
- {
- .typename = STRUCT,
- .struct_size = sizeof(xen_pbd_record),
- .member_count =
- sizeof(xen_pbd_record_struct_members) / sizeof(struct_member),
- .members = xen_pbd_record_struct_members
- };
-
-
-void
-xen_pbd_record_free(xen_pbd_record *record)
-{
- if (record == NULL)
- {
- return;
- }
- free(record->handle);
- free(record->uuid);
- xen_host_record_opt_free(record->host);
- xen_sr_record_opt_free(record->sr);
- xen_string_string_map_free(record->device_config);
- free(record);
-}
-
-
-bool
-xen_pbd_get_record(xen_session *session, xen_pbd_record **result, xen_pbd pbd)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = pbd }
- };
-
- abstract_type result_type = xen_pbd_record_abstract_type_;
-
- *result = NULL;
- XEN_CALL_("PBD.get_record");
-
- if (session->ok)
- {
- (*result)->handle = xen_strdup_((*result)->uuid);
- }
-
- return session->ok;
-}
-
-
-bool
-xen_pbd_get_by_uuid(xen_session *session, xen_pbd *result, char *uuid)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = uuid }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("PBD.get_by_uuid");
- return session->ok;
-}
-
-
-bool
-xen_pbd_create(xen_session *session, xen_pbd *result, xen_pbd_record *record)
-{
- abstract_value param_values[] =
- {
- { .type = &xen_pbd_record_abstract_type_,
- .u.struct_val = record }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("PBD.create");
- return session->ok;
-}
-
-
-bool
-xen_pbd_destroy(xen_session *session, xen_pbd pbd)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = pbd }
- };
-
- xen_call_(session, "PBD.destroy", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_pbd_get_host(xen_session *session, xen_host *result, xen_pbd pbd)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = pbd }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("PBD.get_host");
- return session->ok;
-}
-
-
-bool
-xen_pbd_get_sr(xen_session *session, xen_sr *result, xen_pbd pbd)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = pbd }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("PBD.get_SR");
- return session->ok;
-}
-
-
-bool
-xen_pbd_get_device_config(xen_session *session, xen_string_string_map **result, xen_pbd pbd)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = pbd }
- };
-
- abstract_type result_type = abstract_type_string_string_map;
-
- *result = NULL;
- XEN_CALL_("PBD.get_device_config");
- return session->ok;
-}
-
-
-bool
-xen_pbd_get_currently_attached(xen_session *session, bool *result, xen_pbd pbd)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = pbd }
- };
-
- abstract_type result_type = abstract_type_bool;
-
- XEN_CALL_("PBD.get_currently_attached");
- return session->ok;
-}
-
-
-bool
-xen_pbd_get_all(xen_session *session, struct xen_pbd_set **result)
-{
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- xen_call_(session, "PBD.get_all", NULL, 0, &result_type, result);
- return session->ok;
-}
-
-
-bool
-xen_pbd_get_uuid(xen_session *session, char **result, xen_pbd pbd)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = pbd }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("PBD.get_uuid");
- return session->ok;
-}
+++ /dev/null
-/*
- * 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
- */
-
-
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "xen_internal.h"
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_host.h>
-#include <xen/api/xen_network.h>
-#include <xen/api/xen_pif.h>
-#include <xen/api/xen_pif_metrics.h>
-
-
-XEN_FREE(xen_pif)
-XEN_SET_ALLOC_FREE(xen_pif)
-XEN_ALLOC(xen_pif_record)
-XEN_SET_ALLOC_FREE(xen_pif_record)
-XEN_ALLOC(xen_pif_record_opt)
-XEN_RECORD_OPT_FREE(xen_pif)
-XEN_SET_ALLOC_FREE(xen_pif_record_opt)
-
-
-static const struct_member xen_pif_record_struct_members[] =
- {
- { .key = "uuid",
- .type = &abstract_type_string,
- .offset = offsetof(xen_pif_record, uuid) },
- { .key = "device",
- .type = &abstract_type_string,
- .offset = offsetof(xen_pif_record, device) },
- { .key = "network",
- .type = &abstract_type_ref,
- .offset = offsetof(xen_pif_record, network) },
- { .key = "host",
- .type = &abstract_type_ref,
- .offset = offsetof(xen_pif_record, host) },
- { .key = "MAC",
- .type = &abstract_type_string,
- .offset = offsetof(xen_pif_record, mac) },
- { .key = "MTU",
- .type = &abstract_type_int,
- .offset = offsetof(xen_pif_record, mtu) },
- { .key = "VLAN",
- .type = &abstract_type_int,
- .offset = offsetof(xen_pif_record, vlan) },
- { .key = "metrics",
- .type = &abstract_type_ref,
- .offset = offsetof(xen_pif_record, metrics) }
- };
-
-const abstract_type xen_pif_record_abstract_type_ =
- {
- .typename = STRUCT,
- .struct_size = sizeof(xen_pif_record),
- .member_count =
- sizeof(xen_pif_record_struct_members) / sizeof(struct_member),
- .members = xen_pif_record_struct_members
- };
-
-
-void
-xen_pif_record_free(xen_pif_record *record)
-{
- if (record == NULL)
- {
- return;
- }
- free(record->handle);
- free(record->uuid);
- free(record->device);
- xen_network_record_opt_free(record->network);
- xen_host_record_opt_free(record->host);
- free(record->mac);
- xen_pif_metrics_record_opt_free(record->metrics);
- free(record);
-}
-
-
-bool
-xen_pif_get_record(xen_session *session, xen_pif_record **result, xen_pif pif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = pif }
- };
-
- abstract_type result_type = xen_pif_record_abstract_type_;
-
- *result = NULL;
- XEN_CALL_("PIF.get_record");
-
- if (session->ok)
- {
- (*result)->handle = xen_strdup_((*result)->uuid);
- }
-
- return session->ok;
-}
-
-
-bool
-xen_pif_get_by_uuid(xen_session *session, xen_pif *result, char *uuid)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = uuid }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("PIF.get_by_uuid");
- return session->ok;
-}
-
-
-bool
-xen_pif_get_device(xen_session *session, char **result, xen_pif pif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = pif }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("PIF.get_device");
- return session->ok;
-}
-
-
-bool
-xen_pif_get_network(xen_session *session, xen_network *result, xen_pif pif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = pif }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("PIF.get_network");
- return session->ok;
-}
-
-
-bool
-xen_pif_get_host(xen_session *session, xen_host *result, xen_pif pif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = pif }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("PIF.get_host");
- return session->ok;
-}
-
-
-bool
-xen_pif_get_mac(xen_session *session, char **result, xen_pif pif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = pif }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("PIF.get_MAC");
- return session->ok;
-}
-
-
-bool
-xen_pif_get_mtu(xen_session *session, int64_t *result, xen_pif pif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = pif }
- };
-
- abstract_type result_type = abstract_type_int;
-
- XEN_CALL_("PIF.get_MTU");
- return session->ok;
-}
-
-
-bool
-xen_pif_get_vlan(xen_session *session, int64_t *result, xen_pif pif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = pif }
- };
-
- abstract_type result_type = abstract_type_int;
-
- XEN_CALL_("PIF.get_VLAN");
- return session->ok;
-}
-
-
-bool
-xen_pif_get_metrics(xen_session *session, xen_pif_metrics *result, xen_pif pif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = pif }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("PIF.get_metrics");
- return session->ok;
-}
-
-
-bool
-xen_pif_set_device(xen_session *session, xen_pif pif, char *device)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = pif },
- { .type = &abstract_type_string,
- .u.string_val = device }
- };
-
- xen_call_(session, "PIF.set_device", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_pif_set_mac(xen_session *session, xen_pif pif, char *mac)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = pif },
- { .type = &abstract_type_string,
- .u.string_val = mac }
- };
-
- xen_call_(session, "PIF.set_MAC", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_pif_set_mtu(xen_session *session, xen_pif pif, int64_t mtu)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = pif },
- { .type = &abstract_type_int,
- .u.int_val = mtu }
- };
-
- xen_call_(session, "PIF.set_MTU", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_pif_set_vlan(xen_session *session, xen_pif pif, int64_t vlan)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = pif },
- { .type = &abstract_type_int,
- .u.int_val = vlan }
- };
-
- xen_call_(session, "PIF.set_VLAN", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_pif_create_vlan(xen_session *session, xen_pif *result, char *device, xen_network network, xen_host host, int64_t vlan)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = device },
- { .type = &abstract_type_string,
- .u.string_val = network },
- { .type = &abstract_type_string,
- .u.string_val = host },
- { .type = &abstract_type_int,
- .u.int_val = vlan }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("PIF.create_VLAN");
- return session->ok;
-}
-
-
-bool
-xen_pif_destroy(xen_session *session, xen_pif self)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = self }
- };
-
- xen_call_(session, "PIF.destroy", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_pif_get_all(xen_session *session, struct xen_pif_set **result)
-{
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- xen_call_(session, "PIF.get_all", NULL, 0, &result_type, result);
- return session->ok;
-}
-
-
-bool
-xen_pif_get_uuid(xen_session *session, char **result, xen_pif pif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = pif }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("PIF.get_uuid");
- return session->ok;
-}
+++ /dev/null
-/*
- * 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
- */
-
-
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "xen_internal.h"
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_pif_metrics.h>
-
-
-XEN_FREE(xen_pif_metrics)
-XEN_SET_ALLOC_FREE(xen_pif_metrics)
-XEN_ALLOC(xen_pif_metrics_record)
-XEN_SET_ALLOC_FREE(xen_pif_metrics_record)
-XEN_ALLOC(xen_pif_metrics_record_opt)
-XEN_RECORD_OPT_FREE(xen_pif_metrics)
-XEN_SET_ALLOC_FREE(xen_pif_metrics_record_opt)
-
-
-static const struct_member xen_pif_metrics_record_struct_members[] =
- {
- { .key = "uuid",
- .type = &abstract_type_string,
- .offset = offsetof(xen_pif_metrics_record, uuid) },
- { .key = "io_read_kbs",
- .type = &abstract_type_float,
- .offset = offsetof(xen_pif_metrics_record, io_read_kbs) },
- { .key = "io_write_kbs",
- .type = &abstract_type_float,
- .offset = offsetof(xen_pif_metrics_record, io_write_kbs) },
- { .key = "last_updated",
- .type = &abstract_type_datetime,
- .offset = offsetof(xen_pif_metrics_record, last_updated) }
- };
-
-const abstract_type xen_pif_metrics_record_abstract_type_ =
- {
- .typename = STRUCT,
- .struct_size = sizeof(xen_pif_metrics_record),
- .member_count =
- sizeof(xen_pif_metrics_record_struct_members) / sizeof(struct_member),
- .members = xen_pif_metrics_record_struct_members
- };
-
-
-void
-xen_pif_metrics_record_free(xen_pif_metrics_record *record)
-{
- if (record == NULL)
- {
- return;
- }
- free(record->handle);
- free(record->uuid);
- free(record);
-}
-
-
-bool
-xen_pif_metrics_get_record(xen_session *session, xen_pif_metrics_record **result, xen_pif_metrics pif_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = pif_metrics }
- };
-
- abstract_type result_type = xen_pif_metrics_record_abstract_type_;
-
- *result = NULL;
- XEN_CALL_("PIF_metrics.get_record");
-
- if (session->ok)
- {
- (*result)->handle = xen_strdup_((*result)->uuid);
- }
-
- return session->ok;
-}
-
-
-bool
-xen_pif_metrics_get_by_uuid(xen_session *session, xen_pif_metrics *result, char *uuid)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = uuid }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("PIF_metrics.get_by_uuid");
- return session->ok;
-}
-
-
-bool
-xen_pif_metrics_get_io_read_kbs(xen_session *session, double *result, xen_pif_metrics pif_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = pif_metrics }
- };
-
- abstract_type result_type = abstract_type_float;
-
- XEN_CALL_("PIF_metrics.get_io_read_kbs");
- return session->ok;
-}
-
-
-bool
-xen_pif_metrics_get_io_write_kbs(xen_session *session, double *result, xen_pif_metrics pif_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = pif_metrics }
- };
-
- abstract_type result_type = abstract_type_float;
-
- XEN_CALL_("PIF_metrics.get_io_write_kbs");
- return session->ok;
-}
-
-
-bool
-xen_pif_metrics_get_last_updated(xen_session *session, time_t *result, xen_pif_metrics pif_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = pif_metrics }
- };
-
- abstract_type result_type = abstract_type_datetime;
-
- XEN_CALL_("PIF_metrics.get_last_updated");
- return session->ok;
-}
-
-
-bool
-xen_pif_metrics_get_all(xen_session *session, struct xen_pif_metrics_set **result)
-{
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- xen_call_(session, "PIF_metrics.get_all", NULL, 0, &result_type, result);
- return session->ok;
-}
-
-
-bool
-xen_pif_metrics_get_uuid(xen_session *session, char **result, xen_pif_metrics pif_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = pif_metrics }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("PIF_metrics.get_uuid");
- return session->ok;
-}
+++ /dev/null
-/*
- * 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
- */
-
-
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "xen_internal.h"
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_pbd.h>
-#include <xen/api/xen_sr.h>
-#include <xen/api/xen_vdi.h>
-
-
-XEN_FREE(xen_sr)
-XEN_SET_ALLOC_FREE(xen_sr)
-XEN_ALLOC(xen_sr_record)
-XEN_SET_ALLOC_FREE(xen_sr_record)
-XEN_ALLOC(xen_sr_record_opt)
-XEN_RECORD_OPT_FREE(xen_sr)
-XEN_SET_ALLOC_FREE(xen_sr_record_opt)
-
-
-static const struct_member xen_sr_record_struct_members[] =
- {
- { .key = "uuid",
- .type = &abstract_type_string,
- .offset = offsetof(xen_sr_record, uuid) },
- { .key = "name_label",
- .type = &abstract_type_string,
- .offset = offsetof(xen_sr_record, name_label) },
- { .key = "name_description",
- .type = &abstract_type_string,
- .offset = offsetof(xen_sr_record, name_description) },
- { .key = "VDIs",
- .type = &abstract_type_ref_set,
- .offset = offsetof(xen_sr_record, vdis) },
- { .key = "PBDs",
- .type = &abstract_type_ref_set,
- .offset = offsetof(xen_sr_record, pbds) },
- { .key = "virtual_allocation",
- .type = &abstract_type_int,
- .offset = offsetof(xen_sr_record, virtual_allocation) },
- { .key = "physical_utilisation",
- .type = &abstract_type_int,
- .offset = offsetof(xen_sr_record, physical_utilisation) },
- { .key = "physical_size",
- .type = &abstract_type_int,
- .offset = offsetof(xen_sr_record, physical_size) },
- { .key = "type",
- .type = &abstract_type_string,
- .offset = offsetof(xen_sr_record, type) },
- { .key = "content_type",
- .type = &abstract_type_string,
- .offset = offsetof(xen_sr_record, content_type) }
- };
-
-const abstract_type xen_sr_record_abstract_type_ =
- {
- .typename = STRUCT,
- .struct_size = sizeof(xen_sr_record),
- .member_count =
- sizeof(xen_sr_record_struct_members) / sizeof(struct_member),
- .members = xen_sr_record_struct_members
- };
-
-
-void
-xen_sr_record_free(xen_sr_record *record)
-{
- if (record == NULL)
- {
- return;
- }
- free(record->handle);
- free(record->uuid);
- free(record->name_label);
- free(record->name_description);
- xen_vdi_record_opt_set_free(record->vdis);
- xen_pbd_record_opt_set_free(record->pbds);
- free(record->type);
- free(record->content_type);
- free(record);
-}
-
-
-bool
-xen_sr_get_record(xen_session *session, xen_sr_record **result, xen_sr sr)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = sr }
- };
-
- abstract_type result_type = xen_sr_record_abstract_type_;
-
- *result = NULL;
- XEN_CALL_("SR.get_record");
-
- if (session->ok)
- {
- (*result)->handle = xen_strdup_((*result)->uuid);
- }
-
- return session->ok;
-}
-
-
-bool
-xen_sr_get_by_uuid(xen_session *session, xen_sr *result, char *uuid)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = uuid }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("SR.get_by_uuid");
- return session->ok;
-}
-
-
-bool
-xen_sr_get_by_name_label(xen_session *session, struct xen_sr_set **result, char *label)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = label }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("SR.get_by_name_label");
- return session->ok;
-}
-
-
-bool
-xen_sr_get_name_label(xen_session *session, char **result, xen_sr sr)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = sr }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("SR.get_name_label");
- return session->ok;
-}
-
-
-bool
-xen_sr_get_name_description(xen_session *session, char **result, xen_sr sr)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = sr }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("SR.get_name_description");
- return session->ok;
-}
-
-
-bool
-xen_sr_get_vdis(xen_session *session, struct xen_vdi_set **result, xen_sr sr)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = sr }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("SR.get_VDIs");
- return session->ok;
-}
-
-
-bool
-xen_sr_get_pbds(xen_session *session, struct xen_pbd_set **result, xen_sr sr)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = sr }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("SR.get_PBDs");
- return session->ok;
-}
-
-
-bool
-xen_sr_get_virtual_allocation(xen_session *session, int64_t *result, xen_sr sr)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = sr }
- };
-
- abstract_type result_type = abstract_type_int;
-
- XEN_CALL_("SR.get_virtual_allocation");
- return session->ok;
-}
-
-
-bool
-xen_sr_get_physical_utilisation(xen_session *session, int64_t *result, xen_sr sr)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = sr }
- };
-
- abstract_type result_type = abstract_type_int;
-
- XEN_CALL_("SR.get_physical_utilisation");
- return session->ok;
-}
-
-
-bool
-xen_sr_get_physical_size(xen_session *session, int64_t *result, xen_sr sr)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = sr }
- };
-
- abstract_type result_type = abstract_type_int;
-
- XEN_CALL_("SR.get_physical_size");
- return session->ok;
-}
-
-
-bool
-xen_sr_get_type(xen_session *session, char **result, xen_sr sr)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = sr }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("SR.get_type");
- return session->ok;
-}
-
-
-bool
-xen_sr_get_content_type(xen_session *session, char **result, xen_sr sr)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = sr }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("SR.get_content_type");
- return session->ok;
-}
-
-
-bool
-xen_sr_set_name_label(xen_session *session, xen_sr sr, char *label)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = sr },
- { .type = &abstract_type_string,
- .u.string_val = label }
- };
-
- xen_call_(session, "SR.set_name_label", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_sr_set_name_description(xen_session *session, xen_sr sr, char *description)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = sr },
- { .type = &abstract_type_string,
- .u.string_val = description }
- };
-
- xen_call_(session, "SR.set_name_description", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_sr_get_supported_types(xen_session *session, struct xen_string_set **result)
-{
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- xen_call_(session, "SR.get_supported_types", NULL, 0, &result_type, result);
- return session->ok;
-}
-
-
-bool
-xen_sr_get_all(xen_session *session, struct xen_sr_set **result)
-{
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- xen_call_(session, "SR.get_all", NULL, 0, &result_type, result);
- return session->ok;
-}
-
-
-bool
-xen_sr_get_uuid(xen_session *session, char **result, xen_sr sr)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = sr }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("SR.get_uuid");
- return session->ok;
-}
+++ /dev/null
-/*
- * 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
- */
-
-
-#include "xen_internal.h"
-#include <xen/api/xen_string_set.h>
-
-
-xen_string_set *
-xen_string_set_alloc(size_t size)
-{
- xen_string_set *result = calloc(1, sizeof(xen_string_set) +
- size * sizeof(char *));
- result->size = size;
- return result;
-}
-
-void
-xen_string_set_free(xen_string_set *set)
-{
- size_t n;
- if (set == NULL)
- {
- return;
- }
- n = set->size;
- for (size_t i = 0; i < n; i++)
- {
- free(set->contents[i]);
- }
-
- free(set);
-}
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * 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
- */
-
-
-#include "xen_internal.h"
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_string_string_map.h>
-
-
-xen_string_string_map *
-xen_string_string_map_alloc(size_t size)
-{
- xen_string_string_map *result = calloc(1, sizeof(xen_string_string_map) +
- size * sizeof(struct xen_string_string_map_contents));
- result->size = size;
- return result;
-}
-
-
-void
-xen_string_string_map_free(xen_string_string_map *map)
-{
- size_t n;
- if (map == NULL)
- {
- return;
- }
-
- n = map->size;
- for (size_t i = 0; i < n; i++)
- {
- free(map->contents[i].key);
- free(map->contents[i].val);
- }
-
- free(map);
-}
+++ /dev/null
-/*
- * 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
- */
-
-
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "xen_internal.h"
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_user.h>
-
-
-XEN_FREE(xen_user)
-XEN_SET_ALLOC_FREE(xen_user)
-XEN_ALLOC(xen_user_record)
-XEN_SET_ALLOC_FREE(xen_user_record)
-XEN_ALLOC(xen_user_record_opt)
-XEN_RECORD_OPT_FREE(xen_user)
-XEN_SET_ALLOC_FREE(xen_user_record_opt)
-
-
-static const struct_member xen_user_record_struct_members[] =
- {
- { .key = "uuid",
- .type = &abstract_type_string,
- .offset = offsetof(xen_user_record, uuid) },
- { .key = "short_name",
- .type = &abstract_type_string,
- .offset = offsetof(xen_user_record, short_name) },
- { .key = "fullname",
- .type = &abstract_type_string,
- .offset = offsetof(xen_user_record, fullname) }
- };
-
-const abstract_type xen_user_record_abstract_type_ =
- {
- .typename = STRUCT,
- .struct_size = sizeof(xen_user_record),
- .member_count =
- sizeof(xen_user_record_struct_members) / sizeof(struct_member),
- .members = xen_user_record_struct_members
- };
-
-
-void
-xen_user_record_free(xen_user_record *record)
-{
- if (record == NULL)
- {
- return;
- }
- free(record->handle);
- free(record->uuid);
- free(record->short_name);
- free(record->fullname);
- free(record);
-}
-
-
-bool
-xen_user_get_record(xen_session *session, xen_user_record **result, xen_user user)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = user }
- };
-
- abstract_type result_type = xen_user_record_abstract_type_;
-
- *result = NULL;
- XEN_CALL_("user.get_record");
-
- if (session->ok)
- {
- (*result)->handle = xen_strdup_((*result)->uuid);
- }
-
- return session->ok;
-}
-
-
-bool
-xen_user_get_by_uuid(xen_session *session, xen_user *result, char *uuid)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = uuid }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("user.get_by_uuid");
- return session->ok;
-}
-
-
-bool
-xen_user_create(xen_session *session, xen_user *result, xen_user_record *record)
-{
- abstract_value param_values[] =
- {
- { .type = &xen_user_record_abstract_type_,
- .u.struct_val = record }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("user.create");
- return session->ok;
-}
-
-
-bool
-xen_user_destroy(xen_session *session, xen_user user)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = user }
- };
-
- xen_call_(session, "user.destroy", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_user_get_short_name(xen_session *session, char **result, xen_user user)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = user }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("user.get_short_name");
- return session->ok;
-}
-
-
-bool
-xen_user_get_fullname(xen_session *session, char **result, xen_user user)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = user }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("user.get_fullname");
- return session->ok;
-}
-
-
-bool
-xen_user_set_fullname(xen_session *session, xen_user user, char *fullname)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = user },
- { .type = &abstract_type_string,
- .u.string_val = fullname }
- };
-
- xen_call_(session, "user.set_fullname", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_user_get_uuid(xen_session *session, char **result, xen_user user)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = user }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("user.get_uuid");
- return session->ok;
-}
+++ /dev/null
-/*
- * 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
- */
-
-
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "xen_internal.h"
-#include "xen_vbd_mode_internal.h"
-#include "xen_vbd_type_internal.h"
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_string_string_map.h>
-#include <xen/api/xen_vbd.h>
-#include <xen/api/xen_vbd_metrics.h>
-#include <xen/api/xen_vdi.h>
-#include <xen/api/xen_vm.h>
-
-
-XEN_FREE(xen_vbd)
-XEN_SET_ALLOC_FREE(xen_vbd)
-XEN_ALLOC(xen_vbd_record)
-XEN_SET_ALLOC_FREE(xen_vbd_record)
-XEN_ALLOC(xen_vbd_record_opt)
-XEN_RECORD_OPT_FREE(xen_vbd)
-XEN_SET_ALLOC_FREE(xen_vbd_record_opt)
-
-
-static const struct_member xen_vbd_record_struct_members[] =
- {
- { .key = "uuid",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vbd_record, uuid) },
- { .key = "VM",
- .type = &abstract_type_ref,
- .offset = offsetof(xen_vbd_record, vm) },
- { .key = "VDI",
- .type = &abstract_type_ref,
- .offset = offsetof(xen_vbd_record, vdi) },
- { .key = "device",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vbd_record, device) },
- { .key = "bootable",
- .type = &abstract_type_bool,
- .offset = offsetof(xen_vbd_record, bootable) },
- { .key = "mode",
- .type = &xen_vbd_mode_abstract_type_,
- .offset = offsetof(xen_vbd_record, mode) },
- { .key = "type",
- .type = &xen_vbd_type_abstract_type_,
- .offset = offsetof(xen_vbd_record, type) },
- { .key = "currently_attached",
- .type = &abstract_type_bool,
- .offset = offsetof(xen_vbd_record, currently_attached) },
- { .key = "status_code",
- .type = &abstract_type_int,
- .offset = offsetof(xen_vbd_record, status_code) },
- { .key = "status_detail",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vbd_record, status_detail) },
- { .key = "runtime_properties",
- .type = &abstract_type_string_string_map,
- .offset = offsetof(xen_vbd_record, runtime_properties) },
- { .key = "qos_algorithm_type",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vbd_record, qos_algorithm_type) },
- { .key = "qos_algorithm_params",
- .type = &abstract_type_string_string_map,
- .offset = offsetof(xen_vbd_record, qos_algorithm_params) },
- { .key = "qos_supported_algorithms",
- .type = &abstract_type_string_set,
- .offset = offsetof(xen_vbd_record, qos_supported_algorithms) },
- { .key = "metrics",
- .type = &abstract_type_ref,
- .offset = offsetof(xen_vbd_record, metrics) }
- };
-
-const abstract_type xen_vbd_record_abstract_type_ =
- {
- .typename = STRUCT,
- .struct_size = sizeof(xen_vbd_record),
- .member_count =
- sizeof(xen_vbd_record_struct_members) / sizeof(struct_member),
- .members = xen_vbd_record_struct_members
- };
-
-
-void
-xen_vbd_record_free(xen_vbd_record *record)
-{
- if (record == NULL)
- {
- return;
- }
- free(record->handle);
- free(record->uuid);
- xen_vm_record_opt_free(record->vm);
- xen_vdi_record_opt_free(record->vdi);
- free(record->device);
- free(record->status_detail);
- xen_string_string_map_free(record->runtime_properties);
- free(record->qos_algorithm_type);
- xen_string_string_map_free(record->qos_algorithm_params);
- xen_string_set_free(record->qos_supported_algorithms);
- xen_vbd_metrics_record_opt_free(record->metrics);
- free(record);
-}
-
-
-bool
-xen_vbd_get_record(xen_session *session, xen_vbd_record **result, xen_vbd vbd)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd }
- };
-
- abstract_type result_type = xen_vbd_record_abstract_type_;
-
- *result = NULL;
- XEN_CALL_("VBD.get_record");
-
- if (session->ok)
- {
- (*result)->handle = xen_strdup_((*result)->uuid);
- }
-
- return session->ok;
-}
-
-
-bool
-xen_vbd_get_by_uuid(xen_session *session, xen_vbd *result, char *uuid)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = uuid }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VBD.get_by_uuid");
- return session->ok;
-}
-
-
-bool
-xen_vbd_create(xen_session *session, xen_vbd *result, xen_vbd_record *record)
-{
- abstract_value param_values[] =
- {
- { .type = &xen_vbd_record_abstract_type_,
- .u.struct_val = record }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VBD.create");
- return session->ok;
-}
-
-
-bool
-xen_vbd_destroy(xen_session *session, xen_vbd vbd)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd }
- };
-
- xen_call_(session, "VBD.destroy", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vbd_get_vm(xen_session *session, xen_vm *result, xen_vbd vbd)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VBD.get_VM");
- return session->ok;
-}
-
-
-bool
-xen_vbd_get_vdi(xen_session *session, xen_vdi *result, xen_vbd vbd)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VBD.get_VDI");
- return session->ok;
-}
-
-
-bool
-xen_vbd_get_device(xen_session *session, char **result, xen_vbd vbd)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VBD.get_device");
- return session->ok;
-}
-
-
-bool
-xen_vbd_get_bootable(xen_session *session, bool *result, xen_vbd vbd)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd }
- };
-
- abstract_type result_type = abstract_type_bool;
-
- XEN_CALL_("VBD.get_bootable");
- return session->ok;
-}
-
-
-bool
-xen_vbd_get_mode(xen_session *session, enum xen_vbd_mode *result, xen_vbd vbd)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd }
- };
-
- abstract_type result_type = xen_vbd_mode_abstract_type_;
- XEN_CALL_("VBD.get_mode");
- return session->ok;
-}
-
-
-bool
-xen_vbd_get_type(xen_session *session, enum xen_vbd_type *result, xen_vbd vbd)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd }
- };
-
- abstract_type result_type = xen_vbd_type_abstract_type_;
- XEN_CALL_("VBD.get_type");
- return session->ok;
-}
-
-
-bool
-xen_vbd_get_currently_attached(xen_session *session, bool *result, xen_vbd vbd)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd }
- };
-
- abstract_type result_type = abstract_type_bool;
-
- XEN_CALL_("VBD.get_currently_attached");
- return session->ok;
-}
-
-
-bool
-xen_vbd_get_status_code(xen_session *session, int64_t *result, xen_vbd vbd)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd }
- };
-
- abstract_type result_type = abstract_type_int;
-
- XEN_CALL_("VBD.get_status_code");
- return session->ok;
-}
-
-
-bool
-xen_vbd_get_status_detail(xen_session *session, char **result, xen_vbd vbd)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VBD.get_status_detail");
- return session->ok;
-}
-
-
-bool
-xen_vbd_get_runtime_properties(xen_session *session, xen_string_string_map **result, xen_vbd vbd)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd }
- };
-
- abstract_type result_type = abstract_type_string_string_map;
-
- *result = NULL;
- XEN_CALL_("VBD.get_runtime_properties");
- return session->ok;
-}
-
-
-bool
-xen_vbd_get_qos_algorithm_type(xen_session *session, char **result, xen_vbd vbd)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VBD.get_qos_algorithm_type");
- return session->ok;
-}
-
-
-bool
-xen_vbd_get_qos_algorithm_params(xen_session *session, xen_string_string_map **result, xen_vbd vbd)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd }
- };
-
- abstract_type result_type = abstract_type_string_string_map;
-
- *result = NULL;
- XEN_CALL_("VBD.get_qos_algorithm_params");
- return session->ok;
-}
-
-
-bool
-xen_vbd_get_qos_supported_algorithms(xen_session *session, struct xen_string_set **result, xen_vbd vbd)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("VBD.get_qos_supported_algorithms");
- return session->ok;
-}
-
-
-bool
-xen_vbd_get_metrics(xen_session *session, xen_vbd_metrics *result, xen_vbd vbd)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VBD.get_metrics");
- return session->ok;
-}
-
-
-bool
-xen_vbd_set_device(xen_session *session, xen_vbd vbd, char *device)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd },
- { .type = &abstract_type_string,
- .u.string_val = device }
- };
-
- xen_call_(session, "VBD.set_device", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vbd_set_bootable(xen_session *session, xen_vbd vbd, bool bootable)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd },
- { .type = &abstract_type_bool,
- .u.bool_val = bootable }
- };
-
- xen_call_(session, "VBD.set_bootable", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vbd_set_mode(xen_session *session, xen_vbd vbd, enum xen_vbd_mode mode)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd },
- { .type = &xen_vbd_mode_abstract_type_,
- .u.enum_val = mode }
- };
-
- xen_call_(session, "VBD.set_mode", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vbd_set_type(xen_session *session, xen_vbd vbd, enum xen_vbd_type type)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd },
- { .type = &xen_vbd_type_abstract_type_,
- .u.enum_val = type }
- };
-
- xen_call_(session, "VBD.set_type", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vbd_set_qos_algorithm_type(xen_session *session, xen_vbd vbd, char *algorithm_type)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd },
- { .type = &abstract_type_string,
- .u.string_val = algorithm_type }
- };
-
- xen_call_(session, "VBD.set_qos_algorithm_type", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vbd_set_qos_algorithm_params(xen_session *session, xen_vbd vbd, xen_string_string_map *algorithm_params)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd },
- { .type = &abstract_type_string_string_map,
- .u.set_val = (arbitrary_set *)algorithm_params }
- };
-
- xen_call_(session, "VBD.set_qos_algorithm_params", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vbd_add_to_qos_algorithm_params(xen_session *session, xen_vbd vbd, char *key, char *value)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd },
- { .type = &abstract_type_string,
- .u.string_val = key },
- { .type = &abstract_type_string,
- .u.string_val = value }
- };
-
- xen_call_(session, "VBD.add_to_qos_algorithm_params", param_values, 3, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vbd_remove_from_qos_algorithm_params(xen_session *session, xen_vbd vbd, char *key)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd },
- { .type = &abstract_type_string,
- .u.string_val = key }
- };
-
- xen_call_(session, "VBD.remove_from_qos_algorithm_params", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vbd_media_change(xen_session *session, xen_vbd vbd, xen_vdi vdi)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd },
- { .type = &abstract_type_string,
- .u.string_val = vdi }
- };
-
- xen_call_(session, "VBD.media_change", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vbd_plug(xen_session *session, xen_vbd self)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = self }
- };
-
- xen_call_(session, "VBD.plug", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vbd_unplug(xen_session *session, xen_vbd self)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = self }
- };
-
- xen_call_(session, "VBD.unplug", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vbd_get_all(xen_session *session, struct xen_vbd_set **result)
-{
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- xen_call_(session, "VBD.get_all", NULL, 0, &result_type, result);
- return session->ok;
-}
-
-
-bool
-xen_vbd_get_uuid(xen_session *session, char **result, xen_vbd vbd)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VBD.get_uuid");
- return session->ok;
-}
+++ /dev/null
-/*
- * 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
- */
-
-
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "xen_internal.h"
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_vbd_metrics.h>
-
-
-XEN_FREE(xen_vbd_metrics)
-XEN_SET_ALLOC_FREE(xen_vbd_metrics)
-XEN_ALLOC(xen_vbd_metrics_record)
-XEN_SET_ALLOC_FREE(xen_vbd_metrics_record)
-XEN_ALLOC(xen_vbd_metrics_record_opt)
-XEN_RECORD_OPT_FREE(xen_vbd_metrics)
-XEN_SET_ALLOC_FREE(xen_vbd_metrics_record_opt)
-
-
-static const struct_member xen_vbd_metrics_record_struct_members[] =
- {
- { .key = "uuid",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vbd_metrics_record, uuid) },
- { .key = "io_read_kbs",
- .type = &abstract_type_float,
- .offset = offsetof(xen_vbd_metrics_record, io_read_kbs) },
- { .key = "io_write_kbs",
- .type = &abstract_type_float,
- .offset = offsetof(xen_vbd_metrics_record, io_write_kbs) },
- { .key = "last_updated",
- .type = &abstract_type_datetime,
- .offset = offsetof(xen_vbd_metrics_record, last_updated) }
- };
-
-const abstract_type xen_vbd_metrics_record_abstract_type_ =
- {
- .typename = STRUCT,
- .struct_size = sizeof(xen_vbd_metrics_record),
- .member_count =
- sizeof(xen_vbd_metrics_record_struct_members) / sizeof(struct_member),
- .members = xen_vbd_metrics_record_struct_members
- };
-
-
-void
-xen_vbd_metrics_record_free(xen_vbd_metrics_record *record)
-{
- if (record == NULL)
- {
- return;
- }
- free(record->handle);
- free(record->uuid);
- free(record);
-}
-
-
-bool
-xen_vbd_metrics_get_record(xen_session *session, xen_vbd_metrics_record **result, xen_vbd_metrics vbd_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd_metrics }
- };
-
- abstract_type result_type = xen_vbd_metrics_record_abstract_type_;
-
- *result = NULL;
- XEN_CALL_("VBD_metrics.get_record");
-
- if (session->ok)
- {
- (*result)->handle = xen_strdup_((*result)->uuid);
- }
-
- return session->ok;
-}
-
-
-bool
-xen_vbd_metrics_get_by_uuid(xen_session *session, xen_vbd_metrics *result, char *uuid)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = uuid }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VBD_metrics.get_by_uuid");
- return session->ok;
-}
-
-
-bool
-xen_vbd_metrics_get_io_read_kbs(xen_session *session, double *result, xen_vbd_metrics vbd_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd_metrics }
- };
-
- abstract_type result_type = abstract_type_float;
-
- XEN_CALL_("VBD_metrics.get_io_read_kbs");
- return session->ok;
-}
-
-
-bool
-xen_vbd_metrics_get_io_write_kbs(xen_session *session, double *result, xen_vbd_metrics vbd_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd_metrics }
- };
-
- abstract_type result_type = abstract_type_float;
-
- XEN_CALL_("VBD_metrics.get_io_write_kbs");
- return session->ok;
-}
-
-
-bool
-xen_vbd_metrics_get_last_updated(xen_session *session, time_t *result, xen_vbd_metrics vbd_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd_metrics }
- };
-
- abstract_type result_type = abstract_type_datetime;
-
- XEN_CALL_("VBD_metrics.get_last_updated");
- return session->ok;
-}
-
-
-bool
-xen_vbd_metrics_get_all(xen_session *session, struct xen_vbd_metrics_set **result)
-{
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- xen_call_(session, "VBD_metrics.get_all", NULL, 0, &result_type, result);
- return session->ok;
-}
-
-
-bool
-xen_vbd_metrics_get_uuid(xen_session *session, char **result, xen_vbd_metrics vbd_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd_metrics }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VBD_metrics.get_uuid");
- return session->ok;
-}
+++ /dev/null
-/*
- * 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
- */
-
-#include <string.h>
-
-#include "xen_internal.h"
-#include <xen/api/xen_vbd_mode.h>
-#include "xen_vbd_mode_internal.h"
-
-
-/*
- * Maintain this in the same order as the enum declaration!
- */
-static const char *lookup_table[] =
-{
- "RO",
- "RW"
-};
-
-
-extern xen_vbd_mode_set *
-xen_vbd_mode_set_alloc(size_t size)
-{
- return calloc(1, sizeof(xen_vbd_mode_set) +
- size * sizeof(enum xen_vbd_mode));
-}
-
-
-extern void
-xen_vbd_mode_set_free(xen_vbd_mode_set *set)
-{
- free(set);
-}
-
-
-const char *
-xen_vbd_mode_to_string(enum xen_vbd_mode val)
-{
- return lookup_table[val];
-}
-
-
-extern enum xen_vbd_mode
-xen_vbd_mode_from_string(xen_session *session, const char *str)
-{
- return ENUM_LOOKUP(session, str, lookup_table);
-}
-
-
-const abstract_type xen_vbd_mode_abstract_type_ =
- {
- .typename = ENUM,
- .enum_marshaller =
- (const char *(*)(int))&xen_vbd_mode_to_string,
- .enum_demarshaller =
- (int (*)(xen_session *, const char *))&xen_vbd_mode_from_string
- };
-
-
-const abstract_type xen_vbd_mode_set_abstract_type_ =
- {
- .typename = SET,
- .child = &xen_vbd_mode_abstract_type_
- };
-
-
+++ /dev/null
-/*
- * 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
- */
-
-#include <string.h>
-
-#include "xen_internal.h"
-#include <xen/api/xen_vbd_type.h>
-#include "xen_vbd_type_internal.h"
-
-
-/*
- * Maintain this in the same order as the enum declaration!
- */
-static const char *lookup_table[] =
-{
- "CD",
- "Disk"
-};
-
-
-extern xen_vbd_type_set *
-xen_vbd_type_set_alloc(size_t size)
-{
- return calloc(1, sizeof(xen_vbd_type_set) +
- size * sizeof(enum xen_vbd_type));
-}
-
-
-extern void
-xen_vbd_type_set_free(xen_vbd_type_set *set)
-{
- free(set);
-}
-
-
-const char *
-xen_vbd_type_to_string(enum xen_vbd_type val)
-{
- return lookup_table[val];
-}
-
-
-extern enum xen_vbd_type
-xen_vbd_type_from_string(xen_session *session, const char *str)
-{
- return ENUM_LOOKUP(session, str, lookup_table);
-}
-
-
-const abstract_type xen_vbd_type_abstract_type_ =
- {
- .typename = ENUM,
- .enum_marshaller =
- (const char *(*)(int))&xen_vbd_type_to_string,
- .enum_demarshaller =
- (int (*)(xen_session *, const char *))&xen_vbd_type_from_string
- };
-
-
-const abstract_type xen_vbd_type_set_abstract_type_ =
- {
- .typename = SET,
- .child = &xen_vbd_type_abstract_type_
- };
-
-
+++ /dev/null
-/*
- * 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
- */
-
-
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "xen_internal.h"
-#include "xen_vdi_type_internal.h"
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_crashdump.h>
-#include <xen/api/xen_sr.h>
-#include <xen/api/xen_string_string_map.h>
-#include <xen/api/xen_vbd.h>
-#include <xen/api/xen_vdi.h>
-
-
-XEN_FREE(xen_vdi)
-XEN_SET_ALLOC_FREE(xen_vdi)
-XEN_ALLOC(xen_vdi_record)
-XEN_SET_ALLOC_FREE(xen_vdi_record)
-XEN_ALLOC(xen_vdi_record_opt)
-XEN_RECORD_OPT_FREE(xen_vdi)
-XEN_SET_ALLOC_FREE(xen_vdi_record_opt)
-
-
-static const struct_member xen_vdi_record_struct_members[] =
- {
- { .key = "uuid",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vdi_record, uuid) },
- { .key = "name_label",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vdi_record, name_label) },
- { .key = "name_description",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vdi_record, name_description) },
- { .key = "SR",
- .type = &abstract_type_ref,
- .offset = offsetof(xen_vdi_record, sr) },
- { .key = "VBDs",
- .type = &abstract_type_ref_set,
- .offset = offsetof(xen_vdi_record, vbds) },
- { .key = "crash_dumps",
- .type = &abstract_type_ref_set,
- .offset = offsetof(xen_vdi_record, crash_dumps) },
- { .key = "virtual_size",
- .type = &abstract_type_int,
- .offset = offsetof(xen_vdi_record, virtual_size) },
- { .key = "physical_utilisation",
- .type = &abstract_type_int,
- .offset = offsetof(xen_vdi_record, physical_utilisation) },
- { .key = "type",
- .type = &xen_vdi_type_abstract_type_,
- .offset = offsetof(xen_vdi_record, type) },
- { .key = "sharable",
- .type = &abstract_type_bool,
- .offset = offsetof(xen_vdi_record, sharable) },
- { .key = "read_only",
- .type = &abstract_type_bool,
- .offset = offsetof(xen_vdi_record, read_only) },
- { .key = "other_config",
- .type = &abstract_type_string_string_map,
- .offset = offsetof(xen_vdi_record, other_config) }
- };
-
-const abstract_type xen_vdi_record_abstract_type_ =
- {
- .typename = STRUCT,
- .struct_size = sizeof(xen_vdi_record),
- .member_count =
- sizeof(xen_vdi_record_struct_members) / sizeof(struct_member),
- .members = xen_vdi_record_struct_members
- };
-
-
-void
-xen_vdi_record_free(xen_vdi_record *record)
-{
- if (record == NULL)
- {
- return;
- }
- free(record->handle);
- free(record->uuid);
- free(record->name_label);
- free(record->name_description);
- xen_sr_record_opt_free(record->sr);
- xen_vbd_record_opt_set_free(record->vbds);
- xen_crashdump_record_opt_set_free(record->crash_dumps);
- xen_string_string_map_free(record->other_config);
- free(record);
-}
-
-
-bool
-xen_vdi_get_record(xen_session *session, xen_vdi_record **result, xen_vdi vdi)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vdi }
- };
-
- abstract_type result_type = xen_vdi_record_abstract_type_;
-
- *result = NULL;
- XEN_CALL_("VDI.get_record");
-
- if (session->ok)
- {
- (*result)->handle = xen_strdup_((*result)->uuid);
- }
-
- return session->ok;
-}
-
-
-bool
-xen_vdi_get_by_uuid(xen_session *session, xen_vdi *result, char *uuid)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = uuid }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VDI.get_by_uuid");
- return session->ok;
-}
-
-
-bool
-xen_vdi_create(xen_session *session, xen_vdi *result, xen_vdi_record *record)
-{
- abstract_value param_values[] =
- {
- { .type = &xen_vdi_record_abstract_type_,
- .u.struct_val = record }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VDI.create");
- return session->ok;
-}
-
-
-bool
-xen_vdi_destroy(xen_session *session, xen_vdi vdi)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vdi }
- };
-
- xen_call_(session, "VDI.destroy", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vdi_get_by_name_label(xen_session *session, struct xen_vdi_set **result, char *label)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = label }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("VDI.get_by_name_label");
- return session->ok;
-}
-
-
-bool
-xen_vdi_get_name_label(xen_session *session, char **result, xen_vdi vdi)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vdi }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VDI.get_name_label");
- return session->ok;
-}
-
-
-bool
-xen_vdi_get_name_description(xen_session *session, char **result, xen_vdi vdi)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vdi }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VDI.get_name_description");
- return session->ok;
-}
-
-
-bool
-xen_vdi_get_sr(xen_session *session, xen_sr *result, xen_vdi vdi)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vdi }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VDI.get_SR");
- return session->ok;
-}
-
-
-bool
-xen_vdi_get_vbds(xen_session *session, struct xen_vbd_set **result, xen_vdi vdi)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vdi }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("VDI.get_VBDs");
- return session->ok;
-}
-
-
-bool
-xen_vdi_get_crash_dumps(xen_session *session, struct xen_crashdump_set **result, xen_vdi vdi)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vdi }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("VDI.get_crash_dumps");
- return session->ok;
-}
-
-
-bool
-xen_vdi_get_virtual_size(xen_session *session, int64_t *result, xen_vdi vdi)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vdi }
- };
-
- abstract_type result_type = abstract_type_int;
-
- XEN_CALL_("VDI.get_virtual_size");
- return session->ok;
-}
-
-
-bool
-xen_vdi_get_physical_utilisation(xen_session *session, int64_t *result, xen_vdi vdi)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vdi }
- };
-
- abstract_type result_type = abstract_type_int;
-
- XEN_CALL_("VDI.get_physical_utilisation");
- return session->ok;
-}
-
-
-bool
-xen_vdi_get_type(xen_session *session, enum xen_vdi_type *result, xen_vdi vdi)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vdi }
- };
-
- abstract_type result_type = xen_vdi_type_abstract_type_;
- XEN_CALL_("VDI.get_type");
- return session->ok;
-}
-
-
-bool
-xen_vdi_get_sharable(xen_session *session, bool *result, xen_vdi vdi)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vdi }
- };
-
- abstract_type result_type = abstract_type_bool;
-
- XEN_CALL_("VDI.get_sharable");
- return session->ok;
-}
-
-
-bool
-xen_vdi_get_read_only(xen_session *session, bool *result, xen_vdi vdi)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vdi }
- };
-
- abstract_type result_type = abstract_type_bool;
-
- XEN_CALL_("VDI.get_read_only");
- return session->ok;
-}
-
-
-bool
-xen_vdi_get_other_config(xen_session *session, xen_string_string_map **result, xen_vdi vdi)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vdi }
- };
-
- abstract_type result_type = abstract_type_string_string_map;
-
- *result = NULL;
- XEN_CALL_("VDI.get_other_config");
- return session->ok;
-}
-
-
-bool
-xen_vdi_set_name_label(xen_session *session, xen_vdi vdi, char *label)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vdi },
- { .type = &abstract_type_string,
- .u.string_val = label }
- };
-
- xen_call_(session, "VDI.set_name_label", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vdi_set_name_description(xen_session *session, xen_vdi vdi, char *description)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vdi },
- { .type = &abstract_type_string,
- .u.string_val = description }
- };
-
- xen_call_(session, "VDI.set_name_description", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vdi_set_virtual_size(xen_session *session, xen_vdi vdi, int64_t virtual_size)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vdi },
- { .type = &abstract_type_int,
- .u.int_val = virtual_size }
- };
-
- xen_call_(session, "VDI.set_virtual_size", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vdi_set_sharable(xen_session *session, xen_vdi vdi, bool sharable)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vdi },
- { .type = &abstract_type_bool,
- .u.bool_val = sharable }
- };
-
- xen_call_(session, "VDI.set_sharable", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vdi_set_read_only(xen_session *session, xen_vdi vdi, bool read_only)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vdi },
- { .type = &abstract_type_bool,
- .u.bool_val = read_only }
- };
-
- xen_call_(session, "VDI.set_read_only", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vdi_set_other_config(xen_session *session, xen_vdi vdi, xen_string_string_map *other_config)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vdi },
- { .type = &abstract_type_string_string_map,
- .u.set_val = (arbitrary_set *)other_config }
- };
-
- xen_call_(session, "VDI.set_other_config", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vdi_add_to_other_config(xen_session *session, xen_vdi vdi, char *key, char *value)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vdi },
- { .type = &abstract_type_string,
- .u.string_val = key },
- { .type = &abstract_type_string,
- .u.string_val = value }
- };
-
- xen_call_(session, "VDI.add_to_other_config", param_values, 3, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vdi_remove_from_other_config(xen_session *session, xen_vdi vdi, char *key)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vdi },
- { .type = &abstract_type_string,
- .u.string_val = key }
- };
-
- xen_call_(session, "VDI.remove_from_other_config", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vdi_get_all(xen_session *session, struct xen_vdi_set **result)
-{
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- xen_call_(session, "VDI.get_all", NULL, 0, &result_type, result);
- return session->ok;
-}
-
-
-bool
-xen_vdi_get_uuid(xen_session *session, char **result, xen_vdi vdi)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vdi }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VDI.get_uuid");
- return session->ok;
-}
-
-
-bool
-xen_vdi_set_security_label(xen_session *session, int64_t *result, xen_vdi vdi,
- char *label, char *oldlabel)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vdi },
- { .type = &abstract_type_string,
- .u.string_val = label },
- { .type = &abstract_type_string,
- .u.string_val = oldlabel },
- };
-
- abstract_type result_type = abstract_type_int;
-
- *result = 0;
- XEN_CALL_("VDI.set_security_label");
- return session->ok;
-}
-
-
-bool
-xen_vdi_get_security_label(xen_session *session, char **result, xen_vdi vdi)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vdi },
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VDI.get_security_label");
- return session->ok;
-}
+++ /dev/null
-/*
- * 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
- */
-
-#include <string.h>
-
-#include "xen_internal.h"
-#include <xen/api/xen_vdi_type.h>
-#include "xen_vdi_type_internal.h"
-
-
-/*
- * Maintain this in the same order as the enum declaration!
- */
-static const char *lookup_table[] =
-{
- "system",
- "user",
- "ephemeral",
- "suspend",
- "crashdump"
-};
-
-
-extern xen_vdi_type_set *
-xen_vdi_type_set_alloc(size_t size)
-{
- return calloc(1, sizeof(xen_vdi_type_set) +
- size * sizeof(enum xen_vdi_type));
-}
-
-
-extern void
-xen_vdi_type_set_free(xen_vdi_type_set *set)
-{
- free(set);
-}
-
-
-const char *
-xen_vdi_type_to_string(enum xen_vdi_type val)
-{
- return lookup_table[val];
-}
-
-
-extern enum xen_vdi_type
-xen_vdi_type_from_string(xen_session *session, const char *str)
-{
- return ENUM_LOOKUP(session, str, lookup_table);
-}
-
-
-const abstract_type xen_vdi_type_abstract_type_ =
- {
- .typename = ENUM,
- .enum_marshaller =
- (const char *(*)(int))&xen_vdi_type_to_string,
- .enum_demarshaller =
- (int (*)(xen_session *, const char *))&xen_vdi_type_from_string
- };
-
-
-const abstract_type xen_vdi_type_set_abstract_type_ =
- {
- .typename = SET,
- .child = &xen_vdi_type_abstract_type_
- };
-
-
+++ /dev/null
-/*
- * 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
- */
-
-
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "xen_internal.h"
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_network.h>
-#include <xen/api/xen_string_string_map.h>
-#include <xen/api/xen_vif.h>
-#include <xen/api/xen_vif_metrics.h>
-#include <xen/api/xen_vm.h>
-
-
-XEN_FREE(xen_vif)
-XEN_SET_ALLOC_FREE(xen_vif)
-XEN_ALLOC(xen_vif_record)
-XEN_SET_ALLOC_FREE(xen_vif_record)
-XEN_ALLOC(xen_vif_record_opt)
-XEN_RECORD_OPT_FREE(xen_vif)
-XEN_SET_ALLOC_FREE(xen_vif_record_opt)
-
-
-static const struct_member xen_vif_record_struct_members[] =
- {
- { .key = "uuid",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vif_record, uuid) },
- { .key = "device",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vif_record, device) },
- { .key = "network",
- .type = &abstract_type_ref,
- .offset = offsetof(xen_vif_record, network) },
- { .key = "VM",
- .type = &abstract_type_ref,
- .offset = offsetof(xen_vif_record, vm) },
- { .key = "MAC",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vif_record, mac) },
- { .key = "MTU",
- .type = &abstract_type_int,
- .offset = offsetof(xen_vif_record, mtu) },
- { .key = "currently_attached",
- .type = &abstract_type_bool,
- .offset = offsetof(xen_vif_record, currently_attached) },
- { .key = "status_code",
- .type = &abstract_type_int,
- .offset = offsetof(xen_vif_record, status_code) },
- { .key = "status_detail",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vif_record, status_detail) },
- { .key = "runtime_properties",
- .type = &abstract_type_string_string_map,
- .offset = offsetof(xen_vif_record, runtime_properties) },
- { .key = "qos_algorithm_type",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vif_record, qos_algorithm_type) },
- { .key = "qos_algorithm_params",
- .type = &abstract_type_string_string_map,
- .offset = offsetof(xen_vif_record, qos_algorithm_params) },
- { .key = "qos_supported_algorithms",
- .type = &abstract_type_string_set,
- .offset = offsetof(xen_vif_record, qos_supported_algorithms) },
- { .key = "metrics",
- .type = &abstract_type_ref,
- .offset = offsetof(xen_vif_record, metrics) }
- };
-
-const abstract_type xen_vif_record_abstract_type_ =
- {
- .typename = STRUCT,
- .struct_size = sizeof(xen_vif_record),
- .member_count =
- sizeof(xen_vif_record_struct_members) / sizeof(struct_member),
- .members = xen_vif_record_struct_members
- };
-
-
-void
-xen_vif_record_free(xen_vif_record *record)
-{
- if (record == NULL)
- {
- return;
- }
- free(record->handle);
- free(record->uuid);
- free(record->device);
- xen_network_record_opt_free(record->network);
- xen_vm_record_opt_free(record->vm);
- free(record->mac);
- free(record->status_detail);
- xen_string_string_map_free(record->runtime_properties);
- free(record->qos_algorithm_type);
- xen_string_string_map_free(record->qos_algorithm_params);
- xen_string_set_free(record->qos_supported_algorithms);
- xen_vif_metrics_record_opt_free(record->metrics);
- free(record);
-}
-
-
-bool
-xen_vif_get_record(xen_session *session, xen_vif_record **result, xen_vif vif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif }
- };
-
- abstract_type result_type = xen_vif_record_abstract_type_;
-
- *result = NULL;
- XEN_CALL_("VIF.get_record");
-
- if (session->ok)
- {
- (*result)->handle = xen_strdup_((*result)->uuid);
- }
-
- return session->ok;
-}
-
-
-bool
-xen_vif_get_by_uuid(xen_session *session, xen_vif *result, char *uuid)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = uuid }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VIF.get_by_uuid");
- return session->ok;
-}
-
-
-bool
-xen_vif_create(xen_session *session, xen_vif *result, xen_vif_record *record)
-{
- abstract_value param_values[] =
- {
- { .type = &xen_vif_record_abstract_type_,
- .u.struct_val = record }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VIF.create");
- return session->ok;
-}
-
-
-bool
-xen_vif_destroy(xen_session *session, xen_vif vif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif }
- };
-
- xen_call_(session, "VIF.destroy", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vif_get_device(xen_session *session, char **result, xen_vif vif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VIF.get_device");
- return session->ok;
-}
-
-
-bool
-xen_vif_get_network(xen_session *session, xen_network *result, xen_vif vif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VIF.get_network");
- return session->ok;
-}
-
-
-bool
-xen_vif_get_vm(xen_session *session, xen_vm *result, xen_vif vif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VIF.get_VM");
- return session->ok;
-}
-
-
-bool
-xen_vif_get_mac(xen_session *session, char **result, xen_vif vif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VIF.get_MAC");
- return session->ok;
-}
-
-
-bool
-xen_vif_get_mtu(xen_session *session, int64_t *result, xen_vif vif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif }
- };
-
- abstract_type result_type = abstract_type_int;
-
- XEN_CALL_("VIF.get_MTU");
- return session->ok;
-}
-
-
-bool
-xen_vif_get_currently_attached(xen_session *session, bool *result, xen_vif vif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif }
- };
-
- abstract_type result_type = abstract_type_bool;
-
- XEN_CALL_("VIF.get_currently_attached");
- return session->ok;
-}
-
-
-bool
-xen_vif_get_status_code(xen_session *session, int64_t *result, xen_vif vif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif }
- };
-
- abstract_type result_type = abstract_type_int;
-
- XEN_CALL_("VIF.get_status_code");
- return session->ok;
-}
-
-
-bool
-xen_vif_get_status_detail(xen_session *session, char **result, xen_vif vif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VIF.get_status_detail");
- return session->ok;
-}
-
-
-bool
-xen_vif_get_runtime_properties(xen_session *session, xen_string_string_map **result, xen_vif vif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif }
- };
-
- abstract_type result_type = abstract_type_string_string_map;
-
- *result = NULL;
- XEN_CALL_("VIF.get_runtime_properties");
- return session->ok;
-}
-
-
-bool
-xen_vif_get_qos_algorithm_type(xen_session *session, char **result, xen_vif vif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VIF.get_qos_algorithm_type");
- return session->ok;
-}
-
-
-bool
-xen_vif_get_qos_algorithm_params(xen_session *session, xen_string_string_map **result, xen_vif vif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif }
- };
-
- abstract_type result_type = abstract_type_string_string_map;
-
- *result = NULL;
- XEN_CALL_("VIF.get_qos_algorithm_params");
- return session->ok;
-}
-
-
-bool
-xen_vif_get_qos_supported_algorithms(xen_session *session, struct xen_string_set **result, xen_vif vif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("VIF.get_qos_supported_algorithms");
- return session->ok;
-}
-
-
-bool
-xen_vif_get_metrics(xen_session *session, xen_vif_metrics *result, xen_vif vif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VIF.get_metrics");
- return session->ok;
-}
-
-
-bool
-xen_vif_set_device(xen_session *session, xen_vif vif, char *device)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif },
- { .type = &abstract_type_string,
- .u.string_val = device }
- };
-
- xen_call_(session, "VIF.set_device", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vif_set_mac(xen_session *session, xen_vif vif, char *mac)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif },
- { .type = &abstract_type_string,
- .u.string_val = mac }
- };
-
- xen_call_(session, "VIF.set_MAC", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vif_set_mtu(xen_session *session, xen_vif vif, int64_t mtu)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif },
- { .type = &abstract_type_int,
- .u.int_val = mtu }
- };
-
- xen_call_(session, "VIF.set_MTU", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vif_set_qos_algorithm_type(xen_session *session, xen_vif vif, char *algorithm_type)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif },
- { .type = &abstract_type_string,
- .u.string_val = algorithm_type }
- };
-
- xen_call_(session, "VIF.set_qos_algorithm_type", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vif_set_qos_algorithm_params(xen_session *session, xen_vif vif, xen_string_string_map *algorithm_params)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif },
- { .type = &abstract_type_string_string_map,
- .u.set_val = (arbitrary_set *)algorithm_params }
- };
-
- xen_call_(session, "VIF.set_qos_algorithm_params", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vif_add_to_qos_algorithm_params(xen_session *session, xen_vif vif, char *key, char *value)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif },
- { .type = &abstract_type_string,
- .u.string_val = key },
- { .type = &abstract_type_string,
- .u.string_val = value }
- };
-
- xen_call_(session, "VIF.add_to_qos_algorithm_params", param_values, 3, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vif_remove_from_qos_algorithm_params(xen_session *session, xen_vif vif, char *key)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif },
- { .type = &abstract_type_string,
- .u.string_val = key }
- };
-
- xen_call_(session, "VIF.remove_from_qos_algorithm_params", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vif_plug(xen_session *session, xen_vif self)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = self }
- };
-
- xen_call_(session, "VIF.plug", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vif_unplug(xen_session *session, xen_vif self)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = self }
- };
-
- xen_call_(session, "VIF.unplug", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vif_get_all(xen_session *session, struct xen_vif_set **result)
-{
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- xen_call_(session, "VIF.get_all", NULL, 0, &result_type, result);
- return session->ok;
-}
-
-
-bool
-xen_vif_get_uuid(xen_session *session, char **result, xen_vif vif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VIF.get_uuid");
- return session->ok;
-}
-
-
-bool
-xen_vif_set_security_label(xen_session *session, int64_t *result, xen_vif vif,
- char *label, char *oldlabel)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif },
- { .type = &abstract_type_string,
- .u.string_val = label },
- { .type = &abstract_type_string,
- .u.string_val = oldlabel },
- };
-
- abstract_type result_type = abstract_type_int;
-
- *result = 0;
- XEN_CALL_("VIF.set_security_label");
- return session->ok;
-}
-
-
-bool
-xen_vif_get_security_label(xen_session *session, char **result, xen_vif vif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif },
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VIF.get_security_label");
- return session->ok;
-}
+++ /dev/null
-/*
- * 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
- */
-
-
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "xen_internal.h"
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_vif_metrics.h>
-
-
-XEN_FREE(xen_vif_metrics)
-XEN_SET_ALLOC_FREE(xen_vif_metrics)
-XEN_ALLOC(xen_vif_metrics_record)
-XEN_SET_ALLOC_FREE(xen_vif_metrics_record)
-XEN_ALLOC(xen_vif_metrics_record_opt)
-XEN_RECORD_OPT_FREE(xen_vif_metrics)
-XEN_SET_ALLOC_FREE(xen_vif_metrics_record_opt)
-
-
-static const struct_member xen_vif_metrics_record_struct_members[] =
- {
- { .key = "uuid",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vif_metrics_record, uuid) },
- { .key = "io_read_kbs",
- .type = &abstract_type_float,
- .offset = offsetof(xen_vif_metrics_record, io_read_kbs) },
- { .key = "io_write_kbs",
- .type = &abstract_type_float,
- .offset = offsetof(xen_vif_metrics_record, io_write_kbs) },
- { .key = "last_updated",
- .type = &abstract_type_datetime,
- .offset = offsetof(xen_vif_metrics_record, last_updated) }
- };
-
-const abstract_type xen_vif_metrics_record_abstract_type_ =
- {
- .typename = STRUCT,
- .struct_size = sizeof(xen_vif_metrics_record),
- .member_count =
- sizeof(xen_vif_metrics_record_struct_members) / sizeof(struct_member),
- .members = xen_vif_metrics_record_struct_members
- };
-
-
-void
-xen_vif_metrics_record_free(xen_vif_metrics_record *record)
-{
- if (record == NULL)
- {
- return;
- }
- free(record->handle);
- free(record->uuid);
- free(record);
-}
-
-
-bool
-xen_vif_metrics_get_record(xen_session *session, xen_vif_metrics_record **result, xen_vif_metrics vif_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif_metrics }
- };
-
- abstract_type result_type = xen_vif_metrics_record_abstract_type_;
-
- *result = NULL;
- XEN_CALL_("VIF_metrics.get_record");
-
- if (session->ok)
- {
- (*result)->handle = xen_strdup_((*result)->uuid);
- }
-
- return session->ok;
-}
-
-
-bool
-xen_vif_metrics_get_by_uuid(xen_session *session, xen_vif_metrics *result, char *uuid)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = uuid }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VIF_metrics.get_by_uuid");
- return session->ok;
-}
-
-
-bool
-xen_vif_metrics_get_io_read_kbs(xen_session *session, double *result, xen_vif_metrics vif_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif_metrics }
- };
-
- abstract_type result_type = abstract_type_float;
-
- XEN_CALL_("VIF_metrics.get_io_read_kbs");
- return session->ok;
-}
-
-
-bool
-xen_vif_metrics_get_io_write_kbs(xen_session *session, double *result, xen_vif_metrics vif_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif_metrics }
- };
-
- abstract_type result_type = abstract_type_float;
-
- XEN_CALL_("VIF_metrics.get_io_write_kbs");
- return session->ok;
-}
-
-
-bool
-xen_vif_metrics_get_last_updated(xen_session *session, time_t *result, xen_vif_metrics vif_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif_metrics }
- };
-
- abstract_type result_type = abstract_type_datetime;
-
- XEN_CALL_("VIF_metrics.get_last_updated");
- return session->ok;
-}
-
-
-bool
-xen_vif_metrics_get_all(xen_session *session, struct xen_vif_metrics_set **result)
-{
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- xen_call_(session, "VIF_metrics.get_all", NULL, 0, &result_type, result);
- return session->ok;
-}
-
-
-bool
-xen_vif_metrics_get_uuid(xen_session *session, char **result, xen_vif_metrics vif_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif_metrics }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VIF_metrics.get_uuid");
- return session->ok;
-}
+++ /dev/null
-/*
- * 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
- */
-
-
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "xen_internal.h"
-#include "xen_on_crash_behaviour_internal.h"
-#include "xen_on_normal_exit_internal.h"
-#include "xen_vm_power_state_internal.h"
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_console.h>
-#include <xen/api/xen_crashdump.h>
-#include <xen/api/xen_host.h>
-#include <xen/api/xen_string_string_map.h>
-#include <xen/api/xen_vbd.h>
-#include <xen/api/xen_vdi.h>
-#include <xen/api/xen_vif.h>
-#include <xen/api/xen_vm.h>
-#include <xen/api/xen_vm_guest_metrics.h>
-#include <xen/api/xen_vm_metrics.h>
-#include <xen/api/xen_cpu_pool.h>
-
-
-XEN_FREE(xen_vm)
-XEN_SET_ALLOC_FREE(xen_vm)
-XEN_ALLOC(xen_vm_record)
-XEN_SET_ALLOC_FREE(xen_vm_record)
-XEN_ALLOC(xen_vm_record_opt)
-XEN_RECORD_OPT_FREE(xen_vm)
-XEN_SET_ALLOC_FREE(xen_vm_record_opt)
-
-
-static const struct_member xen_vm_record_struct_members[] =
- {
- { .key = "uuid",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vm_record, uuid) },
- { .key = "power_state",
- .type = &xen_vm_power_state_abstract_type_,
- .offset = offsetof(xen_vm_record, power_state) },
- { .key = "name_label",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vm_record, name_label) },
- { .key = "name_description",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vm_record, name_description) },
- { .key = "user_version",
- .type = &abstract_type_int,
- .offset = offsetof(xen_vm_record, user_version) },
- { .key = "is_a_template",
- .type = &abstract_type_bool,
- .offset = offsetof(xen_vm_record, is_a_template) },
- { .key = "auto_power_on",
- .type = &abstract_type_bool,
- .offset = offsetof(xen_vm_record, auto_power_on) },
- { .key = "suspend_VDI",
- .type = &abstract_type_ref,
- .offset = offsetof(xen_vm_record, suspend_vdi) },
- { .key = "resident_on",
- .type = &abstract_type_ref,
- .offset = offsetof(xen_vm_record, resident_on) },
- { .key = "memory_static_max",
- .type = &abstract_type_int,
- .offset = offsetof(xen_vm_record, memory_static_max) },
- { .key = "memory_dynamic_max",
- .type = &abstract_type_int,
- .offset = offsetof(xen_vm_record, memory_dynamic_max) },
- { .key = "memory_dynamic_min",
- .type = &abstract_type_int,
- .offset = offsetof(xen_vm_record, memory_dynamic_min) },
- { .key = "memory_static_min",
- .type = &abstract_type_int,
- .offset = offsetof(xen_vm_record, memory_static_min) },
- { .key = "VCPUs_params",
- .type = &abstract_type_string_string_map,
- .offset = offsetof(xen_vm_record, vcpus_params) },
- { .key = "VCPUs_max",
- .type = &abstract_type_int,
- .offset = offsetof(xen_vm_record, vcpus_max) },
- { .key = "VCPUs_at_startup",
- .type = &abstract_type_int,
- .offset = offsetof(xen_vm_record, vcpus_at_startup) },
- { .key = "actions_after_shutdown",
- .type = &xen_on_normal_exit_abstract_type_,
- .offset = offsetof(xen_vm_record, actions_after_shutdown) },
- { .key = "actions_after_reboot",
- .type = &xen_on_normal_exit_abstract_type_,
- .offset = offsetof(xen_vm_record, actions_after_reboot) },
- { .key = "actions_after_crash",
- .type = &xen_on_crash_behaviour_abstract_type_,
- .offset = offsetof(xen_vm_record, actions_after_crash) },
- { .key = "consoles",
- .type = &abstract_type_ref_set,
- .offset = offsetof(xen_vm_record, consoles) },
- { .key = "VIFs",
- .type = &abstract_type_ref_set,
- .offset = offsetof(xen_vm_record, vifs) },
- { .key = "VBDs",
- .type = &abstract_type_ref_set,
- .offset = offsetof(xen_vm_record, vbds) },
- { .key = "crash_dumps",
- .type = &abstract_type_ref_set,
- .offset = offsetof(xen_vm_record, crash_dumps) },
- { .key = "PV_bootloader",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vm_record, pv_bootloader) },
- { .key = "PV_kernel",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vm_record, pv_kernel) },
- { .key = "PV_ramdisk",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vm_record, pv_ramdisk) },
- { .key = "PV_args",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vm_record, pv_args) },
- { .key = "PV_bootloader_args",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vm_record, pv_bootloader_args) },
- { .key = "HVM_boot_policy",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vm_record, hvm_boot_policy) },
- { .key = "HVM_boot_params",
- .type = &abstract_type_string_string_map,
- .offset = offsetof(xen_vm_record, hvm_boot_params) },
- { .key = "platform",
- .type = &abstract_type_string_string_map,
- .offset = offsetof(xen_vm_record, platform) },
- { .key = "PCI_bus",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vm_record, pci_bus) },
- { .key = "other_config",
- .type = &abstract_type_string_string_map,
- .offset = offsetof(xen_vm_record, other_config) },
- { .key = "domid",
- .type = &abstract_type_int,
- .offset = offsetof(xen_vm_record, domid) },
- { .key = "is_control_domain",
- .type = &abstract_type_bool,
- .offset = offsetof(xen_vm_record, is_control_domain) },
- { .key = "metrics",
- .type = &abstract_type_ref,
- .offset = offsetof(xen_vm_record, metrics) },
- { .key = "guest_metrics",
- .type = &abstract_type_ref,
- .offset = offsetof(xen_vm_record, guest_metrics) },
- { .key = "security_label",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vm_record, security_label) },
- { .key = "pool_name",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vm_record, pool_name) },
- { .key = "cpu_pool",
- .type = &abstract_type_ref_set,
- .offset = offsetof(xen_vm_record, cpu_pool) },
- };
-
-const abstract_type xen_vm_record_abstract_type_ =
- {
- .typename = STRUCT,
- .struct_size = sizeof(xen_vm_record),
- .member_count =
- sizeof(xen_vm_record_struct_members) / sizeof(struct_member),
- .members = xen_vm_record_struct_members
- };
-
-
-void
-xen_vm_record_free(xen_vm_record *record)
-{
- if (record == NULL)
- {
- return;
- }
- free(record->handle);
- free(record->uuid);
- free(record->name_label);
- free(record->name_description);
- xen_vdi_record_opt_free(record->suspend_vdi);
- xen_host_record_opt_free(record->resident_on);
- xen_string_string_map_free(record->vcpus_params);
- xen_console_record_opt_set_free(record->consoles);
- xen_vif_record_opt_set_free(record->vifs);
- xen_vbd_record_opt_set_free(record->vbds);
- xen_crashdump_record_opt_set_free(record->crash_dumps);
- free(record->pv_bootloader);
- free(record->pv_kernel);
- free(record->pv_ramdisk);
- free(record->pv_args);
- free(record->pv_bootloader_args);
- free(record->hvm_boot_policy);
- xen_string_string_map_free(record->hvm_boot_params);
- xen_string_string_map_free(record->platform);
- free(record->pci_bus);
- xen_string_string_map_free(record->other_config);
- xen_vm_metrics_record_opt_free(record->metrics);
- xen_vm_guest_metrics_record_opt_free(record->guest_metrics);
- xen_cpu_pool_record_opt_set_free(record->cpu_pool);
- free(record->security_label);
- free(record);
-}
-
-
-bool
-xen_vm_get_record(xen_session *session, xen_vm_record **result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = xen_vm_record_abstract_type_;
-
- *result = NULL;
- XEN_CALL_("VM.get_record");
-
- if (session->ok)
- {
- (*result)->handle = xen_strdup_((*result)->uuid);
- }
-
- return session->ok;
-}
-
-
-bool
-xen_vm_get_by_uuid(xen_session *session, xen_vm *result, char *uuid)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = uuid }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VM.get_by_uuid");
- return session->ok;
-}
-
-
-bool
-xen_vm_create(xen_session *session, xen_vm *result, xen_vm_record *record)
-{
- abstract_value param_values[] =
- {
- { .type = &xen_vm_record_abstract_type_,
- .u.struct_val = record }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VM.create");
- return session->ok;
-}
-
-
-bool
-xen_vm_destroy(xen_session *session, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- xen_call_(session, "VM.destroy", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_get_by_name_label(xen_session *session, struct xen_vm_set **result, char *label)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = label }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("VM.get_by_name_label");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_power_state(xen_session *session, enum xen_vm_power_state *result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = xen_vm_power_state_abstract_type_;
- XEN_CALL_("VM.get_power_state");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_name_label(xen_session *session, char **result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VM.get_name_label");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_name_description(xen_session *session, char **result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VM.get_name_description");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_user_version(xen_session *session, int64_t *result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_int;
-
- XEN_CALL_("VM.get_user_version");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_is_a_template(xen_session *session, bool *result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_bool;
-
- XEN_CALL_("VM.get_is_a_template");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_auto_power_on(xen_session *session, bool *result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_bool;
-
- XEN_CALL_("VM.get_auto_power_on");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_suspend_vdi(xen_session *session, xen_vdi *result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VM.get_suspend_VDI");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_resident_on(xen_session *session, xen_host *result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VM.get_resident_on");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_memory_static_max(xen_session *session, int64_t *result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_int;
-
- XEN_CALL_("VM.get_memory_static_max");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_memory_dynamic_max(xen_session *session, int64_t *result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_int;
-
- XEN_CALL_("VM.get_memory_dynamic_max");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_memory_dynamic_min(xen_session *session, int64_t *result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_int;
-
- XEN_CALL_("VM.get_memory_dynamic_min");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_memory_static_min(xen_session *session, int64_t *result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_int;
-
- XEN_CALL_("VM.get_memory_static_min");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_vcpus_params(xen_session *session, xen_string_string_map **result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_string_string_map;
-
- *result = NULL;
- XEN_CALL_("VM.get_VCPUs_params");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_vcpus_max(xen_session *session, int64_t *result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_int;
-
- XEN_CALL_("VM.get_VCPUs_max");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_vcpus_at_startup(xen_session *session, int64_t *result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_int;
-
- XEN_CALL_("VM.get_VCPUs_at_startup");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_actions_after_shutdown(xen_session *session, enum xen_on_normal_exit *result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = xen_on_normal_exit_abstract_type_;
- XEN_CALL_("VM.get_actions_after_shutdown");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_actions_after_reboot(xen_session *session, enum xen_on_normal_exit *result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = xen_on_normal_exit_abstract_type_;
- XEN_CALL_("VM.get_actions_after_reboot");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_actions_after_crash(xen_session *session, enum xen_on_crash_behaviour *result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = xen_on_crash_behaviour_abstract_type_;
- XEN_CALL_("VM.get_actions_after_crash");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_consoles(xen_session *session, struct xen_console_set **result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("VM.get_consoles");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_vifs(xen_session *session, struct xen_vif_set **result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("VM.get_VIFs");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_vbds(xen_session *session, struct xen_vbd_set **result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("VM.get_VBDs");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_crash_dumps(xen_session *session, struct xen_crashdump_set **result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("VM.get_crash_dumps");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_pv_bootloader(xen_session *session, char **result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VM.get_PV_bootloader");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_pv_kernel(xen_session *session, char **result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VM.get_PV_kernel");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_pv_ramdisk(xen_session *session, char **result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VM.get_PV_ramdisk");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_pv_args(xen_session *session, char **result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VM.get_PV_args");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_pv_bootloader_args(xen_session *session, char **result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VM.get_PV_bootloader_args");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_hvm_boot_policy(xen_session *session, char **result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VM.get_HVM_boot_policy");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_hvm_boot_params(xen_session *session, xen_string_string_map **result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_string_string_map;
-
- *result = NULL;
- XEN_CALL_("VM.get_HVM_boot_params");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_platform(xen_session *session, xen_string_string_map **result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_string_string_map;
-
- *result = NULL;
- XEN_CALL_("VM.get_platform");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_pci_bus(xen_session *session, char **result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VM.get_PCI_bus");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_other_config(xen_session *session, xen_string_string_map **result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_string_string_map;
-
- *result = NULL;
- XEN_CALL_("VM.get_other_config");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_domid(xen_session *session, int64_t *result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_int;
-
- XEN_CALL_("VM.get_domid");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_is_control_domain(xen_session *session, bool *result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_bool;
-
- XEN_CALL_("VM.get_is_control_domain");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_metrics(xen_session *session, xen_vm_metrics *result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VM.get_metrics");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_guest_metrics(xen_session *session, xen_vm_guest_metrics *result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VM.get_guest_metrics");
- return session->ok;
-}
-
-
-bool
-xen_vm_set_name_label(xen_session *session, xen_vm vm, char *label)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string,
- .u.string_val = label }
- };
-
- xen_call_(session, "VM.set_name_label", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_set_name_description(xen_session *session, xen_vm vm, char *description)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string,
- .u.string_val = description }
- };
-
- xen_call_(session, "VM.set_name_description", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_set_user_version(xen_session *session, xen_vm vm, int64_t user_version)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_int,
- .u.int_val = user_version }
- };
-
- xen_call_(session, "VM.set_user_version", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_set_is_a_template(xen_session *session, xen_vm vm, bool is_a_template)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_bool,
- .u.bool_val = is_a_template }
- };
-
- xen_call_(session, "VM.set_is_a_template", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_set_auto_power_on(xen_session *session, xen_vm vm, bool auto_power_on)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_bool,
- .u.bool_val = auto_power_on }
- };
-
- xen_call_(session, "VM.set_auto_power_on", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_set_memory_static_max(xen_session *session, xen_vm vm, int64_t static_max)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_int,
- .u.int_val = static_max }
- };
-
- xen_call_(session, "VM.set_memory_static_max", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_set_memory_dynamic_max(xen_session *session, xen_vm vm, int64_t dynamic_max)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_int,
- .u.int_val = dynamic_max }
- };
-
- xen_call_(session, "VM.set_memory_dynamic_max", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_set_memory_dynamic_min(xen_session *session, xen_vm vm, int64_t dynamic_min)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_int,
- .u.int_val = dynamic_min }
- };
-
- xen_call_(session, "VM.set_memory_dynamic_min", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_set_memory_static_min(xen_session *session, xen_vm vm, int64_t static_min)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_int,
- .u.int_val = static_min }
- };
-
- xen_call_(session, "VM.set_memory_static_min", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_set_vcpus_params(xen_session *session, xen_vm vm, xen_string_string_map *params)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string_string_map,
- .u.set_val = (arbitrary_set *)params }
- };
-
- xen_call_(session, "VM.set_VCPUs_params", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_add_to_vcpus_params(xen_session *session, xen_vm vm, char *key, char *value)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string,
- .u.string_val = key },
- { .type = &abstract_type_string,
- .u.string_val = value }
- };
-
- xen_call_(session, "VM.add_to_VCPUs_params", param_values, 3, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_remove_from_vcpus_params(xen_session *session, xen_vm vm, char *key)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string,
- .u.string_val = key }
- };
-
- xen_call_(session, "VM.remove_from_VCPUs_params", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_set_vcpus_max(xen_session *session, xen_vm vm, int64_t max)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_int,
- .u.int_val = max }
- };
-
- xen_call_(session, "VM.set_VCPUs_max", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_set_vcpus_at_startup(xen_session *session, xen_vm vm, int64_t at_startup)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_int,
- .u.int_val = at_startup }
- };
-
- xen_call_(session, "VM.set_VCPUs_at_startup", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_set_actions_after_shutdown(xen_session *session, xen_vm vm, enum xen_on_normal_exit after_shutdown)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &xen_on_normal_exit_abstract_type_,
- .u.enum_val = after_shutdown }
- };
-
- xen_call_(session, "VM.set_actions_after_shutdown", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_set_actions_after_reboot(xen_session *session, xen_vm vm, enum xen_on_normal_exit after_reboot)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &xen_on_normal_exit_abstract_type_,
- .u.enum_val = after_reboot }
- };
-
- xen_call_(session, "VM.set_actions_after_reboot", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_set_actions_after_crash(xen_session *session, xen_vm vm, enum xen_on_crash_behaviour after_crash)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &xen_on_crash_behaviour_abstract_type_,
- .u.enum_val = after_crash }
- };
-
- xen_call_(session, "VM.set_actions_after_crash", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_set_pv_bootloader(xen_session *session, xen_vm vm, char *bootloader)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string,
- .u.string_val = bootloader }
- };
-
- xen_call_(session, "VM.set_PV_bootloader", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_set_pv_kernel(xen_session *session, xen_vm vm, char *kernel)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string,
- .u.string_val = kernel }
- };
-
- xen_call_(session, "VM.set_PV_kernel", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_set_pv_ramdisk(xen_session *session, xen_vm vm, char *ramdisk)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string,
- .u.string_val = ramdisk }
- };
-
- xen_call_(session, "VM.set_PV_ramdisk", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_set_pv_args(xen_session *session, xen_vm vm, char *args)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string,
- .u.string_val = args }
- };
-
- xen_call_(session, "VM.set_PV_args", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_set_pv_bootloader_args(xen_session *session, xen_vm vm, char *bootloader_args)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string,
- .u.string_val = bootloader_args }
- };
-
- xen_call_(session, "VM.set_PV_bootloader_args", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_set_hvm_boot_policy(xen_session *session, xen_vm vm, char *boot_policy)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string,
- .u.string_val = boot_policy }
- };
-
- xen_call_(session, "VM.set_HVM_boot_policy", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_set_hvm_boot_params(xen_session *session, xen_vm vm, xen_string_string_map *boot_params)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string_string_map,
- .u.set_val = (arbitrary_set *)boot_params }
- };
-
- xen_call_(session, "VM.set_HVM_boot_params", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_add_to_hvm_boot_params(xen_session *session, xen_vm vm, char *key, char *value)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string,
- .u.string_val = key },
- { .type = &abstract_type_string,
- .u.string_val = value }
- };
-
- xen_call_(session, "VM.add_to_HVM_boot_params", param_values, 3, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_remove_from_hvm_boot_params(xen_session *session, xen_vm vm, char *key)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string,
- .u.string_val = key }
- };
-
- xen_call_(session, "VM.remove_from_HVM_boot_params", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_set_platform(xen_session *session, xen_vm vm, xen_string_string_map *platform)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string_string_map,
- .u.set_val = (arbitrary_set *)platform }
- };
-
- xen_call_(session, "VM.set_platform", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_add_to_platform(xen_session *session, xen_vm vm, char *key, char *value)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string,
- .u.string_val = key },
- { .type = &abstract_type_string,
- .u.string_val = value }
- };
-
- xen_call_(session, "VM.add_to_platform", param_values, 3, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_remove_from_platform(xen_session *session, xen_vm vm, char *key)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string,
- .u.string_val = key }
- };
-
- xen_call_(session, "VM.remove_from_platform", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_set_pci_bus(xen_session *session, xen_vm vm, char *pci_bus)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string,
- .u.string_val = pci_bus }
- };
-
- xen_call_(session, "VM.set_PCI_bus", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_set_other_config(xen_session *session, xen_vm vm, xen_string_string_map *other_config)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string_string_map,
- .u.set_val = (arbitrary_set *)other_config }
- };
-
- xen_call_(session, "VM.set_other_config", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_add_to_other_config(xen_session *session, xen_vm vm, char *key, char *value)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string,
- .u.string_val = key },
- { .type = &abstract_type_string,
- .u.string_val = value }
- };
-
- xen_call_(session, "VM.add_to_other_config", param_values, 3, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_remove_from_other_config(xen_session *session, xen_vm vm, char *key)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string,
- .u.string_val = key }
- };
-
- xen_call_(session, "VM.remove_from_other_config", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_clone(xen_session *session, xen_vm *result, xen_vm vm, char *new_name)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string,
- .u.string_val = new_name }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VM.clone");
- return session->ok;
-}
-
-
-bool
-xen_vm_start(xen_session *session, xen_vm vm, bool start_paused)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_bool,
- .u.bool_val = start_paused }
- };
-
- xen_call_(session, "VM.start", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_pause(xen_session *session, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- xen_call_(session, "VM.pause", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_unpause(xen_session *session, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- xen_call_(session, "VM.unpause", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_clean_shutdown(xen_session *session, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- xen_call_(session, "VM.clean_shutdown", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_clean_reboot(xen_session *session, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- xen_call_(session, "VM.clean_reboot", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_hard_shutdown(xen_session *session, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- xen_call_(session, "VM.hard_shutdown", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_hard_reboot(xen_session *session, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- xen_call_(session, "VM.hard_reboot", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_suspend(xen_session *session, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- xen_call_(session, "VM.suspend", param_values, 1, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_resume(xen_session *session, xen_vm vm, bool start_paused)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_bool,
- .u.bool_val = start_paused }
- };
-
- xen_call_(session, "VM.resume", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_set_vcpus_number_live(xen_session *session, xen_vm self, int64_t nvcpu)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = self },
- { .type = &abstract_type_int,
- .u.int_val = nvcpu }
- };
-
- xen_call_(session, "VM.set_VCPUs_number_live", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_add_to_vcpus_params_live(xen_session *session, xen_vm self, char *key, char *value)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = self },
- { .type = &abstract_type_string,
- .u.string_val = key },
- { .type = &abstract_type_string,
- .u.string_val = value }
- };
-
- xen_call_(session, "VM.add_to_VCPUs_params_live", param_values, 3, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_set_memory_dynamic_max_live(xen_session *session, xen_vm self, int64_t max)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = self },
- { .type = &abstract_type_int,
- .u.int_val = max }
- };
-
- xen_call_(session, "VM.set_memory_dynamic_max_live", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_set_memory_dynamic_min_live(xen_session *session, xen_vm self, int64_t min)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = self },
- { .type = &abstract_type_int,
- .u.int_val = min }
- };
-
- xen_call_(session, "VM.set_memory_dynamic_min_live", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_send_sysrq(xen_session *session, xen_vm vm, char *key)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string,
- .u.string_val = key }
- };
-
- xen_call_(session, "VM.send_sysrq", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_send_trigger(xen_session *session, xen_vm vm, char *trigger)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string,
- .u.string_val = trigger }
- };
-
- xen_call_(session, "VM.send_trigger", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_migrate(xen_session *session, xen_vm vm, char *dest, bool live, xen_string_string_map *options)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string,
- .u.string_val = dest },
- { .type = &abstract_type_bool,
- .u.bool_val = live },
- { .type = &abstract_type_string_string_map,
- .u.set_val = (arbitrary_set *)options }
- };
-
- xen_call_(session, "VM.migrate", param_values, 4, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_get_all(xen_session *session, struct xen_vm_set **result)
-{
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- xen_call_(session, "VM.get_all", NULL, 0, &result_type, result);
- return session->ok;
-}
-
-
-bool
-xen_vm_get_uuid(xen_session *session, char **result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VM.get_uuid");
- return session->ok;
-}
-
-
-bool
-xen_vm_set_security_label(xen_session *session, int64_t *result, xen_vm vm,
- char *label, char *oldlabel)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string,
- .u.string_val = label },
- { .type = &abstract_type_string,
- .u.string_val = oldlabel },
- };
-
- abstract_type result_type = abstract_type_int;
-
- *result = 0;
- XEN_CALL_("VM.set_security_label");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_security_label(xen_session *session, char **result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VM.get_security_label");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_cpu_pool(xen_session *session, struct xen_cpu_pool_set **result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("VM.get_cpu_pool");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_pool_name(xen_session *session, char **result, xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VM.get_pool_name");
- return session->ok;
-}
-
-
-bool
-xen_vm_set_pool_name(xen_session *session, xen_vm vm, char *pool_name)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string,
- .u.string_val = pool_name }
- };
-
- xen_call_(session, "VM.set_pool_name", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vm_cpu_pool_migrate(xen_session *session, xen_vm vm, xen_cpu_pool cpu_pool)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm },
- { .type = &abstract_type_string,
- .u.string_val = cpu_pool }
- };
-
- xen_call_(session, "VM.cpu_pool_migrate", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
+++ /dev/null
-/*
- * 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
- */
-
-
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "xen_internal.h"
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_string_string_map.h>
-#include <xen/api/xen_vm_guest_metrics.h>
-
-
-XEN_FREE(xen_vm_guest_metrics)
-XEN_SET_ALLOC_FREE(xen_vm_guest_metrics)
-XEN_ALLOC(xen_vm_guest_metrics_record)
-XEN_SET_ALLOC_FREE(xen_vm_guest_metrics_record)
-XEN_ALLOC(xen_vm_guest_metrics_record_opt)
-XEN_RECORD_OPT_FREE(xen_vm_guest_metrics)
-XEN_SET_ALLOC_FREE(xen_vm_guest_metrics_record_opt)
-
-
-static const struct_member xen_vm_guest_metrics_record_struct_members[] =
- {
- { .key = "uuid",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vm_guest_metrics_record, uuid) },
- { .key = "os_version",
- .type = &abstract_type_string_string_map,
- .offset = offsetof(xen_vm_guest_metrics_record, os_version) },
- { .key = "PV_drivers_version",
- .type = &abstract_type_string_string_map,
- .offset = offsetof(xen_vm_guest_metrics_record, pv_drivers_version) },
- { .key = "memory",
- .type = &abstract_type_string_string_map,
- .offset = offsetof(xen_vm_guest_metrics_record, memory) },
- { .key = "disks",
- .type = &abstract_type_string_string_map,
- .offset = offsetof(xen_vm_guest_metrics_record, disks) },
- { .key = "networks",
- .type = &abstract_type_string_string_map,
- .offset = offsetof(xen_vm_guest_metrics_record, networks) },
- { .key = "other",
- .type = &abstract_type_string_string_map,
- .offset = offsetof(xen_vm_guest_metrics_record, other) },
- { .key = "last_updated",
- .type = &abstract_type_datetime,
- .offset = offsetof(xen_vm_guest_metrics_record, last_updated) }
- };
-
-const abstract_type xen_vm_guest_metrics_record_abstract_type_ =
- {
- .typename = STRUCT,
- .struct_size = sizeof(xen_vm_guest_metrics_record),
- .member_count =
- sizeof(xen_vm_guest_metrics_record_struct_members) / sizeof(struct_member),
- .members = xen_vm_guest_metrics_record_struct_members
- };
-
-
-void
-xen_vm_guest_metrics_record_free(xen_vm_guest_metrics_record *record)
-{
- if (record == NULL)
- {
- return;
- }
- free(record->handle);
- free(record->uuid);
- xen_string_string_map_free(record->os_version);
- xen_string_string_map_free(record->pv_drivers_version);
- xen_string_string_map_free(record->memory);
- xen_string_string_map_free(record->disks);
- xen_string_string_map_free(record->networks);
- xen_string_string_map_free(record->other);
- free(record);
-}
-
-
-bool
-xen_vm_guest_metrics_get_record(xen_session *session, xen_vm_guest_metrics_record **result, xen_vm_guest_metrics vm_guest_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm_guest_metrics }
- };
-
- abstract_type result_type = xen_vm_guest_metrics_record_abstract_type_;
-
- *result = NULL;
- XEN_CALL_("VM_guest_metrics.get_record");
-
- if (session->ok)
- {
- (*result)->handle = xen_strdup_((*result)->uuid);
- }
-
- return session->ok;
-}
-
-
-bool
-xen_vm_guest_metrics_get_by_uuid(xen_session *session, xen_vm_guest_metrics *result, char *uuid)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = uuid }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VM_guest_metrics.get_by_uuid");
- return session->ok;
-}
-
-
-bool
-xen_vm_guest_metrics_get_os_version(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm_guest_metrics }
- };
-
- abstract_type result_type = abstract_type_string_string_map;
-
- *result = NULL;
- XEN_CALL_("VM_guest_metrics.get_os_version");
- return session->ok;
-}
-
-
-bool
-xen_vm_guest_metrics_get_pv_drivers_version(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm_guest_metrics }
- };
-
- abstract_type result_type = abstract_type_string_string_map;
-
- *result = NULL;
- XEN_CALL_("VM_guest_metrics.get_PV_drivers_version");
- return session->ok;
-}
-
-
-bool
-xen_vm_guest_metrics_get_memory(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm_guest_metrics }
- };
-
- abstract_type result_type = abstract_type_string_string_map;
-
- *result = NULL;
- XEN_CALL_("VM_guest_metrics.get_memory");
- return session->ok;
-}
-
-
-bool
-xen_vm_guest_metrics_get_disks(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm_guest_metrics }
- };
-
- abstract_type result_type = abstract_type_string_string_map;
-
- *result = NULL;
- XEN_CALL_("VM_guest_metrics.get_disks");
- return session->ok;
-}
-
-
-bool
-xen_vm_guest_metrics_get_networks(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm_guest_metrics }
- };
-
- abstract_type result_type = abstract_type_string_string_map;
-
- *result = NULL;
- XEN_CALL_("VM_guest_metrics.get_networks");
- return session->ok;
-}
-
-
-bool
-xen_vm_guest_metrics_get_other(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm_guest_metrics }
- };
-
- abstract_type result_type = abstract_type_string_string_map;
-
- *result = NULL;
- XEN_CALL_("VM_guest_metrics.get_other");
- return session->ok;
-}
-
-
-bool
-xen_vm_guest_metrics_get_last_updated(xen_session *session, time_t *result, xen_vm_guest_metrics vm_guest_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm_guest_metrics }
- };
-
- abstract_type result_type = abstract_type_datetime;
-
- XEN_CALL_("VM_guest_metrics.get_last_updated");
- return session->ok;
-}
-
-
-bool
-xen_vm_guest_metrics_get_all(xen_session *session, struct xen_vm_guest_metrics_set **result)
-{
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- xen_call_(session, "VM_guest_metrics.get_all", NULL, 0, &result_type, result);
- return session->ok;
-}
-
-
-bool
-xen_vm_guest_metrics_get_uuid(xen_session *session, char **result, xen_vm_guest_metrics vm_guest_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm_guest_metrics }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VM_guest_metrics.get_uuid");
- return session->ok;
-}
+++ /dev/null
-/*
- * 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
- */
-
-
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "xen_internal.h"
-#include <xen/api/xen_common.h>
-#include <xen/api/xen_int_float_map.h>
-#include <xen/api/xen_int_int_map.h>
-#include <xen/api/xen_int_string_set_map.h>
-#include <xen/api/xen_string_string_map.h>
-#include <xen/api/xen_vm_metrics.h>
-
-
-XEN_FREE(xen_vm_metrics)
-XEN_SET_ALLOC_FREE(xen_vm_metrics)
-XEN_ALLOC(xen_vm_metrics_record)
-XEN_SET_ALLOC_FREE(xen_vm_metrics_record)
-XEN_ALLOC(xen_vm_metrics_record_opt)
-XEN_RECORD_OPT_FREE(xen_vm_metrics)
-XEN_SET_ALLOC_FREE(xen_vm_metrics_record_opt)
-
-
-static const struct_member xen_vm_metrics_record_struct_members[] =
- {
- { .key = "uuid",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vm_metrics_record, uuid) },
- { .key = "memory_actual",
- .type = &abstract_type_int,
- .offset = offsetof(xen_vm_metrics_record, memory_actual) },
- { .key = "VCPUs_number",
- .type = &abstract_type_int,
- .offset = offsetof(xen_vm_metrics_record, vcpus_number) },
- { .key = "VCPUs_utilisation",
- .type = &abstract_type_int_float_map,
- .offset = offsetof(xen_vm_metrics_record, vcpus_utilisation) },
- { .key = "VCPUs_CPU",
- .type = &abstract_type_int_int_map,
- .offset = offsetof(xen_vm_metrics_record, vcpus_cpu) },
- { .key = "VCPUs_params",
- .type = &abstract_type_string_string_map,
- .offset = offsetof(xen_vm_metrics_record, vcpus_params) },
- { .key = "VCPUs_flags",
- .type = &abstract_type_int_string_set_map,
- .offset = offsetof(xen_vm_metrics_record, vcpus_flags) },
- { .key = "state",
- .type = &abstract_type_string_set,
- .offset = offsetof(xen_vm_metrics_record, state) },
- { .key = "start_time",
- .type = &abstract_type_datetime,
- .offset = offsetof(xen_vm_metrics_record, start_time) },
- { .key = "last_updated",
- .type = &abstract_type_datetime,
- .offset = offsetof(xen_vm_metrics_record, last_updated) }
- };
-
-const abstract_type xen_vm_metrics_record_abstract_type_ =
- {
- .typename = STRUCT,
- .struct_size = sizeof(xen_vm_metrics_record),
- .member_count =
- sizeof(xen_vm_metrics_record_struct_members) / sizeof(struct_member),
- .members = xen_vm_metrics_record_struct_members
- };
-
-
-void
-xen_vm_metrics_record_free(xen_vm_metrics_record *record)
-{
- if (record == NULL)
- {
- return;
- }
- free(record->handle);
- free(record->uuid);
- xen_int_float_map_free(record->vcpus_utilisation);
- xen_int_int_map_free(record->vcpus_cpu);
- xen_string_string_map_free(record->vcpus_params);
- xen_int_string_set_map_free(record->vcpus_flags);
- xen_string_set_free(record->state);
- free(record);
-}
-
-
-bool
-xen_vm_metrics_get_record(xen_session *session, xen_vm_metrics_record **result, xen_vm_metrics vm_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm_metrics }
- };
-
- abstract_type result_type = xen_vm_metrics_record_abstract_type_;
-
- *result = NULL;
- XEN_CALL_("VM_metrics.get_record");
-
- if (session->ok)
- {
- (*result)->handle = xen_strdup_((*result)->uuid);
- }
-
- return session->ok;
-}
-
-
-bool
-xen_vm_metrics_get_by_uuid(xen_session *session, xen_vm_metrics *result, char *uuid)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = uuid }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VM_metrics.get_by_uuid");
- return session->ok;
-}
-
-
-bool
-xen_vm_metrics_get_memory_actual(xen_session *session, int64_t *result, xen_vm_metrics vm_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm_metrics }
- };
-
- abstract_type result_type = abstract_type_int;
-
- XEN_CALL_("VM_metrics.get_memory_actual");
- return session->ok;
-}
-
-
-bool
-xen_vm_metrics_get_vcpus_number(xen_session *session, int64_t *result, xen_vm_metrics vm_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm_metrics }
- };
-
- abstract_type result_type = abstract_type_int;
-
- XEN_CALL_("VM_metrics.get_VCPUs_number");
- return session->ok;
-}
-
-
-bool
-xen_vm_metrics_get_vcpus_utilisation(xen_session *session, xen_int_float_map **result, xen_vm_metrics vm_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm_metrics }
- };
-
- abstract_type result_type = abstract_type_int_float_map;
-
- *result = NULL;
- XEN_CALL_("VM_metrics.get_VCPUs_utilisation");
- return session->ok;
-}
-
-
-bool
-xen_vm_metrics_get_vcpus_cpu(xen_session *session, xen_int_int_map **result, xen_vm_metrics vm_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm_metrics }
- };
-
- abstract_type result_type = abstract_type_int_int_map;
-
- *result = NULL;
- XEN_CALL_("VM_metrics.get_VCPUs_CPU");
- return session->ok;
-}
-
-
-bool
-xen_vm_metrics_get_vcpus_params(xen_session *session, xen_string_string_map **result, xen_vm_metrics vm_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm_metrics }
- };
-
- abstract_type result_type = abstract_type_string_string_map;
-
- *result = NULL;
- XEN_CALL_("VM_metrics.get_VCPUs_params");
- return session->ok;
-}
-
-
-bool
-xen_vm_metrics_get_vcpus_flags(xen_session *session, xen_int_string_set_map **result, xen_vm_metrics vm_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm_metrics }
- };
-
- abstract_type result_type = abstract_type_int_string_set_map;
-
- *result = NULL;
- XEN_CALL_("VM_metrics.get_VCPUs_flags");
- return session->ok;
-}
-
-
-bool
-xen_vm_metrics_get_state(xen_session *session, struct xen_string_set **result, xen_vm_metrics vm_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm_metrics }
- };
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- XEN_CALL_("VM_metrics.get_state");
- return session->ok;
-}
-
-
-bool
-xen_vm_metrics_get_start_time(xen_session *session, time_t *result, xen_vm_metrics vm_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm_metrics }
- };
-
- abstract_type result_type = abstract_type_datetime;
-
- XEN_CALL_("VM_metrics.get_start_time");
- return session->ok;
-}
-
-
-bool
-xen_vm_metrics_get_last_updated(xen_session *session, time_t *result, xen_vm_metrics vm_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm_metrics }
- };
-
- abstract_type result_type = abstract_type_datetime;
-
- XEN_CALL_("VM_metrics.get_last_updated");
- return session->ok;
-}
-
-
-bool
-xen_vm_metrics_get_all(xen_session *session, struct xen_vm_metrics_set **result)
-{
-
- abstract_type result_type = abstract_type_string_set;
-
- *result = NULL;
- xen_call_(session, "VM_metrics.get_all", NULL, 0, &result_type, result);
- return session->ok;
-}
-
-
-bool
-xen_vm_metrics_get_uuid(xen_session *session, char **result, xen_vm_metrics vm_metrics)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm_metrics }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VM_metrics.get_uuid");
- return session->ok;
-}
+++ /dev/null
-/*
- * 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
- */
-
-#include <string.h>
-
-#include "xen_internal.h"
-#include <xen/api/xen_vm_power_state.h>
-#include "xen_vm_power_state_internal.h"
-
-
-/*
- * Maintain this in the same order as the enum declaration!
- */
-static const char *lookup_table[] =
-{
- "Halted",
- "Paused",
- "Running",
- "Suspended",
- "Crashed",
- "Unknown"
-};
-
-
-extern xen_vm_power_state_set *
-xen_vm_power_state_set_alloc(size_t size)
-{
- return calloc(1, sizeof(xen_vm_power_state_set) +
- size * sizeof(enum xen_vm_power_state));
-}
-
-
-extern void
-xen_vm_power_state_set_free(xen_vm_power_state_set *set)
-{
- free(set);
-}
-
-
-const char *
-xen_vm_power_state_to_string(enum xen_vm_power_state val)
-{
- return lookup_table[val];
-}
-
-
-extern enum xen_vm_power_state
-xen_vm_power_state_from_string(xen_session *session, const char *str)
-{
- return ENUM_LOOKUP(session, str, lookup_table);
-}
-
-
-const abstract_type xen_vm_power_state_abstract_type_ =
- {
- .typename = ENUM,
- .enum_marshaller =
- (const char *(*)(int))&xen_vm_power_state_to_string,
- .enum_demarshaller =
- (int (*)(xen_session *, const char *))&xen_vm_power_state_from_string
- };
-
-
-const abstract_type xen_vm_power_state_set_abstract_type_ =
- {
- .typename = SET,
- .child = &xen_vm_power_state_abstract_type_
- };
-
-
+++ /dev/null
-/*
- * Copyright (c) 2007, IBM Corp.
- * Copyright (c) 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
- */
-
-
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "xen_internal.h"
-#include "xen/api/xen_common.h"
-#include "xen/api/xen_xspolicy.h"
-
-
-XEN_FREE(xen_xspolicy)
-XEN_SET_ALLOC_FREE(xen_xspolicy)
-XEN_RECORD_OPT_FREE(xen_xspolicy)
-
-static const struct_member xen_xspolicy_record_struct_members[] =
- {
- { .key = "uuid",
- .type = &abstract_type_string,
- .offset = offsetof(xen_xspolicy_record, uuid) },
- { .key = "flags",
- .type = &abstract_type_int,
- .offset = offsetof(xen_xspolicy_record, flags) },
- { .key = "repr",
- .type = &abstract_type_string,
- .offset = offsetof(xen_xspolicy_record, repr) },
- { .key = "type",
- .type = &abstract_type_int,
- .offset = offsetof(xen_xspolicy_record, type) },
- };
-
-const abstract_type xen_xspolicy_record_abstract_type_ =
- {
- .typename = STRUCT,
- .struct_size = sizeof(xen_xspolicy_record),
- .member_count =
- sizeof(xen_xspolicy_record_struct_members) / sizeof(struct_member),
- .members = xen_xspolicy_record_struct_members
- };
-
-
-static const struct_member xen_xs_policystate_struct_members[] =
- {
- { .key = "xs_ref",
- .type = &abstract_type_ref,
- .offset = offsetof(xen_xs_policystate, xs_ref) },
- { .key = "xserr",
- .type = &abstract_type_int,
- .offset = offsetof(xen_xs_policystate, xserr) },
- { .key = "repr",
- .type = &abstract_type_string,
- .offset = offsetof(xen_xs_policystate, repr) },
- { .key = "type",
- .type = &abstract_type_int,
- .offset = offsetof(xen_xs_policystate, type) },
- { .key = "flags",
- .type = &abstract_type_int,
- .offset = offsetof(xen_xs_policystate, flags) },
- { .key = "version",
- .type = &abstract_type_string,
- .offset = offsetof(xen_xs_policystate, version) },
- { .key = "errors",
- .type = &abstract_type_string,
- .offset = offsetof(xen_xs_policystate, errors) },
- };
-
-const abstract_type xen_xs_policystate_abstract_type_ =
- {
- .typename = STRUCT,
- .struct_size = sizeof(xen_xs_policystate),
- .member_count =
- sizeof(xen_xs_policystate_struct_members) /
- sizeof(struct_member),
- .members = xen_xs_policystate_struct_members,
- };
-
-
-
-
-void
-xen_xs_policystate_free(xen_xs_policystate *state)
-{
- if (state == NULL)
- {
- return;
- }
- xen_xspolicy_record_opt_free(state->xs_ref);
- free(state->repr);
- free(state->errors);
- free(state->version);
- free(state);
-}
-
-
-void
-xen_xspolicy_record_free(xen_xspolicy_record *record)
-{
- if (record == NULL)
- {
- return;
- }
- free(record->handle);
- free(record->uuid);
- free(record->repr);
- free(record);
-}
-
-
-bool
-xen_xspolicy_get_record(xen_session *session, xen_xspolicy_record **result,
- xen_xspolicy xspolicy)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = xspolicy }
- };
-
- abstract_type result_type = xen_xspolicy_record_abstract_type_;
-
- *result = NULL;
- XEN_CALL_("XSPolicy.get_record");
-
- if (session->ok)
- {
- (*result)->handle = xen_strdup_((*result)->uuid);
- }
-
- return session->ok;
-}
-
-
-bool
-xen_xspolicy_get_uuid(xen_session *session, char **result,
- xen_xspolicy xspolicy)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = xspolicy }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("XSPolicy.get_uuid");
- return session->ok;
-}
-
-
-bool
-xen_xspolicy_get_by_uuid(xen_session *session, xen_xspolicy *result,
- char *uuid)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = uuid }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("XSPolicy.get_by_uuid");
- return session->ok;
-}
-
-
-bool
-xen_xspolicy_get_xstype(xen_session *session, xs_type *result)
-{
- abstract_value param_values[] =
- {
- };
-
- abstract_type result_type = abstract_type_int;
-
- *result = 0;
- XEN_CALL_("XSPolicy.get_xstype");
- return session->ok;
-}
-
-
-bool
-xen_xspolicy_set_xspolicy(xen_session *session, xen_xs_policystate **result,
- xs_type type, char *repr,
- xs_instantiationflags flags,
- bool overwrite)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_int,
- .u.int_val = type },
- { .type = &abstract_type_string,
- .u.string_val = repr },
- { .type = &abstract_type_int,
- .u.int_val = flags },
- { .type = &abstract_type_bool,
- .u.bool_val = overwrite }
- };
-
- abstract_type result_type = xen_xs_policystate_abstract_type_;
-
- *result = NULL;
- XEN_CALL_("XSPolicy.set_xspolicy");
- return session->ok;
-}
-
-
-bool
-xen_xspolicy_reset_xspolicy(xen_session *session, xen_xs_policystate **result,
- xs_type type)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_int,
- .u.int_val = type },
- };
-
- abstract_type result_type = xen_xs_policystate_abstract_type_;
-
- *result = NULL;
- XEN_CALL_("XSPolicy.reset_xspolicy");
- return session->ok;
-}
-
-
-bool
-xen_xspolicy_get_xspolicy(xen_session *session, xen_xs_policystate **result)
-{
- abstract_value param_values[] =
- {
- };
-
- abstract_type result_type = xen_xs_policystate_abstract_type_;
-
- *result = NULL;
- XEN_CALL_("XSPolicy.get_xspolicy");
- return session->ok;
-}
-
-
-bool
-xen_xspolicy_get_labeled_resources(xen_session *session,
- xen_string_string_map **result)
-{
- abstract_value param_values[] =
- {
- };
-
- abstract_type result_type = abstract_type_string_string_map;
-
- *result = NULL;
- XEN_CALL_("XSPolicy.get_labeled_resources");
- return session->ok;
-}
-
-
-bool
-xen_xspolicy_set_resource_label(xen_session *session,
- char *resource, char *label,
- char *oldlabel)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = resource },
- { .type = &abstract_type_string,
- .u.string_val = label },
- { .type = &abstract_type_string,
- .u.string_val = oldlabel },
- };
-
- xen_call_(session, "XSPolicy.set_resource_label", param_values, 3,
- NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_xspolicy_get_resource_label(xen_session *session, char **result,
- char *resource)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = resource },
- };
-
- abstract_type result_type = abstract_type_string;
- XEN_CALL_("XSPolicy.get_resource_label");
- return session->ok;
-}
-
-
-bool
-xen_xspolicy_rm_xsbootpolicy(xen_session *session)
-{
- abstract_value param_values[] =
- {
- };
-
- xen_call_(session, "XSPolicy.rm_xsbootpolicy", param_values, 0,
- NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_xspolicy_activate_xspolicy(xen_session *session,
- xs_instantiationflags *result,
- xen_xspolicy xspolicy,
- xs_instantiationflags flags)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = xspolicy },
- { .type = &abstract_type_int,
- .u.int_val = flags },
- };
-
- abstract_type result_type = abstract_type_int;
-
- *result = 0;
- XEN_CALL_("XSPolicy.activate_xspolicy");
- return session->ok;
-}
-
-
-bool
-xen_xspolicy_can_run(xen_session *session, int64_t *result,
- char *security_label)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = security_label }
- };
-
- abstract_type result_type = abstract_type_int;
-
- *result = 0;
- XEN_CALL_("XSPolicy.can_run");
- return session->ok;
-}
+++ /dev/null
-/*
- * 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
- */
-
-#define _GNU_SOURCE
-#include <assert.h>
-#include <inttypes.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <libxml/parser.h>
-#include <curl/curl.h>
-#include <xen/api/xen_all.h>
-
-//#define PRINT_XML
-//////////////#define POOL_TESTS
-
-static void usage()
-{
- fprintf(stderr,
-"Usage:\n"
-"\n"
-" test_bindings <url> <username> <password>\n"
-"\n"
-"where\n"
-" <url> is a fragment of the server's URL, e.g. localhost:8005/RPC2;\n"
-" <username> is the username to use at the server; and\n"
-" <password> 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, bool hvm);
-static void print_session_info(xen_session *session);
-static void print_methods(xen_session *session);
-static void print_vm_power_state(xen_session *session, xen_vm vm);
-static void print_vm_metrics(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;
-#ifdef PRINT_XML
- printf("\n\n---Result from server -----------------------\n");
- printf("%s\n",((char*) ptr));
- fflush(stdout);
-#endif
- 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;
-
-#ifdef PRINT_XML
- printf("\n\n---Data to server: -----------------------\n");
- printf("%s\n",((char*) data));
- fflush(stdout);
-#endif
-
- 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");
-}
-
-
-#ifdef POOL_TESTS
-#define NAME_DESCRIPTION "TestPool"
-#define NAME_DESCRIPTION_2 "TestPool-2"
-#define NAME_LABEL "Pool-1"
-#define NAME_LABEL_2 "Pool-2"
-#define SCHED_NAME "credit"
-#define NCPU_VAL 2
-#define NCPU_VAL_2 1
-
-
-static int pool_tests(xen_session *session, xen_host host)
-{
- int rc = 1;
- xen_cpu_pool_set *pools = NULL;
- xen_host_record *host_record = NULL;
- xen_cpu_pool_record_opt *cpu_pool_opt = NULL;
- xen_cpu_pool_record *cpu_pool_rec = NULL;
- xen_host_cpu_set *host_cpu_set = NULL;
- xen_host_cpu_record *host_cpu_record = NULL;
- xen_vm_set *vm_set = NULL;
- xen_cpu_pool pool = NULL;
- xen_cpu_pool pool_out = NULL;
- xen_string_string_map *pool_other_config = NULL;
- xen_vm_record *vm_record = NULL;
- xen_string_set *proposed_cpus = NULL;
- xen_host res_host = NULL;
- char *name_description = NULL;
- char *name_label = NULL;
- char *sched_policy = NULL;
- char *pool_uuid = NULL;
- int64_t ncpu;
-
- for (int loop= 0; loop < 1; loop++)
- {
- // Test extensions of class host
- printf("Test cpu_pool extension of host class -----------------------------------------\n");
-
- printf("host.get_resident_cpu_pools\n");
- if (!xen_host_get_resident_cpu_pools(session, &pools, host))
- {
- break;
- }
- if (pools->size != 1)
- {
- printf("Wrong pool count; only one pool expected\n");
- break;
- }
- printf("Pool UUID %s\n", (char*)pools->contents[0]);
- xen_cpu_pool_set_free(pools);
- pools = NULL;
-
- printf("host.get_record\n");
- if (!xen_host_get_record(session, &host_record, host))
- {
- break;
- }
- printf("Pool count %d\n", (int)host_record->resident_cpu_pools->size);
- if (host_record->resident_cpu_pools->size != 1)
- {
- break;
- }
- cpu_pool_opt = host_record->resident_cpu_pools->contents[0];
- printf("Pool UUID %s\n", (char*)cpu_pool_opt->u.handle);
- xen_host_record_free(host_record);
- host_record = NULL;
- cpu_pool_opt = NULL;
-
-
- // Test extensions of class host_cpu
- printf("host_cpu.get_all\n");
- if (!xen_host_cpu_get_all(session, &host_cpu_set))
- {
- break;
- }
-
- printf("host_cpu.get_cpu_pool & host_cpu.get_record\n");
- for (int i= 0; i < host_cpu_set->size; i++)
- {
- if (!xen_host_cpu_get_cpu_pool(session, &pools, host_cpu_set->contents[i]))
- {
- break;
- }
- if (pools->size > 1)
- {
- printf("Wrong pool count (xen_host_cpu_get_cpu_pool)\n");
- break;
- }
-
- printf("host_cpu (get_cpu_pool) %s, cpu_pool %s\n", (char*)host_cpu_set->contents[i],
- pools->size != 0 ? (char*)pools->contents[0] : "(None)");
-
- if (!xen_host_cpu_get_record(session, &host_cpu_record, host_cpu_set->contents[i]))
- {
- break;
- }
- if (host_cpu_record->cpu_pools->size > 1)
- {
- printf("Wrong pool count (xen_host_cpu_get_record)\n");
- break;
- }
-
- printf("host_cpu (get_record) %s, cpu_pool %s\n", (char*)host_cpu_set->contents[i],
- host_cpu_record->cpu_pools->size != 0
- ? (char*)((xen_cpu_pool_record_opt*)(host_cpu_record->cpu_pools->contents[0])->u.handle)
- : "(None)");
-
- }
- xen_host_cpu_record_free(host_cpu_record);
- host_cpu_record = NULL;
- xen_host_cpu_set_free(host_cpu_set);
- host_cpu_set = NULL;
- xen_cpu_pool_set_free(pools);
- pools = NULL;
-
- printf("host_cpu.get_unassigned_cpus\n");
- if (!xen_host_cpu_get_unassigned_cpus(session, &host_cpu_set))
- {
- break;
- }
- printf("Free cpus (not bound to a pool)\n");
- for (int i= 0; i < host_cpu_set->size; i++)
- {
- printf(" cpu UUID %s\n", (char*)host_cpu_set->contents[i]);
- }
- xen_host_cpu_set_free(host_cpu_set);
- host_cpu_set = NULL;
-
-
- printf("vm.get_record\n");
- if (!xen_vm_get_all(session, &vm_set))
- {
- break;
- }
-
- if (!xen_vm_get_record(session, &vm_record, vm_set->contents[0]))
- {
- break;
- }
- printf("VM %s, pool_name %s, cpu_pool %s\n", (char*)vm_set->contents[0],
- vm_record->pool_name, (char*)vm_record->cpu_pool->contents[0]);
-
- xen_vm_record_free(vm_record);
- vm_record = NULL;
-
- printf("vm.get_cpu_pool\n");
- if (!xen_vm_get_cpu_pool(session, &pools, vm_set->contents[0]))
- {
- break;
- }
- printf("vm_get_cpu_pool %s\n", (char*)pools->contents[0]);
-
- xen_vm_set_free(vm_set);
- xen_cpu_pool_set_free(pools);
- vm_set = NULL;
- pools = NULL;
-
-
- // Class cpu_pool
-
- // create
- pool_other_config = xen_string_string_map_alloc(1);
- pool_other_config->contents[0].key = strdup("type");
- pool_other_config->contents[0].val = strdup("bs2000");
- xen_string_set *proposed_CPUs_set = xen_string_set_alloc(1);
- proposed_CPUs_set->contents[0] = strdup("3");
-
- xen_cpu_pool_record new_cpu_pool_record =
- {
- .name_label = NAME_LABEL,
- .name_description = NAME_DESCRIPTION,
- .auto_power_on = false,
- .ncpu = NCPU_VAL,
- .sched_policy = SCHED_NAME,
- .proposed_cpus = proposed_CPUs_set,
- .other_config = pool_other_config,
- };
-
- printf("cpu_pool.create\n");
- if (!xen_cpu_pool_create(session, &pool, &new_cpu_pool_record))
- {
- break;
- }
- printf("New Pool UUID %s\n", (char*)pool);
- xen_string_set_free(proposed_CPUs_set);
- proposed_CPUs_set = NULL;
- xen_string_string_map_free(pool_other_config);
- pool_other_config = NULL;
-
- // get_by_name_label
- printf("cpu_pool.get_by_name_label\n");
- if (!xen_cpu_pool_get_by_name_label(session, &pools, "Pool-1"))
- {
- break;
- }
- if (strcmp((char*)pools->contents[0], (char*)pool) != 0)
- {
- break;
- }
- xen_cpu_pool_set_free(pools);
- pools = NULL;
-
-
- // get_by_uuid
- printf("cpu_pool.get_by_uuid\n");
- if (!xen_cpu_pool_get_by_uuid(session, &pool_out, pool))
- {
- break;
- }
- if (strcmp((char*)pool_out, (char*)pool) != 0)
- {
- printf("Wrong pool returned\n");
- break;
- }
- xen_cpu_pool_free(pool_out);
- pool_out = NULL;
-
- // get_all
- printf("cpu_pool.get_all\n");
- if (!xen_cpu_pool_get_all(session, &pools))
- {
- break;
- }
- if (pools->size != 2)
- {
- printf("Wrong pool count (%d)\n", (int)pools->size);
- break;
- }
- xen_cpu_pool_set_free(pools);
- pools = NULL;
-
-
- // get_activated
- printf("cpu_pool.get_activated\n");
- bool activated_state = true;
- if (!xen_cpu_pool_get_activated(session, &activated_state, pool))
- {
- break;
- }
- if (activated_state)
- {
- printf("Pool must not be activated\n");
- break;
- }
-
-
- // get_auto_power_on
- printf("cpu_pool.get_auto_power_on\n");
- bool power_state = true;
- if (!xen_cpu_pool_get_auto_power_on(session, &power_state, pool))
- {
- break;
- }
- if (power_state)
- {
- printf("Pool must not have attibute 'auto_power_on'\n");
- break;
- }
-
- // get_host_CPUs
- printf("cpu_pool.get_host_CPUs\n");
- if (!xen_cpu_pool_get_host_CPUs(session, &host_cpu_set, pool))
- {
- break;
- }
- if (host_cpu_set->size != 0)
- {
- printf("Pool must not have any attached cpus\n");
- break;
- }
- xen_host_cpu_set_free(host_cpu_set);
- host_cpu_set = NULL;
-
-
- // get_name_description
- printf("cpu_pool.get_name_description\n");
- if (!xen_cpu_pool_get_name_description(session, &name_description, pool))
- {
- break;
- }
- if (strcmp(NAME_DESCRIPTION, name_description) != 0)
- {
- printf("Pool has wrong name_description\n");
- break;
- }
- free(name_description);
- name_description = NULL;
-
-
- // get_name_label
- printf("cpu_pool.get_name_label\n");
- if (!xen_cpu_pool_get_name_label(session, &name_label, pool))
- {
- break;
- }
- if (strcmp(NAME_LABEL, name_label) != 0)
- {
- printf("Pool has wrong name_label\n");
- break;
- }
- free(name_label);
- name_label = NULL;
-
- // get_ncpu
- printf("cpu_pool.get_ncpu\n");
- if (!xen_cpu_pool_get_ncpu(session, &ncpu, pool))
- {
- break;
- }
- if (NCPU_VAL != ncpu)
- {
- printf("Pool has wrong ncpu\n");
- break;
- }
-
- // get_proposed_CPUs
- printf("cpu_pool.get_proposed_CPUs\n");
- if (!xen_cpu_pool_get_proposed_CPUs(session, &proposed_cpus, pool))
- {
- break;
- }
- if (proposed_cpus->size != 1)
- {
- printf("Pool has wrong proposed_cpus count\n");
- break;
- }
- xen_string_set_free(proposed_cpus);
- proposed_cpus = NULL;
-
-
- // get_other_config
- printf("cpu_pool.get_other_config\n");
- if (!xen_cpu_pool_get_other_config(session, &pool_other_config, pool))
- {
- break;
- }
- if (pool_other_config->size != 1)
- {
- printf("Pool has wrong other_config element count\n");
- break;
- }
- if ((strcmp(pool_other_config->contents[0].key, "type") != 0) ||
- (strcmp(pool_other_config->contents[0].val, "bs2000") != 0))
- {
- printf("Pool has wrong other_config attributes\n");
- break;
- }
- xen_string_string_map_free(pool_other_config);
- pool_other_config = NULL;
-
-
- // get_record
- printf("cpu_pool.get_record\n");
- if (!xen_cpu_pool_get_record(session, &cpu_pool_rec, pool))
- {
- break;
- }
- if ( (strcmp(cpu_pool_rec->name_label, NAME_LABEL) != 0) ||
- (strcmp(cpu_pool_rec->name_description, NAME_DESCRIPTION) != 0) ||
- (cpu_pool_rec->auto_power_on) ||
- (cpu_pool_rec->ncpu != NCPU_VAL) ||
- (cpu_pool_rec->started_vms->size != 0) ||
- (strcmp(cpu_pool_rec->sched_policy, SCHED_NAME) != 0) ||
- (cpu_pool_rec->proposed_cpus->size != 1) ||
- (cpu_pool_rec->host_cpus->size != 0) ||
- (cpu_pool_rec->activated) ||
- (strcmp(cpu_pool_rec->resident_on->u.handle, host) != 0) ||
- (strcmp(cpu_pool_rec->uuid, pool) != 0) ||
- (cpu_pool_rec->other_config->size != 1))
- {
- printf("Wrong record output\n");
- break;
- }
- xen_cpu_pool_record_free(cpu_pool_rec);
- cpu_pool_rec = NULL;
-
-
- // get_resident_on
- printf("cpu_pool.get_resident_on\n");
- if (!xen_cpu_pool_get_resident_on(session, &res_host, pool))
- {
- break;
- }
- if (strcmp(res_host, host) != 0)
- {
- printf("Wrong resident host returned\n");
- break;
- }
- xen_host_free(res_host);
- res_host = NULL;
-
-
- // get_sched_policy
- printf("cpu_pool.get_sched_policy\n");
- if (!xen_cpu_pool_get_sched_policy(session, &sched_policy, pool))
- {
- break;
- }
- if (strcmp(sched_policy, SCHED_NAME) != 0)
- {
- printf("Wrong sched_policy returned\n");
- break;
- }
- free(sched_policy);
- sched_policy = NULL;
-
-
- // get_started_VMs
- printf("cpu_pool.get_started_VMs\n");
- if (!xen_cpu_pool_get_started_VMs(session, &vm_set, pool))
- {
- break;
- }
- if (vm_set->size != 0)
- {
- printf("Wrong count of started VMs\n");
- break;
- }
- xen_vm_set_free(vm_set);
- vm_set = NULL;
-
-
- // get_uuid
- printf("cpu_pool.get_uuid\n");
- if (!xen_cpu_pool_get_uuid(session, &pool_uuid, pool))
- {
- break;
- }
- if (strcmp(pool_uuid, pool) != 0)
- {
- printf("Wrong Pool UUID returnd\n");
- break;
- }
- free(pool_uuid);
- pool_uuid = NULL;
-
-
- // set_auto_power_on
- printf("cpu_pool.set_auto_power_on\n");
- if (!xen_cpu_pool_set_auto_power_on(session, pool, true))
- break;
-
-
- // set_proposed_CPUs
- printf("cpu_pool.set_proposed_CPUs\n");
- proposed_CPUs_set = xen_string_set_alloc(2);
- proposed_CPUs_set->contents[0] = strdup("2");
- proposed_CPUs_set->contents[1] = strdup("4");
- if (!xen_cpu_pool_set_proposed_CPUs(session, pool, proposed_CPUs_set))
- break;
- xen_string_set_free(proposed_CPUs_set);
- proposed_CPUs_set = NULL;
-
-
- // add_to_proposed_CPUs
- printf("cpu_pool.add_to_proposed_CPUs\n");
- if (!xen_cpu_pool_add_to_proposed_CPUs(session, pool, "3"))
- break;
-
-
- // remove_from_proposed_CPUs
- printf("cpu_pool.remove_from_proposed_CPUs\n");
- if (!xen_cpu_pool_remove_from_proposed_CPUs(session, pool, "4"))
- break;
-
-
- // set_name_label
- printf("cpu_pool.set_name_label\n");
- if (!xen_cpu_pool_set_name_label(session, pool, NAME_LABEL_2))
- break;
-
-
- // set_name_description
- printf("cpu_pool.set_name_description\n");
- if (!xen_cpu_pool_set_name_description(session, pool, NAME_DESCRIPTION_2))
- break;
-
-
- // set_ncpu
- printf("cpu_pool.set_ncpu\n");
- if (!xen_cpu_pool_set_ncpu(session, pool, NCPU_VAL_2))
- break;
-
-
- // set_other_config
- printf("cpu_pool.set_other_config\n");
- pool_other_config = xen_string_string_map_alloc(2);
- pool_other_config->contents[0].key = strdup("test1");
- pool_other_config->contents[0].val = strdup("field1");
- pool_other_config->contents[1].key = strdup("test2");
- pool_other_config->contents[1].val = strdup("field2");
- if (!xen_cpu_pool_set_other_config(session, pool, pool_other_config))
- break;
- xen_string_string_map_free(pool_other_config);
- pool_other_config = NULL;
-
-
- // add_to_other_config
- printf("cpu_pool.add_to_other_config\n");
- if (!xen_cpu_pool_add_to_other_config(session, pool, "test3", "field3"))
- break;
-
-
- // remove_from_other_config
- printf("cpu_pool.remove_from_other_config\n");
- if (!xen_cpu_pool_remove_from_other_config(session, pool, "test2"))
- break;
-
-
- // set_sched_policy
- printf("cpu_pool.set_sched_policy\n");
- if (!xen_cpu_pool_set_sched_policy(session, pool, SCHED_NAME))
- break;
-
-
- // check get_record again
- printf("check cpu_pool record\n");
- if (!xen_cpu_pool_get_record(session, &cpu_pool_rec, pool))
- {
- break;
- }
- if ( (strcmp(cpu_pool_rec->name_label, NAME_LABEL_2) != 0) ||
- (strcmp(cpu_pool_rec->name_description, NAME_DESCRIPTION_2) != 0) ||
- (!cpu_pool_rec->auto_power_on) ||
- (cpu_pool_rec->ncpu != NCPU_VAL_2) ||
- (cpu_pool_rec->started_vms->size != 0) ||
- (strcmp(cpu_pool_rec->sched_policy, SCHED_NAME) != 0) ||
- (cpu_pool_rec->proposed_cpus->size != 2) ||
- (cpu_pool_rec->host_cpus->size != 0) ||
- (cpu_pool_rec->activated) ||
- (strcmp(cpu_pool_rec->resident_on->u.handle, host) != 0) ||
- (strcmp(cpu_pool_rec->uuid, pool) != 0) ||
- (cpu_pool_rec->other_config->size != 2))
- {
- printf("Wrong record output\n");
- break;
- }
- xen_cpu_pool_record_free(cpu_pool_rec);
- cpu_pool_rec = NULL;
-
-
- // activate pool
- printf("cpu_pool.activate\n");
- if (!xen_cpu_pool_activate(session, pool))
- break;
-
-
- // add_host_CPU_live
- printf("cpu_pool.add_host_CPU_live\n");
- if (!xen_host_cpu_get_unassigned_cpus(session, &host_cpu_set))
- {
- break;
- }
- if (host_cpu_set->size < 1)
- {
- printf("No free CPU found\n");
- break;
- }
- if (!xen_cpu_pool_add_host_CPU_live(session, pool, host_cpu_set->contents[0]))
- break;
-
-
- // remove_host_CPU_live
- printf("cpu_pool.remove_host_CPU_live\n");
- if (!xen_cpu_pool_remove_host_CPU_live(session, pool, host_cpu_set->contents[0]))
- break;
-
- xen_host_cpu_set_free(host_cpu_set);
- host_cpu_set = NULL;
-
-
- // check get_record again
- printf("check cpu_pool record\n");
- if (!xen_cpu_pool_get_record(session, &cpu_pool_rec, pool))
- {
- break;
- }
- if ( (strcmp(cpu_pool_rec->name_label, NAME_LABEL_2) != 0) ||
- (strcmp(cpu_pool_rec->name_description, NAME_DESCRIPTION_2) != 0) ||
- (!cpu_pool_rec->auto_power_on) ||
- (cpu_pool_rec->ncpu != NCPU_VAL_2) ||
- (cpu_pool_rec->started_vms->size != 0) ||
- (strcmp(cpu_pool_rec->sched_policy, SCHED_NAME) != 0) ||
- (cpu_pool_rec->proposed_cpus->size != 2) ||
- (cpu_pool_rec->host_cpus->size != 1) ||
- (!cpu_pool_rec->activated) ||
- (strcmp(cpu_pool_rec->resident_on->u.handle, host) != 0) ||
- (strcmp(cpu_pool_rec->uuid, pool) != 0) ||
- (cpu_pool_rec->other_config->size != 2))
- {
- printf("Wrong record output\n");
- break;
- }
- xen_cpu_pool_record_free(cpu_pool_rec);
- cpu_pool_rec = NULL;
-
-
- // deactivate pool
- printf("cpu_pool.deactivate\n");
- if (!xen_cpu_pool_deactivate(session, pool))
- break;
-
-
- // Pool delete
- if (!xen_cpu_pool_destroy(session, pool))
- {
- break;
- }
- xen_cpu_pool_free(pool);
- pool = NULL;
-
- // Tests OK
- printf("Pool Tests OK\n");
- rc= 0;
- }
-
- if (rc != 0)
- {
- print_error(session);
- }
-
- xen_cpu_pool_set_free(pools);
- xen_host_record_free(host_record);
- xen_cpu_pool_record_opt_free(cpu_pool_opt);
- xen_host_cpu_set_free(host_cpu_set);
- xen_host_cpu_record_free(host_cpu_record);
- xen_vm_set_free(vm_set);
- xen_cpu_pool_free(pool);
- xen_cpu_pool_free(pool_out);
- xen_string_string_map_free(pool_other_config);
- xen_vm_record_free(vm_record);
- xen_string_set_free(proposed_cpus);
- free(name_description);
- free(name_label);
- free(sched_policy);
- free(pool_uuid);
- xen_cpu_pool_record_free(cpu_pool_rec);
- xen_host_free(res_host);
-
- return rc;
-}
-#endif
-
-
-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);
-
- print_session_info(session);
- if (!session->ok)
- {
- /* Error has been logged, just clean up. */
- CLEANUP;
- return 1;
- }
-
- print_methods(session);
- if (!session->ok)
- {
- /* Error has been logged, just clean up. */
- CLEANUP;
- return 1;
- }
-
- 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, session))
- {
- 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;
- }
-
- char *dmesg;
- if (!xen_host_dmesg(session, &dmesg, host))
- {
- print_error(session);
- xen_string_string_map_free(versions);
- 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;
- }
-
- xen_string_set *supported_bootloaders;
- if (!xen_host_get_supported_bootloaders(session, &supported_bootloaders,
- host))
- {
- print_error(session);
- free(dmesg);
- xen_string_string_map_free(versions);
- 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;
- }
-
- xen_string_set *capabilities;
- if (!xen_host_get_capabilities(session, &capabilities, host))
- {
- print_error(session);
- free(dmesg);
- xen_string_set_free(supported_bootloaders);
- xen_string_string_map_free(versions);
- 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;
- }
-
- xen_string_string_map *cpu_configuration;
- if (!xen_host_get_cpu_configuration(session, &cpu_configuration, host))
- {
- print_error(session);
- free(dmesg);
- xen_string_set_free(capabilities);
- xen_string_set_free(supported_bootloaders);
- xen_string_string_map_free(versions);
- 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;
- }
-
- char *sched_policy;
- if (!xen_host_get_sched_policy(session, &sched_policy, host))
- {
- print_error(session);
- xen_string_string_map_free(cpu_configuration);
- xen_string_set_free(capabilities);
- xen_string_set_free(supported_bootloaders);
- xen_string_string_map_free(versions);
- 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);
-
- printf("In bytes, the VM UUID is ");
- for (int i = 0; i < 15; i++)
- {
- printf("%x, ", (unsigned int)vm_uuid_bytes[i]);
- }
- printf("%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("Host dmesg follows:\n%s\n\n", dmesg);
-
- printf("Host supports the following bootloaders:");
- for (size_t i = 0; i < supported_bootloaders->size; i++)
- {
- printf(" %s", supported_bootloaders->contents[i]);
- }
- printf("\n");
-
- printf("Host has the following capabilities:");
- for (size_t i = 0; i < capabilities->size; i++)
- {
- printf(" %s", capabilities->contents[i]);
- }
- printf("\n");
-
- printf("Host has the following CPU configuration:\n");
- for (size_t i = 0; i < cpu_configuration->size; i++)
- {
- printf(" %s -> %s.\n", cpu_configuration->contents[i].key,
- cpu_configuration->contents[i].val);
- }
-
- printf("Current scheduler policy: %s.\n\n", sched_policy);
-
- 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));
-
- xen_uuid_bytes_free(vm_uuid_bytes);
- xen_uuid_free(vm_uuid);
-
- xen_vm_record_free(vm_record);
-
-#ifdef POOL_TESTS
- if (pool_tests(session, host) != 0)
- return 1;
-#endif
-
- xen_host_free(host);
- xen_string_string_map_free(versions);
- free(dmesg);
- xen_string_set_free(supported_bootloaders);
- xen_string_set_free(capabilities);
- xen_string_string_map_free(cpu_configuration);
- free(sched_policy);
-
- print_vm_metrics(session, vm);
- if (!session->ok)
- {
- /* Error has been logged, just clean up. */
- xen_vm_free(vm);
- CLEANUP;
- return 1;
- }
-
- xen_vm_free(vm);
-
- xen_vm new_vm = create_new_vm(session, true);
- 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, bool hvm)
-{
- xen_string_string_map *vcpus_params = xen_string_string_map_alloc(1);
- vcpus_params->contents[0].key = strdup("weight");
- vcpus_params->contents[0].val = strdup("300");
-
- xen_string_string_map *hvm_boot_params;
- if (hvm)
- {
- hvm_boot_params = xen_string_string_map_alloc(1);
- hvm_boot_params->contents[0].key = strdup("order");
- hvm_boot_params->contents[0].val = strdup("cd");
- }
- else
- {
- hvm_boot_params = NULL;
- }
-
- xen_vm_record vm_record =
- {
- .name_label = hvm ? "NewHVM" : "NewPV",
- .name_description = hvm ? "New HVM VM" : "New PV VM",
- .user_version = 1,
- .is_a_template = false,
- .memory_static_max = 256 * 1024 * 1024,
- .memory_dynamic_max = 256 * 1024 * 1024,
- .memory_dynamic_min = 128 * 1024 * 1024,
- .memory_static_min = 128 * 1024 * 1024,
- .vcpus_params = vcpus_params,
- .vcpus_max = 4,
- .vcpus_at_startup = 2,
- .actions_after_shutdown = XEN_ON_NORMAL_EXIT_DESTROY,
- .actions_after_reboot = XEN_ON_NORMAL_EXIT_RESTART,
- .actions_after_crash = XEN_ON_CRASH_BEHAVIOUR_RESTART,
- .hvm_boot_policy = hvm ? "BIOS order" : NULL,
- .hvm_boot_params = hvm ? hvm_boot_params : NULL,
- .pv_bootloader = hvm ? NULL : "pygrub",
- .pv_kernel = hvm ? NULL : "/boot/vmlinuz-2.6.16.33-xen",
- };
-
- xen_vm vm;
- xen_vm_create(session, &vm, &vm_record);
-
- xen_string_string_map_free(vcpus_params);
- xen_string_string_map_free(hvm_boot_params);
-
- 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, "QCoW") ||
- 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 = (INT64_C(1) << 30), // 1GiB
- .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,
- .bootable = 1,
- };
-
- 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;
- }
-
- xen_console vnc_console = NULL;
- if (hvm) {
- xen_console_record vnc_console_record =
- {
- .protocol = XEN_CONSOLE_PROTOCOL_RFB,
- .vm = &vm_record_opt,
- };
-
- if (!xen_console_create(session, &vnc_console, &vnc_console_record))
- {
- fprintf(stderr, "VNC console creation failed.\n");
- print_error(session);
-
- xen_vbd_free(vbd0);
- xen_vdi_free(vdi0);
- xen_sr_set_free(srs);
- xen_vm_free(vm);
- return NULL;
- }
- }
-
- char *vm_uuid;
- char *vdi0_uuid;
- char *vbd0_uuid;
- char *vnc_uuid = NULL;
-
- 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 (hvm) {
- xen_console_get_uuid(session, &vnc_uuid, vnc_console);
- }
-
- 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_uuid_free(vnc_uuid);
- xen_vbd_free(vbd0);
- xen_vdi_free(vdi0);
- xen_console_free(vnc_console);
- xen_sr_set_free(srs);
- xen_vm_free(vm);
- return NULL;
- }
-
- if (hvm) {
- printf("Created a new HVM VM, with UUID %s, VDI UUID %s, VBD "
- "UUID %s, and VNC console UUID %s.\n",
- vm_uuid, vdi0_uuid, vbd0_uuid, vnc_uuid);
- }
- else {
- printf("Created a new PV 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_uuid_free(vnc_uuid);
- xen_vbd_free(vbd0);
- xen_vdi_free(vdi0);
- xen_console_free(vnc_console);
- 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);
-
- fflush(stdout);
-}
-
-
-/**
- * Workaround for whinging GCCs, as suggested by strftime(3).
- */
-static size_t my_strftime(char *s, size_t max, const char *fmt,
- const struct tm *tm)
-{
- return strftime(s, max, fmt, tm);
-}
-
-
-/**
- * Print some session details.
- */
-static void print_session_info(xen_session *session)
-{
- xen_session_record *record;
- if (!xen_session_get_record(session, &record, session))
- {
- print_error(session);
- return;
- }
-
- printf("Session UUID: %s.\n", record->uuid);
- printf("Session user: %s.\n", record->this_user);
- char time[256];
- struct tm *tm = localtime(&record->last_active);
- my_strftime(time, 256, "Session last active: %c, local time.\n", tm);
- printf(time);
-
- char *uuid = NULL;
- char *this_user = NULL;
- xen_session_get_uuid(session, &uuid, session);
- xen_session_get_this_user(session, &this_user, session);
-
- if (!session->ok)
- {
- free(uuid);
- free(this_user);
- xen_session_record_free(record);
- print_error(session);
- return;
- }
-
- assert(!strcmp(record->uuid, uuid));
- assert(!strcmp(record->this_user, this_user));
-
- free(uuid);
- free(this_user);
- xen_session_record_free(record);
-
- fflush(stdout);
-}
-
-
-static int pstrcmp(const void *p1, const void *p2)
-{
- return strcmp(*(char **)p1, *(char **)p2);
-}
-
-
-/**
- * Print the list of supported methods.
- */
-static void print_methods(xen_session *session)
-{
- xen_string_set *methods;
-
- if (!xen_host_list_methods(session, &methods))
- {
- print_error(session);
- goto done;
- }
-
- printf("%zd.\n", methods->size);
- qsort(methods->contents, methods->size, sizeof(char *), pstrcmp);
-
- printf("Supported methods:\n");
- for (size_t i = 0; i < methods->size; i++)
- {
- printf(" %s\n", methods->contents[i]);
- }
- fflush(stdout);
-
-done:
- xen_string_set_free(methods);
-}
-
-
-/**
- * Print the metrics for the given VM.
- */
-static void print_vm_metrics(xen_session *session, xen_vm vm)
-{
- xen_vm_metrics vm_metrics;
- if (!xen_vm_get_metrics(session, &vm_metrics, vm))
- {
- print_error(session);
- return;
- }
-
- xen_vm_metrics_record *vm_metrics_record;
- if (!xen_vm_metrics_get_record(session, &vm_metrics_record, vm_metrics))
- {
- xen_vm_metrics_free(vm_metrics);
- print_error(session);
- return;
- }
-
- char time[256];
- struct tm *tm = localtime(&vm_metrics_record->last_updated);
- my_strftime(time, 256, "Metrics updated at %c, local time.\n", tm);
- printf(time);
-
- tm = localtime(&vm_metrics_record->start_time);
- my_strftime(time, 256, "VM running since %c, local time.\n", tm);
- printf(time);
-
- for (size_t i = 0; i < vm_metrics_record->vcpus_utilisation->size; i++)
- {
- printf("%"PRId64" -> %lf.\n",
- vm_metrics_record->vcpus_utilisation->contents[i].key,
- vm_metrics_record->vcpus_utilisation->contents[i].val);
- }
-
- printf("VCPU -> PCPU mapping:\n");
- for (size_t i = 0; i < vm_metrics_record->vcpus_cpu->size; i++)
- {
- printf(" %"PRId64" -> %"PRId64".\n",
- vm_metrics_record->vcpus_cpu->contents[i].key,
- vm_metrics_record->vcpus_cpu->contents[i].val);
- }
-
- printf("Live scheduling parameters:\n");
- for (size_t i = 0; i < vm_metrics_record->vcpus_params->size; i++)
- {
- printf(" %s -> %s.\n",
- vm_metrics_record->vcpus_params->contents[i].key,
- vm_metrics_record->vcpus_params->contents[i].val);
- }
-
- for (size_t i = 0; i < vm_metrics_record->vcpus_flags->size; i++)
- {
- printf("%"PRId64" -> ",
- vm_metrics_record->vcpus_flags->contents[i].key);
- xen_string_set *s = vm_metrics_record->vcpus_flags->contents[i].val;
- for (size_t j = 0; j < s->size; j++)
- {
- printf("%s", s->contents[j]);
- if (j + 1 != s->size)
- {
- printf(", ");
- }
- }
- printf("\n");
- }
-
- xen_vm_metrics_record_free(vm_metrics_record);
- xen_vm_metrics_free(vm_metrics);
-
- fflush(stdout);
-}
+++ /dev/null
-/*
- * 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
- */
-
-#define _GNU_SOURCE
-#include <assert.h>
-#include <inttypes.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <libxml/parser.h>
-#include <curl/curl.h>
-#include <xen/api/xen_event.h>
-
-//#define PRINT_XML
-
-static void usage()
-{
- fprintf(stderr,
-"Usage:\n"
-"\n"
-" test_event_handling <server> <username> <password>\n"
-"\n"
-"where\n"
-" <server> is the server's host and port, e.g. localhost:9363;\n"
-" <username> is the username to use at the server; and\n"
-" <password> is the password.\n");
-
- exit(EXIT_FAILURE);
-}
-
-
-static char *url;
-
-
-typedef struct
-{
- xen_result_func func;
- void *handle;
-} xen_comms;
-
-
-static size_t
-write_func(void *ptr, size_t size, size_t nmemb, xen_comms *comms)
-{
- size_t n = size * nmemb;
-#ifdef PRINT_XML
- printf("\n\n---Result from server -----------------------\n");
- printf("%s\n",((char*) ptr));
- fflush(stdout);
-#endif
- 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;
-
-#ifdef PRINT_XML
- printf("\n\n---Data to server: -----------------------\n");
- printf("%s\n",((char*) data));
- fflush(stdout);
-#endif
-
- 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");
-}
-
-
-/**
- * Workaround for whinging GCCs, as suggested by strftime(3).
- */
-static size_t my_strftime(char *s, size_t max, const char *fmt,
- const struct tm *tm)
-{
- return strftime(s, max, fmt, tm);
-}
-
-
-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);
-
- struct xen_string_set *classes = xen_string_set_alloc(0);
- xen_event_register(session, classes);
- xen_string_set_free(classes);
-
- if (!session->ok)
- {
- print_error(session);
- CLEANUP;
- return 1;
- }
-
- while (true)
- {
- struct xen_event_record_set *events;
- if (!xen_event_next(session, &events))
- {
- print_error(session);
- CLEANUP;
- return 1;
- }
-
- for (size_t i = 0; i < events->size; i++)
- {
- xen_event_record *ev = events->contents[i];
- char time[256];
- struct tm *tm = localtime(&ev->timestamp);
- my_strftime(time, 256, "%c, local time", tm);
- printf("Event received: ID = %"PRId64", %s.\n", ev->id, time);
- switch (ev->operation)
- {
- case XEN_EVENT_OPERATION_ADD:
- printf("%s created with UUID %s.\n", ev->class, ev->obj_uuid);
- break;
-
- case XEN_EVENT_OPERATION_DEL:
- printf("%s with UUID %s deleted.\n", ev->class, ev->obj_uuid);
- break;
-
- case XEN_EVENT_OPERATION_MOD:
- printf("%s with UUID %s modified.\n", ev->class, ev->obj_uuid);
- break;
- default:
- assert(false);
- }
- }
-
- xen_event_record_set_free(events);
- }
-
- CLEANUP;
-
- return 0;
-}