Remove proxy and daemon and merge utils into lib.
authorMatthias Bolte <matthias.bolte@googlemail.com>
Thu, 30 Apr 2009 23:12:04 +0000 (01:12 +0200)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Fri, 1 May 2009 08:12:48 +0000 (10:12 +0200)
Signed-off-by: Matthias Bolte <matthias.bolte@googlemail.com>

41 files changed:
Doxyfile
Makefile
backend/data/file/data.c
backend/mutex/mutex.h
backend/mutex/none/mutex.c
backend/mutex/pthread/mutex.c
backend/network/common/common.c
backend/network/common/common.h
backend/network/dhcponly/network.c
backend/network/network.h
cli/Makefile
cli/cli.c
config.mk
daemon/Makefile [deleted file]
daemon/daemon.c [deleted file]
include/libvscmgmt/host.h
include/libvscmgmt/network.h
lib/Makefile
lib/core.c
lib/host.c
lib/host.h
lib/ipv4.c [moved from utils/ipv4.c with 97% similarity]
lib/ipv4.h [moved from utils/ipv4.h with 88% similarity]
lib/mac.c [moved from utils/mac.c with 94% similarity]
lib/mac.h [moved from utils/mac.h with 84% similarity]
lib/network.c [moved from utils/network.c with 96% similarity]
lib/network.h [moved from utils/network.h with 88% similarity]
lib/types.h
lib/uuid.c [moved from utils/uuid.c with 96% similarity]
lib/uuid.h [moved from utils/uuid.h with 87% similarity]
proxy/Makefile [deleted file]
proxy/proxy.c [deleted file]
tests/Makefile
tests/host.c
tests/ipv4.c
tests/uuid.c
utils/Makefile [deleted file]
utils/host.c [deleted file]
utils/host.h [deleted file]
utils/types.h [deleted file]
utils/utils.h [deleted file]

index 15e2f81..de799e6 100644 (file)
--- a/Doxyfile
+++ b/Doxyfile
@@ -564,7 +564,7 @@ WARN_LOGFILE           =
 # directories like "/usr/src/myproject". Separate the files or directories
 # with spaces.
 
-INPUT                  = backend cli include lib utils
+INPUT                  = backend cli include lib
 
 # This tag can be used to specify the character encoding of the source files
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
index e17370e..2b4e9b6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -13,11 +13,11 @@ PWD = $(shell pwd)
 
 .PHONY: all clean install check docs
 
-all: backend-all utils-all lib-all cli-all python-all tests-all
+all: backend-all lib-all cli-all python-all tests-all
 
-clean: backend-clean utils-clean lib-clean cli-clean python-clean tests-clean
+clean: backend-clean lib-clean cli-clean python-clean tests-clean
 
-install: backend-install utils-install lib-install cli-install python-install include-install
+install: backend-install lib-install cli-install python-install include-install
 
 check: all
        $(MAKE) -I $(PWD) -C tests check
index 6e95c6c..914cfb6 100644 (file)
@@ -27,8 +27,7 @@
 #include <libvscmisc/memory.h>
 #include <libvscmisc/string.h>
 
-#include "../../../include/libvscmgmt/libvscmgmt.h"
-#include "../../../utils/utils.h"
+#include "../../../lib/host.h"
 #include "../../mutex/mutex.h"
 #include "../data.h"
 
index ab944b8..21fe756 100644 (file)
@@ -25,8 +25,7 @@
 #ifndef __VSC_MGMT__BACKEND__MUTEX_H__
 #define __VSC_MGMT__BACKEND__MUTEX_H__
 
-#include "../../include/libvscmgmt/types.h"
-#include "../../utils/types.h"
+#include "../../lib/types.h"
 
 /*!
  * @brief Allocates and initializes an initially unlocked mutex and returns it.
index 54dadd8..03e6cf2 100644 (file)
@@ -22,9 +22,7 @@
 #include <libvscmisc/error.h>
 #include <libvscmisc/memory.h>
 
-#include "../../../include/libvscmgmt/libvscmgmt.h"
 #include "../mutex.h"
-#include "../../../utils/utils.h"
 
 struct VscMgmtMutex {
     int nothing;
index b6de98c..3491bb6 100644 (file)
@@ -23,7 +23,6 @@
 #include <libvscmisc/memory.h>
 #include <libvscmisc/string.h>
 
-#include "../../../utils/utils.h"
 #include "../mutex.h"
 
 #define __USE_UNIX98 /* required for recursive mutex */
index 578d5ef..f5d2cff 100644 (file)
 #include <libvscmisc/assert.h>
 #include <libvscmisc/error.h>
 
+#include "../../../include/libvscmgmt/network.h"
 #include "../network.h"
-#include "../../../utils/utils.h"
-#include "../../mutex/mutex.h"
-
 #include "common.h"
 
 static int _network_initialized = FALSE;
index ebec775..5e85b31 100644 (file)
 #ifndef __VSC_MGMT__BACKEND__COMMON_H__
 #define __VSC_MGMT__BACKEND__COMMON_H__
 
-#include "../../../utils/utils.h"
-#include "../../mutex/mutex.h"
-
-#include "../../../include/libvscmgmt/types.h"
+#include "../../../lib/network.h"
 
 void
 _vsc_mgmt_network_common_init (struct VscError *error,
@@ -42,12 +39,12 @@ _vsc_mgmt_network_common_cleanup (void);
 
 struct VscMgmtUuid *
 _vsc_mgmt_network_common_setup (struct VscError *error,
-                               unsigned int num_hosts);
+                                unsigned int num_hosts);
 
 
 void
 _vsc_mgmt_network_common_teardown (struct VscError *error,
-                                  const struct VscMgmtUuid *network_uuid);
+                                   const struct VscMgmtUuid *network_uuid);
 
 
 struct VscMgmtIpv4 *
index cab4507..34b5c9b 100644 (file)
@@ -27,8 +27,8 @@
 #include <libvscmisc/assert.h>
 #include <libvscmisc/error.h>
 
+#include "../../../include/libvscmgmt/network.h"
 #include "../network.h"
-#include "../../../utils/utils.h"
 
 static int _network_initialized = FALSE;
 static struct VscMgmtNetwork *_network_list = NULL;
index 2be25ac..8bb7205 100644 (file)
@@ -26,8 +26,7 @@
 #ifndef __VSC_MGMT__BACKEND__NETWORK_H__
 #define __VSC_MGMT__BACKEND__NETWORK_H__
 
-#include "../../include/libvscmgmt/types.h"
-#include "../../utils/network.h"
+#include "../../lib/network.h"
 
 void
 _vsc_mgmt_network_init (struct VscError *error,
index fbec973..5a9948f 100644 (file)
@@ -21,13 +21,8 @@ LDFLAGS += -lvscmisc
 # libvsccli
 LDFLAGS += -lvsccli
 
-# libvscmgmt(-proxy)
-ifeq ($(CLI_MODE), lib)
+# libvscmgmt
 LDFLAGS += $(LIBVSCMGMT_LDFLAGS)
-else
-CFLAGS  += -D_VSC_MGMT__CLI__USE_PROXY
-LDFLAGS += $(LIBVSCMGMT_PROXY_LDFLAGS)
-endif
 
 #
 # Rules
index aa99d53..2a1192c 100644 (file)
--- a/cli/cli.c
+++ b/cli/cli.c
@@ -28,7 +28,7 @@
 
 #include <libvsccli/libvsccli.h>
 
-#include "../utils/utils.h"
+#include "../include/libvscmgmt/libvscmgmt.h"
 
 /*
  * host-add
index 367b99a..339b87f 100644 (file)
--- a/config.mk
+++ b/config.mk
@@ -9,9 +9,6 @@ CC               = gcc
 PREFIX           = /usr/local
 CLEAN_PATTERNS   = *.o *.a *.so
 
-# CLI configuration
-CLI_MODE         = lib
-
 # Backend configuration
 DATA_BACKEND     = file
 MUTEX_BACKEND    = pthread
@@ -24,10 +21,6 @@ BACKEND_LDFLAGS          = -L ../backend/data/$(DATA_BACKEND) \
                            -L ../backend/network/$(NETWORK_BACKEND) \
                            -lvscmgmt-network-$(NETWORK_BACKEND)
 LIBVSCMGMT_LDFLAGS       = -L ../lib -lvscmgmt \
-                           -L ../utils -lvscmgmt-utils \
-                            $(BACKEND_LDFLAGS)
-LIBVSCMGMT_PROXY_LDFLAGS = -L ../proxy -lvscmgmt-proxy \
-                           -L ../utils -lvscmgmt-utils \
                             $(BACKEND_LDFLAGS)
 
 #
diff --git a/daemon/Makefile b/daemon/Makefile
deleted file mode 100644 (file)
index bab7aa1..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/make
-#
-# Makefile to build the Daemon for Virtualized Supercomputer Management
-#
-# Copyright (C) 2009 Matthias Bolte <matthias.bolte@googlemail.com>
-# Copyright (C) 2009 Maximilian Wilhelm <max@rfc2324.org>
-#
-
-include ../config.mk
-
-OBJS     = daemon.o
-TARGET   = vscmgmt-daemon
-
-#
-# Fancy gcc options
-#
-
-# libvscmisc
-LDFLAGS += -lvscmisc
-
-# libvscmgmt
-LDFLAGS += $(LIBVSCMGMT_LDFLAGS)
-
-# libxmlrpc-c
-CFLAGS  += $(shell xmlrpc-c-config abyss-server --cflags)
-LDFLAGS += $(shell xmlrpc-c-config abyss-server --libs)
-
-#
-# Rules
-#
-
-.PHONY: all clean install
-
-all: $(TARGET)
-
-clean:
-       rm -rf $(TARGET) $(OBJS) $(CLEAN_PATTERNS)
-
-install: install-target-bin
-
-$(TARGET): $(OBJS)
-       @echo "> linking $(TARGET)"
-       $(CC) -o $(TARGET) $(OBJS) $(LDFLAGS)
-
-include ../rules.mk
diff --git a/daemon/daemon.c b/daemon/daemon.c
deleted file mode 100644 (file)
index 3a61ad4..0000000
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * daemon.c: Daemon for Virtualized Supercomputer Management
- *
- * Copyright (C) 2009 Matthias Bolte <matthias.bolte@googlemail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * 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 <stdlib.h>
-#include <stdio.h>
-
-#include <xmlrpc-c/base.h>
-#include <xmlrpc-c/server.h>
-#include <xmlrpc-c/server_abyss.h>
-
-#include <libvscmisc/error.h>
-
-#include "../utils/utils.h"
-
-#define _ERROR_TO_XMLRPC(error, env) \
-       xmlrpc_env_set_fault_formatted (env, XMLRPC_INTERNAL_ERROR, \
-                                       "libvscmgmt : %s [%s] %s", \
-                                       (error)->function, \
-                                       vsc_error_string ((error)->code), \
-                                       (error)->message != NULL ? (error)->message \
-                                                                : "");
-
-static xmlrpc_value *
-xmlrpc_vsc_mgmt_get_version (xmlrpc_env *env,
-                             xmlrpc_value *param_list VSC__ATTR__UNUSED,
-                             void *server_info VSC__ATTR__UNUSED,
-                             void *channel_info VSC__ATTR__UNUSED)
-{
-       int major, minor, patch;
-
-       vsc_mgmt_get_version (&major, &minor, &patch);
-
-       return xmlrpc_build_value (env, "{s:i,s:i,s:i}",
-                                  "major", (xmlrpc_int32) major,
-                                  "minor", (xmlrpc_int32) minor,
-                                  "patch", (xmlrpc_int32) patch);
-}
-
-static xmlrpc_value *
-xmlrpc_vsc_mgmt_host_add (xmlrpc_env *env,
-                          xmlrpc_value *param_list,
-                          void *server_info VSC__ATTR__UNUSED,
-                          void *channel_info VSC__ATTR__UNUSED)
-{
-       struct VscError error;
-       char* host_ipv4_string = NULL;
-       char* host_type_string = NULL;
-       struct VscMgmtIpv4 host_ipv4;
-       enum VscMgmtHostType host_type;
-       char* username = NULL;
-       char* password = NULL;
-       xmlrpc_value *result = NULL;
-
-       vsc_error_init (&error);
-
-       xmlrpc_decompose_value (env, param_list, "({s:{s:s,s:s,s:s,s:s,*},*})",
-                               "host_info",
-                               "host_ipv4", &host_ipv4_string,
-                               "host_type", &host_type_string,
-                               "username", &username,
-                               "password", &password);
-
-       if (env->fault_occurred) {
-               goto cleanup;
-       }
-
-       printf ("vsc_mgmt_host_add\n");
-       printf ("  host_ipv4_string %s\n", host_ipv4_string);
-       printf ("  host_type %s\n", host_type_string);
-       printf ("  username %s\n", username);
-       printf ("  password %s\n", password);
-
-       vsc_mgmt_ipv4_parse (&error, host_ipv4_string, &host_ipv4);
-
-       if (error.occured) {
-               _ERROR_TO_XMLRPC (&error, env);
-               goto cleanup;
-       }
-
-       host_type = vsc_mgmt_host_type_parse (&error, host_type_string);
-
-       if (error.occured) {
-               _ERROR_TO_XMLRPC (&error, env);
-               goto cleanup;
-       }
-
-       vsc_mgmt_host_add (&error, &host_ipv4, host_type, username, password);
-
-       if (error.occured) {
-               _ERROR_TO_XMLRPC (&error, env);
-               goto cleanup;
-       }
-
-       result = xmlrpc_build_value (env, "()");
-
-cleanup:
-       free (host_ipv4_string);
-       free (host_type_string);
-       free (username);
-       free (password);
-
-       vsc_error_cleanup (&error);
-
-       return result;
-}
-
-static xmlrpc_value *
-xmlrpc_vsc_mgmt_host_remove (xmlrpc_env *env,
-                             xmlrpc_value *param_list,
-                             void *server_info VSC__ATTR__UNUSED,
-                             void *channel_info VSC__ATTR__UNUSED)
-{
-       struct VscError error;
-       char* host_ipv4_string = NULL;
-       struct VscMgmtIpv4 host_ipv4;
-       xmlrpc_value *result = NULL;
-
-       vsc_error_init (&error);
-
-       xmlrpc_decompose_value (env, param_list, "({s:s,*})",
-                               "host_ipv4", &host_ipv4_string);
-
-       if (env->fault_occurred) {
-               goto cleanup;
-       }
-
-       printf ("vsc_mgmt_host_remove\n");
-       printf ("  host_ipv4_string %s\n", host_ipv4_string);
-
-       vsc_mgmt_ipv4_parse (&error, host_ipv4_string, &host_ipv4);
-
-       if (error.occured) {
-               _ERROR_TO_XMLRPC (&error, env);
-               goto cleanup;
-       }
-
-       vsc_mgmt_host_remove (&error, &host_ipv4);
-
-       if (error.occured) {
-               _ERROR_TO_XMLRPC (&error, env);
-               goto cleanup;
-       }
-
-       result = xmlrpc_build_value (env, "()");
-
-cleanup:
-       free (host_ipv4_string);
-
-       vsc_error_cleanup (&error);
-
-       return result;
-}
-
-static struct xmlrpc_method_info3 method_info_list[] = {
-       {
-               .methodName     = "vsc.mgmt.get_version",
-               .methodFunction = &xmlrpc_vsc_mgmt_get_version,
-       }, {
-               .methodName     = "vsc.mgmt.host.add",
-               .methodFunction = &xmlrpc_vsc_mgmt_host_add,
-       }, {
-               .methodName     = "vsc.mgmt.host.remove",
-               .methodFunction = &xmlrpc_vsc_mgmt_host_remove,
-       }
-};
-
-int
-main (int argc VSC__ATTR__UNUSED, const char **argv VSC__ATTR__UNUSED)
-{
-       struct VscError error;
-       xmlrpc_env env;
-       xmlrpc_registry *registry;
-       xmlrpc_server_abyss_parms server_parms;
-
-       vsc_error_init (&error);
-
-       vsc_mgmt_init (&error);
-
-       if (error.occured) {
-               vsc_error_fprint (&error, stderr);
-               vsc_error_cleanup (&error);
-
-               return -1;
-       }
-
-       xmlrpc_env_init (&env);
-
-       registry = xmlrpc_registry_new (&env);
-
-       xmlrpc_registry_add_method3 (&env, registry, &method_info_list[0]);
-       xmlrpc_registry_add_method3 (&env, registry, &method_info_list[1]);
-       xmlrpc_registry_add_method3 (&env, registry, &method_info_list[2]);
-
-       server_parms.config_file_name = NULL;
-       server_parms.registryP = registry;
-       server_parms.port_number = 8080;
-       server_parms.log_file_name = "/var/log/vsc/vscmgmt-daemon.log";
-
-       printf("Running XML-RPC server...\n");
-
-       xmlrpc_server_abyss (&env, &server_parms, XMLRPC_APSIZE (log_file_name));
-
-       /*
-        * FIXME: The XML-RPC server can only be closed by an remove call to the
-        *        system.shutdown method. Need to add a callback for that to call
-        *        the vsc_mgmt_global_cleanup method.
-        */
-
-       return 0;
-}
index 7573538..cc1610a 100644 (file)
@@ -25,6 +25,8 @@
 #ifndef __VSC_MGMT__HOST_H__
 #define __VSC_MGMT__HOST_H__
 
+#include "types.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
index c26d660..92f67ee 100644 (file)
@@ -26,6 +26,8 @@
 #ifndef __VSC_MGMT__NETWORK_H__
 #define __VSC_MGMT__NETWORK_H__
 
+#include "types.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
index 067a17a..68f77f3 100644 (file)
@@ -8,7 +8,7 @@
 
 include ../config.mk
 
-OBJS     = core.o host.o
+OBJS     = core.o host.o ipv4.o mac.o network.o uuid.o
 TARGET   = libvscmgmt.so
 
 #
@@ -22,6 +22,10 @@ LDFLAGS += -lvscmisc
 CFLAGS  += $(shell pkg-config libvirt --cflags)
 LDFLAGS += $(shell pkg-config libvirt --libs)
 
+# libuuid
+CFLAGS  += $(shell pkg-config uuid --cflags)
+LDFLAGS += $(shell pkg-config uuid --libs)
+
 #
 # Rules
 #
index 86b01e6..98498b5 100644 (file)
@@ -27,8 +27,7 @@
 #include <libvscmisc/assert.h>
 #include <libvscmisc/error.h>
 
-#include "../include/libvscmgmt/libvscmgmt.h"
-#include "../utils/utils.h"
+#include "../include/libvscmgmt/core.h"
 #include "../backend/data/data.h"
 #include "../backend/network/network.h"
 #include "host.h"
index 1cfcde1..90b2310 100644 (file)
 
 #include "../include/libvscmgmt/libvscmgmt.h"
 #include "../backend/data/data.h"
-#include "../utils/utils.h"
 #include "host.h"
+#include "ipv4.h"
+
+
+
+
+
+static int
+_host_info_match (struct VscList *item, void *match_data)
+{
+       struct VscMgmtHostInfo *host_info = (struct VscMgmtHostInfo *) item;
+       struct VscMgmtIpv4 *host_ipv4 = (struct VscMgmtIpv4 *) match_data;
+
+       return _vsc_mgmt_ipv4_compare (&host_info->host_ipv4, host_ipv4) == 0;
+}
+
+/*!
+ * @brief Parses a host type from its string representation and returns it.
+ * @internal
+ */
+enum VscMgmtHostType
+_vsc_mgmt_host_type_parse (struct VscError *error,
+                          const char *host_type_string)
+{
+       VSC__ASSERT (error != NULL);
+       VSC__ASSERT (! error->occured);
+
+       if (strcasecmp (host_type_string, "Virtual") == 0) {
+               return VSC_MGMT__HOST_TYPE__VIRTUAL;
+       } else if (strcasecmp (host_type_string, "Xen") == 0) {
+               return VSC_MGMT__HOST_TYPE__XEN;
+       } else if (strcasecmp (host_type_string, "ESX") == 0) {
+               return VSC_MGMT__HOST_TYPE__ESX;
+       } else if (strcasecmp (host_type_string, "ESX vCenter") == 0) {
+               return VSC_MGMT__HOST_TYPE__ESX_VCENTER;
+       } else if (strcasecmp (host_type_string, "KVM") == 0) {
+               return VSC_MGMT__HOST_TYPE__KVM;
+       }
+
+       VSC__ERROR2 (error, VSC__ERROR_CODE__INVALID_ARGUMENT,
+                    "Unknown host type '%s'", host_type_string);
+
+       return VSC_MGMT__HOST_TYPE__UNDEFINED;
+}
+
+/*!
+ * @brief Returns the string representaion of the host type.
+ * @internal
+ *
+ * The string must not be freed by the caller.
+ */
+const char *
+_vsc_mgmt_host_type_string (enum VscMgmtHostType host_type)
+{
+       switch (host_type) {
+       case VSC_MGMT__HOST_TYPE__VIRTUAL:
+               return "Virtual";
+
+       case VSC_MGMT__HOST_TYPE__XEN:
+               return "Xen";
+
+       case VSC_MGMT__HOST_TYPE__ESX:
+               return "ESX";
+
+       case VSC_MGMT__HOST_TYPE__ESX_VCENTER:
+               return "ESX vCenter";
+
+       case VSC_MGMT__HOST_TYPE__KVM:
+               return "KVM";
+
+       default:
+               return "Undefined";
+       }
+}
+
+int /* is_valid */
+_vsc_mgmt_host_type_is_valid (enum VscMgmtHostType host_type)
+{
+       switch (host_type) {
+       case VSC_MGMT__HOST_TYPE__VIRTUAL:
+       case VSC_MGMT__HOST_TYPE__XEN:
+       case VSC_MGMT__HOST_TYPE__ESX:
+       case VSC_MGMT__HOST_TYPE__ESX_VCENTER:
+               return TRUE;
+
+       default:
+               return FALSE;
+       }
+}
+
+struct VscMgmtHostInfo * /* host_info_duplicate */
+_vsc_mgmt_host_info_duplicate (struct VscError *error,
+                               const struct VscMgmtHostInfo *host_info)
+{
+       struct VscMgmtHostInfo *host_info_duplicate = NULL;
+
+       VSC__ASSERT (error != NULL);
+       VSC__ASSERT (! error->occured);
+       VSC__ASSERT (host_info != NULL);
+
+       host_info_duplicate = vsc_memdup (error, host_info,
+                                         sizeof (struct VscMgmtHostInfo));
+
+       if (error->occured) {
+               VSC__APPEND_ERROR0 (error, VSC__ERROR_CODE__TRACE);
+               goto failure;
+       }
+
+       return host_info_duplicate;
+
+failure:
+       _vsc_mgmt_host_info_free (&host_info_duplicate);
+
+       return NULL;
+}
+
+void
+_vsc_mgmt_host_info_free (struct VscMgmtHostInfo **host_info)
+{
+       VSC__ASSERT (host_info != NULL);
+
+       vsc_free (host_info);
+}
+
+int /* is_valid */
+_vsc_mgmt_host_info_is_valid (const struct VscMgmtHostInfo *host_info)
+{
+       VSC__ASSERT (host_info != NULL);
+
+       if (! _vsc_mgmt_ipv4_is_valid (&host_info->host_ipv4)) {
+               return FALSE;
+       }
+
+       if (! _vsc_mgmt_host_type_is_valid (host_info->host_type)) {
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+/*!
+ * @brief Appends a duplicate of the host info to the list.
+ * @internal
+ *
+ * If an error occurs then the list is untouched.
+ */
+void
+_vsc_mgmt_host_info_list_append (struct VscError *error,
+                                 struct VscMgmtHostInfo **host_info_list,
+                                 const struct VscMgmtHostInfo *host_info)
+{
+       VSC__ASSERT (error != NULL);
+       VSC__ASSERT (! error->occured);
+       VSC__ASSERT (host_info != NULL);
+
+       vsc_list_append
+          (error, (struct VscList **) host_info_list, (struct VscList *) host_info,
+           (VscList_DuplicateFunction) _vsc_mgmt_host_info_duplicate);
+
+       if (error->occured) {
+               VSC__APPEND_ERROR0 (error, VSC__ERROR_CODE__TRACE);
+               return;
+       }
+}
+
+/*!
+ * @brief Looks up an host info in the list.
+ * @internal
+ *
+ * The first host info that the matchs the IPv4 is returned. If no match occurs
+ * NULL is returned.
+ *
+ */
+struct VscMgmtHostInfo * /* host_info */
+_vsc_mgmt_host_info_list_lookup (const struct VscMgmtHostInfo *host_info_list,
+                                 const struct VscMgmtIpv4 *host_ipv4)
+{
+       VSC__ASSERT (host_ipv4 != NULL);
+
+       return (struct VscMgmtHostInfo *)
+                vsc_list_lookup
+                  ((struct VscList *) host_info_list,
+                   (VscList_MatchFunction) _host_info_match,
+                   (void *) host_ipv4);
+}
+
+/*!
+ * @brief Removes the host info from the list and frees it.
+ * @internal
+ *
+ * If the host info is not in the list then the list is untouched.
+ */
+void
+_vsc_mgmt_host_info_list_remove (struct VscMgmtHostInfo **host_info_list,
+                                 struct VscMgmtHostInfo *host_info)
+{
+       VSC__ASSERT (host_info_list != NULL);
+       VSC__ASSERT (host_info != NULL);
+
+       vsc_list_remove ((struct VscList **) host_info_list,
+                        (struct VscList *) host_info,
+                        (VscList_FreeFunction) _vsc_mgmt_host_info_free);
+}
+
+/*!
+ * @brief Recursively frees the host info list.
+ * @internal
+ */
+void
+_vsc_mgmt_host_info_list_free (struct VscMgmtHostInfo **host_info_list)
+{
+       VSC__ASSERT (host_info_list != NULL);
+
+       vsc_list_free ((struct VscList **) host_info_list,
+                      (VscList_FreeFunction) _vsc_mgmt_host_info_free);
+}
+
+
+
+
+
+
+
 
 #if 0
 struct HostConnection {
index d1bdee7..e4a9f78 100644 (file)
 #ifndef __VSC_MGMT__LIB__HOST_H__
 #define __VSC_MGMT__LIB__HOST_H__
 
-#include <libvirt/libvirt.h>
+#include "types.h"
 
-#include "../include/libvscmgmt/types.h"
+enum VscMgmtHostType /* host_type */
+_vsc_mgmt_host_type_parse (struct VscError *error,
+                           const char *host_type_string);
+
+const char * /* host_type_string */
+_vsc_mgmt_host_type_string (enum VscMgmtHostType host_type);
+
+int /* is_valid */
+_vsc_mgmt_host_type_is_valid (enum VscMgmtHostType host_type);
+
+struct VscMgmtHostInfo * /* host_info_duplicate */
+_vsc_mgmt_host_info_duplicate (struct VscError *error,
+                               const struct VscMgmtHostInfo *host_info);
+
+void
+_vsc_mgmt_host_info_free (struct VscMgmtHostInfo **host_info);
+
+int /* is_valid */
+_vsc_mgmt_host_info_is_valid (const struct VscMgmtHostInfo *host_info);
+
+void
+_vsc_mgmt_host_info_list_append (struct VscError *error,
+                                 struct VscMgmtHostInfo **host_info_list,
+                                 const struct VscMgmtHostInfo *host_info);
+
+struct VscMgmtHostInfo * /* host_info */
+_vsc_mgmt_host_info_list_lookup (const struct VscMgmtHostInfo *host_info_list,
+                                 const struct VscMgmtIpv4 *host_ipv4);
+
+void
+_vsc_mgmt_host_info_list_remove (struct VscMgmtHostInfo **host_info_list,
+                                 struct VscMgmtHostInfo *host_info);
+
+void
+_vsc_mgmt_host_info_list_free (struct VscMgmtHostInfo **host_info_list);
 
 #if 0
 virConnectPtr
similarity index 97%
rename from utils/ipv4.c
rename to lib/ipv4.c
index d9c0b2e..06a0acb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * ipv4.c: Utilities for Virtualized Supercomputer Management
+ * ipv4.c: Library for Virtualized Supercomputer Management
  *
  * Copyright (C) 2009 Matthias Bolte <matthias.bolte@googlemail.com>
  *
@@ -30,7 +30,8 @@
 #include <libvscmisc/memory.h>
 #include <libvscmisc/string.h>
 
-#include "utils.h"
+#include "../include/libvscmgmt/ipv4.h"
+#include "ipv4.h"
 
 /*!
  * @brief Parses an IPv4 from its string representation.
similarity index 88%
rename from utils/ipv4.h
rename to lib/ipv4.h
index e3180d1..2311f58 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * ipv4.h: Utilities for Virtualized Supercomputer Management
+ * ipv4.h: Library for Virtualized Supercomputer Management
  *
  * Copyright (C) 2009 Matthias Bolte <matthias.bolte@googlemail.com>
  *
@@ -22,8 +22,8 @@
  * @file
  */
 
-#ifndef __VSC_MGMT__UTILS__IPV4_H__
-#define __VSC_MGMT__UTILS__IPV4_H__
+#ifndef __VSC_MGMT__LIB__IPV4_H__
+#define __VSC_MGMT__LIB__IPV4_H__
 
 #include "types.h"
 
@@ -45,4 +45,4 @@ int
 _vsc_mgmt_ipv4_compare (const struct VscMgmtIpv4 *ipv4a,
                         const struct VscMgmtIpv4 *ipv4b);
 
-#endif /* __VSC_MGMT__UTILS__IPV4_H__ */
+#endif /* __VSC_MGMT__LIB__IPV4_H__ */
similarity index 94%
rename from utils/mac.c
rename to lib/mac.c
index cda5d49..2d7ffe4 100644 (file)
+++ b/lib/mac.c
@@ -1,5 +1,5 @@
 /*
- * mac.c: Utilities for Virtualized Supercomputer Management
+ * mac.c: Library for Virtualized Supercomputer Management
  *
  * Copyright (C) 2009 Maximilian Wilhelm <max@rfc2324.org>
  *
@@ -26,7 +26,7 @@
 
 #include <libvscmisc/assert.h>
 
-#include "utils.h"
+#include "mac.h"
 
 /*!
  * @brief Formats a MAC address to its string representation.
similarity index 84%
rename from utils/mac.h
rename to lib/mac.h
index 22c801e..4f47d9f 100644 (file)
+++ b/lib/mac.h
@@ -1,5 +1,5 @@
 /*
- * mac.h: Utilities for Virtualized Supercomputer Management
+ * mac.h: Library for Virtualized Supercomputer Management
  *
  * Copyright (C) 2009 Matthias Bolte <matthias.bolte@googlemail.com>
  *
  * @file
  */
 
-#ifndef __VSC_MGMT__UTILS__MAC_H__
-#define __VSC_MGMT__UTILS__MAC_H__
+#ifndef __VSC_MGMT__LIB__MAC_H__
+#define __VSC_MGMT__LIB__MAC_H__
 
 #include "types.h"
 
 void _vsc_mgmt_mac_format (const struct VscMgmtMac *mac, char *mac_string);
 
-#endif /* __VSC_MGMT__UTILS__MAC_H__ */
+#endif /* __VSC_MGMT__LIB__MAC_H__ */
similarity index 96%
rename from utils/network.c
rename to lib/network.c
index a05b334..a24bad1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * network.c: Utilities for Virtualized Supercomputer Management
+ * network.c: Library for Virtualized Supercomputer Management
  *
  * Copyright (C) 2009 Matthias Bolte <matthias.bolte@googlemail.com>
  *
@@ -27,7 +27,9 @@
 #include <libvscmisc/list.h>
 #include <libvscmisc/memory.h>
 
-#include "utils.h"
+#include "../include/libvscmgmt/network.h"
+#include "ipv4.h"
+#include "network.h"
 
 /*!
  * @brief Appends a duplicate of the network to the list.
similarity index 88%
rename from utils/network.h
rename to lib/network.h
index 0784520..013c8ac 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * network.h: Utilities for Virtualized Supercomputer Management
+ * network.h: Library for Virtualized Supercomputer Management
  *
  * Copyright (C) 2009 Matthias Bolte <matthias.bolte@googlemail.com>
  *
@@ -22,8 +22,8 @@
  * @file
  */
 
-#ifndef __VSC_MGMT__UTILS__NETWORK_H__
-#define __VSC_MGMT__UTILS__NETWORK_H__
+#ifndef __VSC_MGMT__LIB__NETWORK_H__
+#define __VSC_MGMT__LIB__NETWORK_H__
 
 #include "types.h"
 
@@ -44,4 +44,4 @@ _vsc_mgmt_network_list_duplicate (struct VscError *error,
 int /* is_valid */
 _vsc_mgmt_network_list_is_valid (const struct VscMgmtNetwork *network_list);
 
-#endif /* __VSC_MGMT__UTILS__NETWORK_H__ */
+#endif /* __VSC_MGMT__LIB__NETWORK_H__ */
index 2e73030..2cc3c9a 100644 (file)
@@ -25,6 +25,8 @@
 #ifndef __VSC_MGMT__LIB__TYPES_H__
 #define __VSC_MGMT__LIB__TYPES_H__
 
+#include <libvirt/libvirt.h>
+
 #include "../include/libvscmgmt/types.h"
 
 #ifdef __cplusplus
@@ -37,8 +39,11 @@ struct VscMgmtHostInfoInternal {
        char* username;
        char* password;
        virConnectPtr connection;
+       int locked;
 };
 
+struct VscMgmtMutex;
+
 #ifdef __cplusplus
 }
 #endif
similarity index 96%
rename from utils/uuid.c
rename to lib/uuid.c
index 495eb94..b8820af 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * uuid.c: Utilities for Virtualized Supercomputer Management
+ * uuid.c: Library for Virtualized Supercomputer Management
  *
  * Copyright (C) 2009 Matthias Bolte <matthias.bolte@googlemail.com>
  *
@@ -29,7 +29,8 @@
 #include <libvscmisc/list.h>
 #include <libvscmisc/memory.h>
 
-#include "utils.h"
+#include "../include/libvscmgmt/uuid.h"
+#include "uuid.h"
 
 /*!
  * @brief Parses a UUID from string representation.
similarity index 87%
rename from utils/uuid.h
rename to lib/uuid.h
index e18e8e7..b043733 100644 (file)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  */
 
-#ifndef __VSC_MGMT__UTILS__UUID_H__
-#define __VSC_MGMT__UTILS__UUID_H__
+#ifndef __VSC_MGMT__LIB__UUID_H__
+#define __VSC_MGMT__LIB__UUID_H__
 
-#include "../include/libvscmgmt/types.h"
+#include "types.h"
 
 struct VscMgmtUuid * /* uuid_duplicate */
 _vsc_mgmt_uuid_duplicate (struct VscError *error,
@@ -30,4 +30,4 @@ _vsc_mgmt_uuid_duplicate (struct VscError *error,
 void
 _vsc_mgmt_uuid_free (struct VscMgmtUuid **uuid);
 
-#endif /* __VSC_MGMT__UTILS__UUID_H__ */
+#endif /* __VSC_MGMT__LIB__UUID_H__ */
diff --git a/proxy/Makefile b/proxy/Makefile
deleted file mode 100644 (file)
index 862e554..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/make
-#
-# Makefile to build the Proxy for Virtualized Supercomputer Management
-#
-# Copyright (C) 2009 Matthias Bolte <matthias.bolte@googlemail.com>
-#
-
-include ../config.mk
-
-OBJS     = proxy.o
-TARGET   = libvscmgmt-proxy.so
-
-#
-# Fancy gcc options
-#
-
-# libxmlrpc-c
-CFLAGS  += $(shell xmlrpc-c-config client --cflags)
-LDFLAGS += $(shell xmlrpc-c-config client --libs)
-
-#
-# Rules
-#
-
-.PHONY: all clean install
-
-all: $(TARGET)
-
-clean:
-       rm -rf $(TARGET) $(OBJS) $(CLEAN_PATTERNS)
-
-install: install-target-lib
-
-include ../rules.mk
diff --git a/proxy/proxy.c b/proxy/proxy.c
deleted file mode 100644 (file)
index 2589a7f..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * proxy.c: Proxy for Virtualized Supercomputer Management
- *
- * Copyright (C) 2009 Matthias Bolte <matthias.bolte@googlemail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * 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 <stdlib.h>
-#include <stdio.h>
-
-#include <xmlrpc-c/base.h>
-#include <xmlrpc-c/client.h>
-
-#include <libvscmisc/assert.h>
-#include <libvscmisc/error.h>
-#include <libvscmisc/memory.h>
-#include <libvscmisc/string.h>
-
-#include "../utils/utils.h"
-
-static void
-_error_from_xmlrpc (struct VscError *error, const xmlrpc_env *env,
-                    const char *file, const char *function, int line)
-{
-       vsc_error_report (error, VSC__ERROR_CODE__XMLRPC_ERROR, file, line,
-                         function, "%s (%d)", env->fault_string,
-                         env->fault_code);
-}
-
-#define _ERROR_FROM_XMLRPC(error, env) \
-       _error_from_xmlrpc (error, env, __FILE__, __FUNCTION__, __LINE__)
-
-/*
- * Global
- */
-
-static char *_proxy_url = NULL;
-
-void
-vsc_mgmt_init (struct VscError *error)
-{
-       xmlrpc_env env;
-       char *proxy_url = NULL;
-       char version[16];
-
-       VSC__ASSERT (error != NULL);
-       VSC__ASSERT (! error->occured);
-
-       if (_proxy_url != NULL) {
-               VSC__ERROR0 (error, VSC__ERROR_CODE__INVALID_CALL);
-               return;
-       }
-
-       proxy_url = getenv ("LIBVSCMGMT_PROXY_URL");
-
-       if (proxy_url == NULL || *proxy_url == '\0') {
-               VSC__ERROR0 (error, VSC__ERROR_CODE__INVALID_CALL);
-               return;
-       }
-
-       _proxy_url = vsc_strdup (error, proxy_url);
-
-       if (error->occured) {
-               VSC__APPEND_ERROR0 (error, VSC__ERROR_CODE__TRACE);
-               return;
-       }
-
-       xmlrpc_env_init (&env);
-
-       snprintf (version, sizeof (version), "%u.%u.%u",
-                 VSC_MGMT__VERION__MAJOR, VSC_MGMT__VERION__MINOR,
-                 VSC_MGMT__VERION__PATCH);
-
-       xmlrpc_client_init2 (&env, XMLRPC_CLIENT_NO_FLAGS, "libvscmgmt-proxy",
-                            version, NULL, 0);
-
-       if (env.fault_occurred) {
-               _ERROR_FROM_XMLRPC (error, &env);
-       }
-
-       xmlrpc_env_clean (&env);
-}
-
-void
-vsc_mgmt_cleanup (void)
-{
-       VSC__ASSERT (_proxy_url != NULL);
-
-       if (_proxy_url == NULL) {
-               return;
-       }
-
-       vsc_free (&_proxy_url);
-
-       /*
-        * FIXME: If an RPC error occured this call segfaults. This only happens if
-        *        the XML-RPC-C library is compiled with -O3. If compiled with -O0
-        *        everything is fine.
-        */
-       xmlrpc_client_cleanup();
-}
-
-/*
- * Host
- */
-
-void
-vsc_mgmt_host_add (struct VscError *error, const struct VscMgmtIpv4 *host_ipv4,
-                   enum VscMgmtHostType host_type, const char *username,
-                   const char *password)
-{
-       xmlrpc_env env;
-       char host_ipv4_string[VSC_MGMT__IPV4__STRING_SIZE] = "";
-       const char *host_type_string = NULL;
-       xmlrpc_value *result = NULL;
-
-       VSC__ASSERT (error != NULL);
-       VSC__ASSERT (! error->occured);
-
-       if (_proxy_url == NULL) {
-               VSC__ERROR0 (error, VSC__ERROR_CODE__NOT_INITIALIZED);
-               return;
-       }
-
-       vsc_mgmt_ipv4_format (host_ipv4, host_ipv4_string);
-
-       host_type_string = vsc_mgmt_host_type_string (host_type);
-
-       xmlrpc_env_init (&env);
-
-       result = xmlrpc_client_call (&env, _proxy_url, "vsc.mgmt.host.add",
-                                    "({s:{s:s,s:s,s:s,s:s}})", "host_info",
-                                    "host_ipv4", host_ipv4_string,
-                                    "host_type", host_type_string,
-                                    "username", username,
-                                    "password", password);
-
-       if (env.fault_occurred) {
-               _ERROR_FROM_XMLRPC (error, &env);
-               result = NULL;
-               goto cleanup;
-       }
-
-cleanup:
-       if (result != NULL) {
-               xmlrpc_DECREF (result);
-       }
-
-       xmlrpc_env_clean (&env);
-}
-
-void
-vsc_mgmt_host_remove (struct VscError *error,
-                      const struct VscMgmtIpv4 *host_ipv4)
-{
-       xmlrpc_env env;
-       char host_ipv4_string[VSC_MGMT__IPV4__STRING_SIZE] = "";
-       xmlrpc_value *result = NULL;
-
-       VSC__ASSERT (error != NULL);
-       VSC__ASSERT (! error->occured);
-
-       if (_proxy_url == NULL) {
-               VSC__ERROR0 (error, VSC__ERROR_CODE__NOT_INITIALIZED);
-               return;
-       }
-
-       vsc_mgmt_ipv4_format (host_ipv4, host_ipv4_string);
-
-       xmlrpc_env_init (&env);
-
-       result = xmlrpc_client_call (&env, _proxy_url, "vsc.mgmt.host.remove",
-                                    "({s:s})",
-                                    "host_ipv4", host_ipv4_string);
-
-       if (env.fault_occurred) {
-               _ERROR_FROM_XMLRPC (error, &env);
-               result = NULL;
-               goto cleanup;
-       }
-
-cleanup:
-       if (result != NULL) {
-               xmlrpc_DECREF (result);
-       }
-
-       xmlrpc_env_clean (&env);
-}
index f40de71..b556089 100644 (file)
@@ -24,7 +24,7 @@ LDFLAGS += -lvscmisc
 # libvscmgmt
 LDFLAGS += $(LIBVSCMGMT_LDFLAGS)
 
-LD_LIBRARY_PATH = ../lib:../utils:../backend/data/$(DATA_BACKEND):../backend/mutex/$(MUTEX_BACKEND):../backend/network/$(NETWORK_BACKEND)
+LD_LIBRARY_PATH = ../lib:../backend/data/$(DATA_BACKEND):../backend/mutex/$(MUTEX_BACKEND):../backend/network/$(NETWORK_BACKEND)
 
 #
 # Rules
index 04274f8..0062d3a 100644 (file)
@@ -22,7 +22,8 @@
 
 #include <libvscmisc/error.h>
 
-#include "../utils/utils.h"
+#include "../include/libvscmgmt/core.h"
+#include "../include/libvscmgmt/host.h"
 
 static void
 setup (void)
index b676b82..29aa6c9 100644 (file)
@@ -22,7 +22,7 @@
 
 #include <libvscmisc/error.h>
 
-#include "../utils/utils.h"
+#include "../include/libvscmgmt/ipv4.h"
 
 struct ParseInput {
        const char *string;
index 8d0cf39..e1e2dbf 100644 (file)
@@ -22,7 +22,7 @@
 
 #include <libvscmisc/error.h>
 
-#include "../utils/utils.h"
+#include "../include/libvscmgmt/uuid.h"
 
 START_TEST (test_parse)
 {
diff --git a/utils/Makefile b/utils/Makefile
deleted file mode 100644 (file)
index 0775509..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/make
-#
-# Makefile to build the Utilities for Virtualized Supercomputer Management
-#
-# Copyright (C) 2009 Matthias Bolte <matthias.bolte@googlemail.com>
-#
-
-include ../config.mk
-
-OBJS     = host.o ipv4.o mac.o network.o uuid.o
-TARGET   = libvscmgmt-utils.so
-
-#
-# Fancy gcc options
-#
-
-# libvscmisc
-LDFLAGS += -lvscmisc
-
-# libuuid
-CFLAGS  += $(shell pkg-config uuid --cflags)
-LDFLAGS += $(shell pkg-config uuid --libs)
-
-#
-# Rules
-#
-
-.PHONY: all clean install
-
-all: $(TARGET)
-
-clean:
-       rm -rf $(TARGET) $(OBJS) $(CLEAN_PATTERNS)
-
-install: install-target-lib
-
-include ../rules.mk
diff --git a/utils/host.c b/utils/host.c
deleted file mode 100644 (file)
index 6a0aebd..0000000
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * host.c: Utilities for Virtualized Supercomputer Management
- *
- * Copyright (C) 2009 Matthias Bolte <matthias.bolte@googlemail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
- */
-
-/*!
- * @file
- */
-
-#include <strings.h>
-
-#include <libvscmisc/assert.h>
-#include <libvscmisc/error.h>
-#include <libvscmisc/list.h>
-#include <libvscmisc/memory.h>
-#include <libvscmisc/string.h>
-
-#include "utils.h"
-
-static int
-_host_info_match (struct VscList *item, void *match_data)
-{
-       struct VscMgmtHostInfo *host_info = (struct VscMgmtHostInfo *) item;
-       struct VscMgmtIpv4 *host_ipv4 = (struct VscMgmtIpv4 *) match_data;
-
-       return _vsc_mgmt_ipv4_compare (&host_info->host_ipv4, host_ipv4) == 0;
-}
-
-/*!
- * @brief Parses a host type from its string representation and returns it.
- * @internal
- */
-enum VscMgmtHostType
-_vsc_mgmt_host_type_parse (struct VscError *error,
-                          const char *host_type_string)
-{
-       VSC__ASSERT (error != NULL);
-       VSC__ASSERT (! error->occured);
-
-       if (strcasecmp (host_type_string, "Virtual") == 0) {
-               return VSC_MGMT__HOST_TYPE__VIRTUAL;
-       } else if (strcasecmp (host_type_string, "Xen") == 0) {
-               return VSC_MGMT__HOST_TYPE__XEN;
-       } else if (strcasecmp (host_type_string, "ESX") == 0) {
-               return VSC_MGMT__HOST_TYPE__ESX;
-       } else if (strcasecmp (host_type_string, "ESX vCenter") == 0) {
-               return VSC_MGMT__HOST_TYPE__ESX_VCENTER;
-       } else if (strcasecmp (host_type_string, "KVM") == 0) {
-               return VSC_MGMT__HOST_TYPE__KVM;
-       }
-
-       VSC__ERROR2 (error, VSC__ERROR_CODE__INVALID_ARGUMENT,
-                    "Unknown host type '%s'", host_type_string);
-
-       return VSC_MGMT__HOST_TYPE__UNDEFINED;
-}
-
-/*!
- * @brief Returns the string representaion of the host type.
- * @internal
- *
- * The string must not be freed by the caller.
- */
-const char *
-_vsc_mgmt_host_type_string (enum VscMgmtHostType host_type)
-{
-       switch (host_type) {
-       case VSC_MGMT__HOST_TYPE__VIRTUAL:
-               return "Virtual";
-
-       case VSC_MGMT__HOST_TYPE__XEN:
-               return "Xen";
-
-       case VSC_MGMT__HOST_TYPE__ESX:
-               return "ESX";
-
-       case VSC_MGMT__HOST_TYPE__ESX_VCENTER:
-               return "ESX vCenter";
-
-       case VSC_MGMT__HOST_TYPE__KVM:
-               return "KVM";
-
-       default:
-               return "Undefined";
-       }
-}
-
-int /* is_valid */
-_vsc_mgmt_host_type_is_valid (enum VscMgmtHostType host_type)
-{
-       switch (host_type) {
-       case VSC_MGMT__HOST_TYPE__VIRTUAL:
-       case VSC_MGMT__HOST_TYPE__XEN:
-       case VSC_MGMT__HOST_TYPE__ESX:
-       case VSC_MGMT__HOST_TYPE__ESX_VCENTER:
-               return TRUE;
-
-       default:
-               return FALSE;
-       }
-}
-
-struct VscMgmtHostInfo * /* host_info_duplicate */
-_vsc_mgmt_host_info_duplicate (struct VscError *error,
-                               const struct VscMgmtHostInfo *host_info)
-{
-       struct VscMgmtHostInfo *host_info_duplicate = NULL;
-
-       VSC__ASSERT (error != NULL);
-       VSC__ASSERT (! error->occured);
-       VSC__ASSERT (host_info != NULL);
-
-       host_info_duplicate = vsc_memdup (error, host_info,
-                                         sizeof (struct VscMgmtHostInfo));
-
-       if (error->occured) {
-               VSC__APPEND_ERROR0 (error, VSC__ERROR_CODE__TRACE);
-               goto failure;
-       }
-
-       return host_info_duplicate;
-
-failure:
-       _vsc_mgmt_host_info_free (&host_info_duplicate);
-
-       return NULL;
-}
-
-void
-_vsc_mgmt_host_info_free (struct VscMgmtHostInfo **host_info)
-{
-       VSC__ASSERT (host_info != NULL);
-
-       vsc_free (host_info);
-}
-
-int /* is_valid */
-_vsc_mgmt_host_info_is_valid (const struct VscMgmtHostInfo *host_info)
-{
-       VSC__ASSERT (host_info != NULL);
-
-       if (! _vsc_mgmt_ipv4_is_valid (&host_info->host_ipv4)) {
-               return FALSE;
-       }
-
-       if (! _vsc_mgmt_host_type_is_valid (host_info->host_type)) {
-               return FALSE;
-       }
-
-       return TRUE;
-}
-
-/*!
- * @brief Appends a duplicate of the host info to the list.
- * @internal
- *
- * If an error occurs then the list is untouched.
- */
-void
-_vsc_mgmt_host_info_list_append (struct VscError *error,
-                                 struct VscMgmtHostInfo **host_info_list,
-                                 const struct VscMgmtHostInfo *host_info)
-{
-       VSC__ASSERT (error != NULL);
-       VSC__ASSERT (! error->occured);
-       VSC__ASSERT (host_info != NULL);
-
-       vsc_list_append
-          (error, (struct VscList **) host_info_list, (struct VscList *) host_info,
-           (VscList_DuplicateFunction) _vsc_mgmt_host_info_duplicate);
-
-       if (error->occured) {
-               VSC__APPEND_ERROR0 (error, VSC__ERROR_CODE__TRACE);
-               return;
-       }
-}
-
-/*!
- * @brief Looks up an host info in the list.
- * @internal
- *
- * The first host info that the matchs the IPv4 is returned. If no match occurs
- * NULL is returned.
- *
- */
-struct VscMgmtHostInfo * /* host_info */
-_vsc_mgmt_host_info_list_lookup (const struct VscMgmtHostInfo *host_info_list,
-                                 const struct VscMgmtIpv4 *host_ipv4)
-{
-       VSC__ASSERT (host_ipv4 != NULL);
-
-       return (struct VscMgmtHostInfo *)
-                vsc_list_lookup
-                  ((struct VscList *) host_info_list,
-                   (VscList_MatchFunction) _host_info_match,
-                   (void *) host_ipv4);
-}
-
-/*!
- * @brief Removes the host info from the list and frees it.
- * @internal
- *
- * If the host info is not in the list then the list is untouched.
- */
-void
-_vsc_mgmt_host_info_list_remove (struct VscMgmtHostInfo **host_info_list,
-                                 struct VscMgmtHostInfo *host_info)
-{
-       VSC__ASSERT (host_info_list != NULL);
-       VSC__ASSERT (host_info != NULL);
-
-       vsc_list_remove ((struct VscList **) host_info_list,
-                        (struct VscList *) host_info,
-                        (VscList_FreeFunction) _vsc_mgmt_host_info_free);
-}
-
-/*!
- * @brief Recursively frees the host info list.
- * @internal
- */
-void
-_vsc_mgmt_host_info_list_free (struct VscMgmtHostInfo **host_info_list)
-{
-       VSC__ASSERT (host_info_list != NULL);
-
-       vsc_list_free ((struct VscList **) host_info_list,
-                      (VscList_FreeFunction) _vsc_mgmt_host_info_free);
-}
diff --git a/utils/host.h b/utils/host.h
deleted file mode 100644 (file)
index 76d8cf7..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * host.h: Utilities for Virtualized Supercomputer Management
- *
- * Copyright (C) 2009 Matthias Bolte <matthias.bolte@googlemail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
- */
-
-/*!
- * @file
- */
-
-#ifndef __VSC_MGMT__UTILS__HOST_H__
-#define __VSC_MGMT__UTILS__HOST_H__
-
-#include "../include/libvscmgmt/types.h"
-
-enum VscMgmtHostType /* host_type */
-_vsc_mgmt_host_type_parse (struct VscError *error,
-                           const char *host_type_string);
-
-const char * /* host_type_string */
-_vsc_mgmt_host_type_string (enum VscMgmtHostType host_type);
-
-int /* is_valid */
-_vsc_mgmt_host_type_is_valid (enum VscMgmtHostType host_type);
-
-struct VscMgmtHostInfo * /* host_info_duplicate */
-_vsc_mgmt_host_info_duplicate (struct VscError *error,
-                               const struct VscMgmtHostInfo *host_info);
-
-void
-_vsc_mgmt_host_info_free (struct VscMgmtHostInfo **host_info);
-
-int /* is_valid */
-_vsc_mgmt_host_info_is_valid (const struct VscMgmtHostInfo *host_info);
-
-void
-_vsc_mgmt_host_info_list_append (struct VscError *error,
-                                 struct VscMgmtHostInfo **host_info_list,
-                                 const struct VscMgmtHostInfo *host_info);
-
-struct VscMgmtHostInfo * /* host_info */
-_vsc_mgmt_host_info_list_lookup (const struct VscMgmtHostInfo *host_info_list,
-                                 const struct VscMgmtIpv4 *host_ipv4);
-
-void
-_vsc_mgmt_host_info_list_remove (struct VscMgmtHostInfo **host_info_list,
-                                 struct VscMgmtHostInfo *host_info);
-
-void
-_vsc_mgmt_host_info_list_free (struct VscMgmtHostInfo **host_info_list);
-
-#endif /* __VSC_MGMT__UTILS__HOST_H__ */
diff --git a/utils/types.h b/utils/types.h
deleted file mode 100644 (file)
index 767d6bb..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * types.h: Utilities for Virtualized Supercomputer Management
- *
- * Copyright (C) 2009 Matthias Bolte <matthias.bolte@googlemail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
- */
-
-/*!
- * @file
- */
-
-#ifndef __VSC_MGMT__UTILS__TYPES_H__
-#define __VSC_MGMT__UTILS__TYPES_H__
-
-#include "../include/libvscmgmt/types.h"
-
-struct VscMgmtMutex;
-
-#endif /* __VSC_MGMT__UTILS__TYPES_H__ */
diff --git a/utils/utils.h b/utils/utils.h
deleted file mode 100644 (file)
index 1944693..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * utils.h: Utilities for Virtualized Supercomputer Management
- *
- * Copyright (C) 2009 Matthias Bolte <matthias.bolte@googlemail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * 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 __VSC_MGMT__UTILS_H__
-#define __VSC_MGMT__UTILS_H__
-
-#include "../include/libvscmgmt/libvscmgmt.h"
-#include "host.h"
-#include "ipv4.h"
-#include "mac.h"
-#include "network.h"
-#include "uuid.h"
-
-#endif /* __VSC_MGMT__UTILS_H__ */