Skip to content
This repository was archived by the owner on Feb 19, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 43 additions & 30 deletions c/Makefile.dist
Original file line number Diff line number Diff line change
Expand Up @@ -25,69 +25,79 @@
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
# OF THE POSSIBILITY OF SUCH DAMAGE
# OF THE POSSIBILITY OF SUCH DAMAGE.
#

MAJOR = @LIB_MAJOR@
MINOR = @LIB_MINOR@
DESTDIR=/usr/local

CFLAGS = -g -Iinclude \
ifeq ($(CYGWIN), 1)
CYGWIN_LIBXML = -L/bin -lxml2-2
CYGWIN_CURL = -L/bin -lcurl-4
POS_FLAG = -U__STRICT_ANSI__
TEST_LDFLAGS = -L . lib@[email protected] $(CYGWIN_CURL)
else
POS_FLAG = -fPIC
TEST_LDFLAGS = -L . -l@LIB_NAME@
endif

CFLAGS = -g -Iinclude \
$(shell xml2-config --cflags) \
$(shell curl-config --cflags) \
-W -Wall -Wmissing-prototypes -Werror -std=c99 -fPIC
-W -Wall -Wmissing-prototypes -Werror -std=c99 $(POS_FLAG)

LDFLAGS = -g $(shell xml2-config --libs) \
$(shell curl-config --libs) \
-Wl,-rpath,$(shell pwd)
$(shell curl-config --libs) \
-Wl,-rpath,$(shell pwd) $(CYGWIN_LIBXML)

# -h for Solaris
SONAME_LDFLAG ?= -soname
# -R /usr/sfw/$(LIBDIR) -shared for Solaris
# -R /usr/sfw/lib -shared for Solaris
SHLIB_CFLAGS ?= -shared

# ginstall for Solaris
INSTALL = install
INSTALL_DIR = $(INSTALL) -d -m0755 -p
INSTALL_DATA = $(INSTALL) -m0644 -p
INSTALL_DIR = install -d -m0755 -p
INSTALL_DATA = install -m0644 -p

LIBXENAPI_HDRS = $(wildcard include/*.h)
LIBXENAPI_HDRS_INT = $(wildcard include/*.h)
LIBXENAPI_HDRS = $(wildcard include/xen/api/*.h)
LIBXENAPI_OBJS = $(patsubst %.c, %.o, $(wildcard src/*.c))

TEST_PROGRAMS = test/test_vm_ops test/test_event_handling \
test/test_failures test/test_vm_async_migrate \
test/test_enumerate test/test_get_records
TEST_PROGRAMS = $(patsubst %.c, %, $(wildcard test/*.c))

TARBALL_DEST = lib@LIB_NAME@-$(MAJOR).$(MINOR)
TARBALL_DEST = lib@LIB_NAME@-@LIB_MAJOR@.@LIB_MINOR@

.PHONY: all
all: $(TEST_PROGRAMS)

lib@[email protected]: lib@[email protected].$(MAJOR)
lib@[email protected]: lib@[email protected].@LIB_MAJOR@
ln -sf $< $@

lib@[email protected].$(MAJOR): lib@[email protected].$(MAJOR).$(MINOR)
lib@[email protected].@LIB_MAJOR@: lib@[email protected].@LIB_MAJOR@.@LIB_MINOR@
ln -sf $< $@

lib@[email protected].$(MAJOR).$(MINOR): $(LIBXENAPI_OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,lib@[email protected].$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^
lib@[email protected].@LIB_MAJOR@.@LIB_MINOR@: $(LIBXENAPI_OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,lib@[email protected].@LIB_MAJOR@ $(SHLIB_CFLAGS) -o $@ $^

lib@[email protected]: $(LIBXENAPI_OBJS)
$(AR) rcs lib@[email protected] $^

$(TEST_PROGRAMS): test/%: test/%.o lib@[email protected]
$(CC) -o $@ $< -L . -l@LIB_NAME@ $(LDFLAGS)
$(CC) -o $@ $< $(TEST_LDFLAGS) $(LDFLAGS)


.PHONY: install
install: all
$(INSTALL_DIR) $(DESTDIR)/usr/include/xen/api
$(INSTALL_DIR) $(DESTDIR)/usr/$(LIBDIR)
$(INSTALL_PROG) lib@[email protected].$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)
ln -sf lib@[email protected].$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/lib@[email protected].$(MAJOR)
ln -sf lib@[email protected].$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/lib@[email protected]
$(INSTALL_DATA) lib@[email protected] $(DESTDIR)/usr/$(LIBDIR)
install: all lib@[email protected]
$(INSTALL_DIR) $(DESTDIR)/include/xen/api
$(INSTALL_DIR) $(DESTDIR)/lib
$(INSTALL_DATA) lib@[email protected].@LIB_MAJOR@.@LIB_MINOR@ $(DESTDIR)/lib
ln -sf lib@[email protected].@LIB_MAJOR@.@LIB_MINOR@ $(DESTDIR)/lib/lib@[email protected].@LIB_MAJOR@
ln -sf lib@[email protected].@LIB_MAJOR@ $(DESTDIR)/lib/lib@[email protected]
$(INSTALL_DATA) lib@[email protected] $(DESTDIR)/lib
for i in $(LIBXENAPI_HDRS_INT); do \
$(INSTALL_DATA) $$i $(DESTDIR)/include/; \
done
for i in $(LIBXENAPI_HDRS); do \
$(INSTALL_DATA) $$i $(DESTDIR)/usr/include/xen/api; \
$(INSTALL_DATA) $$i $(DESTDIR)/include/xen/api; \
done


Expand All @@ -112,10 +122,13 @@ $(TARBALL_DEST).tar.bz2: all


.PHONY: clean
clean:
clean: cleantests
rm -f `find -name *.o`
rm -f lib@[email protected]*
rm -f lib@[email protected]

.PHONY: cleantests
cleantests:
rm -f $(TEST_PROGRAMS)


Expand Down
10 changes: 5 additions & 5 deletions c/OMakefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,25 @@ c_source: gen_c_binding
cp $(C_GEN_FOLDER)/*.h $(C_SRC_TMP_FOLDER)/include
cp $(C_GEN_FOLDER)/*.c $(C_SRC_TMP_FOLDER)/src
sed -e s/@LIB_MAJOR@/$(API_MAJOR)/g -e s/@LIB_MINOR@/$(API_MINOR)/g -e s/@LIB_NAME@/xenserver/g Makefile.dist > $(C_SRC_TMP_FOLDER)/Makefile
cp ../LICENSE $(C_SRC_TMP_FOLDER)/COPYING
sed -e 's/@SDK_VERSION@/$(SDK_VERSION)/g' README.dist >$(C_SRC_TMP_FOLDER)/README
cp xen_internal.h $(C_SRC_TMP_FOLDER)/include
cp xen_common.h xen_string_set.h $(C_SRC_TMP_FOLDER)/include/xen/api
cp xen_common.c xen_string_set.c $(C_SRC_TMP_FOLDER)/src
cp test/*.c $(C_SRC_TMP_FOLDER)/test
make -C $(C_SRC_TMP_FOLDER) -f Makefile uberheader
cd $(BINDINGS_TMP) && tar cjf $(MY_OUTPUT_DIR)/libxenserver-src.tar.bz2 libxenserver
mkdir -p $(C_SRC_FOLDER) && cp -r $(C_SRC_TMP_FOLDER)/* $(C_SRC_FOLDER)
sed -e 's/@SDK_VERSION@/$(SDK_VERSION)/g' README.dist >$(SDK_C_FOLDER)/README
cp ../LICENSE $(SDK_C_FOLDER)/COPYING

.PHONY: c_binaries
c_binaries: c_source
if $(equal $(COMPILE_C), yes)
make -C $(C_SRC_TMP_FOLDER) -f Makefile libxenserver.so
else
touch $(C_SRC_TMP_FOLDER)/libxenserver.so $(C_SRC_TMP_FOLDER)/libxenserver.so.$(API_MAJOR) $(C_SRC_TMP_FOLDER)/libxenserver.so.$(API_VER)
touch $(addprefix $(C_SRC_TMP_FOLDER)/, COPYING README)
cd $(BINDINGS_TMP) && tar cjf $(MY_OUTPUT_DIR)/libxenserver-bin.tar.bz2 $(addprefix libxenserver/, libxenserver.so libxenserver.so.$(API_MAJOR) libxenserver.so.$(API_VER) COPYING README)
mkdir -p $(C_BIN_FOLDER) && cp $(addprefix $(C_SRC_TMP_FOLDER)/, libxenserver.so libxenserver.so.$(API_MAJOR) libxenserver.so.$(API_VER) COPYING README) $(C_BIN_FOLDER)
touch $(addprefix $(SDK_C_FOLDER)/, COPYING README)
cd $(BINDINGS_TMP) && tar cjf $(MY_OUTPUT_DIR)/libxenserver-bin.tar.bz2 $(addprefix libxenserver/, libxenserver.so libxenserver.so.$(API_MAJOR) libxenserver.so.$(API_VER))
mkdir -p $(C_BIN_FOLDER) && cp $(addprefix $(C_SRC_TMP_FOLDER)/, libxenserver.so libxenserver.so.$(API_MAJOR) libxenserver.so.$(API_VER)) $(C_BIN_FOLDER)

.PHONY: c_folders
c_folders: c_binaries c_source
Expand Down
32 changes: 14 additions & 18 deletions c/README.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ Version @SDK_VERSION@
libxenserver is a complete SDK for Citrix XenServer, exposing the XenServer
API to C programmers.

It is available in the XenServer-SDK-6.4.90.zip, which can be downloaded
from http://www.citrix.com/downloads/xenserver/.

For XenServer documentation, see http://docs.xensource.com.
libxenserver includes a C function call for each XenServer API call, so API
documentation and examples written for for other languages can be easily
Expand All @@ -18,15 +21,11 @@ to understand the approach to error reporting and memory management taken
by this library.

For community content, blogs, and downloads, visit the XenServer Developer
Network at http://community.citrix.com/cdn/xs.
Network at https://www.citrix.com/community.html.

libxenserver is free sofware. You can redistribute and modify it under the
terms of the BSD license. See COPYING for details.

This library may be accompanied by pedagogical examples. These do not form
part of this library, and are licensed for redistribution and modification
under the BSD license. Such examples are licensed clearly at the top
of each file.

Dependencies
------------
Expand All @@ -44,29 +43,26 @@ prefer.
On Debian, these are packaged as libxml2-dev and libcurl3-dev.


Downloads
---------

libxenserver is available in the XenServer-SDK-@[email protected] in two separate
folders, one for the compiled binaries, and one for the source code.
The binaries are compiled for the XenServer SDK virtual machine, and we
recommend compiling from source if you wish to use the library in a
different environment.
Folder structure
----------------

The XenServer-SDK-@[email protected] is available from
http://www.citrix.com/downloads/xenserver/.
libxenserver consists of two separate folders:
- libxenserver/bin: contains the compiled binaries
- libxenserver/src: contains the source code and tests; the tests can also
be used as pedagogical examples.


Compiling from Source
Compiling from source
---------------------

To build, simply type "make" in the libxenserver directory.
To build, simply type "make" in the libxenserver/src directory.
To build on Windows with cygwin type "make CYGWIN=1"

To run any of the tests, for example the test_vm_ops, do

./test/test_vm_ops <url> <sr-name> <username> <password>

The <url> should be of the form: https://hostname.domain/

You can obtain a suitable <sr-name> by typing in "xe sr-list" on the host, e.g.:
You can obtain a suitable <sr-name> by typing in "xe sr-list" on the host, e.g.
"Auto-created spanning LVM SR on /dev/sda3"
33 changes: 15 additions & 18 deletions java/OMakefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@

JAVAGEN_DIR = $(BINDINGS_TMP)/javagen
JAVATMP_DIR = $(BINDINGS_TMP)/XenServerJava-tmp
JAVABIN_DIR = $(BINDINGS_TMP)/XenServerJava-bin/XenServerJava
JAVASRC_DIR = $(BINDINGS_TMP)/XenServerJava-src/XenServerJava
JAVASAM_DIR = $(BINDINGS_TMP)/XenServerJava-samples/XenServerJava
JAVADOC_DIR = $(BINDINGS_TMP)/XenServerJavadoc/javadoc
JAVABIN_DIR = $(BINDINGS_TMP)/XenServerJava-bin
JAVASRC_DIR = $(BINDINGS_TMP)/XenServerJava-src
JAVASAM_DIR = $(BINDINGS_TMP)/XenServerJava-samples
JAVADOC_DIR = $(BINDINGS_TMP)/XenServerJava-javadoc

SDK_JAVA_FOLDER=$(SDK_FOLDER)/XenServerJava

Expand All @@ -59,40 +59,37 @@ Brand(src, dst) =
sed -e 's/@SDK_VERSION@/$(SDK_VERSION)/g' $(src) >$(JAVATMP_DIR)/t-$(basename $(dst))
$(INSTALL) $(JAVATMP_DIR)/t-$(basename $(dst)) $(dst)

#N.B. the following also does a test build of the tests

.PHONY: java_bindings_all
java_bindings_all: main
if $(equal $(COMPILE_JAVA), yes)
Empty($(JAVAGEN_DIR) $(JAVASRC_DIR) $(JAVABIN_DIR) $(JAVADOC_DIR))
Empty($(JAVAGEN_DIR) $(JAVASRC_DIR) $(JAVABIN_DIR) $(JAVADOC_DIR) $(JAVASAM_DIR))
Brand(lib/Makefile.dist, $(JAVAGEN_DIR)/Makefile)
mkdir -p $(JAVAGEN_DIR)/com/xensource/xenapi
$(INSTALL) lib/com/xensource/xenapi/*.java $(JAVAGEN_DIR)/com/xensource/xenapi
Brand(lib/com/xensource/xenapi/Connection.java, $(JAVAGEN_DIR)/com/xensource/xenapi/Connection.java)
./main $(JAVAGEN_DIR)
cp -r $(JAVAGEN_DIR)/* $(JAVASRC_DIR)
$(INSTALL) samples/*.java $(JAVASAM_DIR)
$(INSTALL) samples/*.java $(JAVAGEN_DIR)
$(INSTALL) $(XMLRPC_DIST)/{xmlrpc-common-3.1,xmlrpc-client-3.1,ws-commons-util-1.0.2}.jar $(JAVAGEN_DIR)
./main $(JAVAGEN_DIR)
make -C $(JAVAGEN_DIR) all docs cleanclass
make -C $(JAVAGEN_DIR) all docs
mv $(JAVAGEN_DIR)/*.jar $(JAVABIN_DIR)
Brand(README.dist, $(JAVATMP_DIR)/README.txt)
$(INSTALL) $(JAVATMP_DIR)/README.txt $(JAVABIN_DIR)
LicenceJava($(JAVABIN_DIR))
mv $(JAVAGEN_DIR)/doc/* $(JAVADOC_DIR)
rmdir $(JAVAGEN_DIR)/doc
mv $(JAVAGEN_DIR)/* $(JAVASRC_DIR)
$(INSTALL) $(JAVATMP_DIR)/README.txt $(JAVASRC_DIR)
LicenceJava($(JAVASRC_DIR))
Empty($(JAVASAM_DIR))
$(INSTALL) samples/*.java $(JAVASAM_DIR)
$(INSTALL) $(JAVATMP_DIR)/README.txt $(JAVASAM_DIR)
LicenceJava($(JAVASAM_DIR))
Brand(README.dist, $(JAVATMP_DIR)/README.txt)
else
Empty($(JAVASRC_DIR) $(JAVABIN_DIR) $(JAVADOC_DIR))

.PHONY: java_folders
java_folders: java_bindings_all
mkdir -p $(SDK_JAVA_FOLDER)/bin && cp -r $(JAVABIN_DIR)/* $(SDK_JAVA_FOLDER)/bin
mkdir -p $(SDK_JAVA_FOLDER)/src && cp -r $(JAVASRC_DIR)/* $(SDK_JAVA_FOLDER)/src
mkdir -p $(SDK_JAVA_FOLDER)/samples && cp -r $(JAVASAM_DIR)/{*.java,README.txt} $(SDK_JAVA_FOLDER)/samples
mkdir -p $(SDK_JAVA_FOLDER)/samples && cp -r $(JAVASAM_DIR)/*.java $(SDK_JAVA_FOLDER)/samples
mkdir -p $(SDK_JAVA_FOLDER)/javadoc && cp -r $(JAVADOC_DIR)/* $(SDK_JAVA_FOLDER)/javadoc
$(INSTALL) $(JAVATMP_DIR)/README.txt $(SDK_JAVA_FOLDER)
LicenceJava($(SDK_JAVA_FOLDER))

.PHONY: clean
clean:
Expand Down
59 changes: 36 additions & 23 deletions java/README.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +6,60 @@ Version @SDK_VERSION@
XenServerJava is a complete SDK for Citrix XenServer, exposing the XenServer
API as Java classes.

For XenServer documentation, see http://docs.xensource.com.
It is available in the XenServer-SDK-@[email protected], which can be downloaded
from http://www.citrix.com/downloads/xenserver/.

For XenServer documentation see http://docs.xensource.com.
XenServerJava includes a class for every XenServer class, and a method for
each XenServer API call, so API documentation and examples written for
for other languages will apply equally well to Java.
In particular, the SDK Guide and API Documentation are ideal for developers
wishing to use XenServerJava.

For community content, blogs, and downloads, visit the XenServer Developer
Network at http://community.citrix.com/cdn/xs.

XenServerJava is free sofware. You can redistribute and modify it under the
terms of the BSD license. See LICENSE.txt for details.
Network at https://www.citrix.com/community.html.

This library may be accompanied by pedagogical examples. These do not form
part of this library, and are licensed for redistribution and modification
under the BSD license. Such examples are licensed clearly at the top
of each file.
XenServerJava is free sofware. You can redistribute and modify it under the
terms of the BSD license. See LICENSE.txt for details.


Dependencies
------------

XenServerJava is dependent upon Apache XML-RPC and WS-Commons, both by The
Apache Software Foundation. We would like to thank the ASF and the
Apache XML-RPC development team in particular.
Both are licensed under the Apache Software License 2.0; see
LICENSE.Apache-2.0.txt for details.
Apache Software Foundation. We would like to thank the ASF and the
Apache XML-RPC development team in particular. Both are licensed under the
Apache Software License 2.0. See LICENSE.Apache-2.0.txt for details.

We test with version 3.1 of Apache XML-RPC, and version 1.0.2 of WS-Commons.
We test with version 3.1 of Apache XML-RPC and version 1.0.2 of WS-Commons.
We recommend that you use these versions, though others may work.

Apache XML-RPC is available from http://ws.apache.org/xmlrpc/.
WS-Commons is available from http://ws.apache.org/commons/.

Downloads
---------

XenServerJava is available in the XenServer-SDK-@[email protected] in three separate
folders, one for the compiled binaries, one for the source code,
and one containing sample code.
Folder structure
----------------

XenServerJava consists of three separate folders:
- XenServerJava/bin: contains the compiled binaries
- XenServerJava/javadoc: contains the documentation
- XenServerJava/src: contains the source code and tests; the tests can also
be used as pedagogical examples.


Compiling from source
---------------------

Extract XenServerJava from XenServer-SDK-@[email protected].
Copy the dependency jars from XenServerJava/bin to XenServerJava/src.

From XenServerJava/src do:
- "make all" to build the XenServer binary
- "make docs" to build the documentation.

To build and run the tests, copy them from XenServerJava/samples to
XenServerJava/src, then from XenServerJava/src "make all" and
$ java RunTests <host> <username> <password> [nfs server] [nfs path]

The XenServer-SDK-@[email protected] is available from
http://www.citrix.com/downloads/xenserver/.

Apache XML-RPC is available from http://ws.apache.org/xmlrpc/.
WS-Commons is available from http://ws.apache.org/commons/.
3 changes: 1 addition & 2 deletions java/lib/Makefile.dist
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@
# OF THE POSSIBILITY OF SUCH DAMAGE.
#

# Makefile to compile the Xen Java SDK bindings
# Makefile to compile the Xen Java SDK bindings and tests

BINDINGJAVAFILES := $(wildcard com/xensource/xenapi/*.java)
BINDINGCLASSFILES := $(BINDINGJAVAFILES:.java=.class)
BINDINGJAR := xenserver-@[email protected]

CLASSPATH := :xmlrpc-client-3.1.jar:xmlrpc-common-3.1.jar:ws-commons-util-1.0.2.jar
EXAMPLECLASSPATH := :$(BINDINGJAR)$(CLASSPATH)

.PHONY: all
all: $(BINDINGJAR) tests
Expand Down
1 change: 1 addition & 0 deletions java/samples/DeprecatedMethod.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
*/
public class DeprecatedMethod extends TestBase
{
@SuppressWarnings("deprecation")
public static void RunTest(ILog logger, TargetServer server) throws Exception
{
TestBase.logger = logger;
Expand Down
Loading