--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/module.c Fri Mar 13 17:38:23 2009 +0200
@@ -0,0 +1,26 @@
+#include "module.h"
+
+#include <stdlib.h>
+#include <dlfcn.h>
+
+err_t modules_create (struct modules **modules_ptr, struct nexus *nexus)
+{
+ struct moduels *modules;
+
+ // alloc
+ if ((modules = calloc(1, sizeof(*modules))) == NULL)
+ return ERR_CALLOC;
+
+ // init
+ TAILQ_INIT
+
+ // store
+ modules->nexus = nexus;
+}
+
+err_t module_load (struct module **module_ptr, struct nexus *nexus, const struct module_info *info, struct error_info *err)
+{
+ struct module *module;
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/module.h Fri Mar 13 17:38:23 2009 +0200
@@ -0,0 +1,70 @@
+#ifndef MODULE_H
+#define MODULE_H
+
+/**
+ * @file
+ *
+ * Dynamically loadable modules for use with nexus
+ */
+#include "nexus.h"
+#include "error.h"
+
+#include <sys/queue.h>
+
+/**
+ * Information required to load/identify a module.
+ */
+struct module_info {
+ /** Human-readable name */
+ const char *name;
+
+ /** Filesystem path to the .so */
+ const char *path;
+};
+
+/**
+ * A loaded module.
+ */
+struct module {
+ /** The identifying info for the module */
+ struct module_info info;
+
+ /** The module context object */
+ void *ctx;
+
+ /** Our entry in the list of modules */
+ TAILQ_ENTRY(module) ctx_modules;
+};
+
+/**
+ * A set of loaded modules, and functionality to load more
+ */
+struct modules {
+ /** The nexus in use */
+ struct nexus *nexus;
+
+ /** List of loaded modules */
+ TAILQ_HEAD(module_ctx_modules, module) modules;
+};
+
+/**
+ * Module initialization function type
+ */
+typedef void* (*module_init_func_t) (struct nexus *nexus, struct error_info *err);
+
+/**
+ * Create a new modules state
+ */
+err_t modules_create (struct modules **modules_ptr, struct nexus *nexus);
+
+/**
+ * Load a new module.
+ */
+err_t module_load (struct moduels *modules, struct module **module, const struct module_info *info, struct error_info *err);
+
+/**
+ * Unload a module
+ */
+err_t module_unload (struct module *module);
+
+#endif