Squashed 'third_party/rawrtc/re/' content from commit f3163ce8b
Change-Id: I6a235e6ac0f03269d951026f9d195da05c40fdab
git-subtree-dir: third_party/rawrtc/re
git-subtree-split: f3163ce8b526a13b35ef71ce4dd6f43585064d8a
diff --git a/include/re_mod.h b/include/re_mod.h
new file mode 100644
index 0000000..4b132c4
--- /dev/null
+++ b/include/re_mod.h
@@ -0,0 +1,75 @@
+/**
+ * @file re_mod.h Interface to loadable modules
+ *
+ * Copyright (C) 2010 Creytiv.com
+ */
+
+
+/**
+ * @def MOD_PRE
+ *
+ * Module Prefix
+ *
+ * @def MOD_EXT
+ *
+ * Module Extension
+ */
+#if defined (WIN32)
+#define MOD_PRE ""
+#define MOD_EXT ".dll"
+#else
+#define MOD_PRE ""
+#define MOD_EXT ".so"
+#endif
+
+
+/** Symbol to enable exporting of functions from a module */
+#ifdef WIN32
+#define EXPORT_SYM __declspec(dllexport)
+#else
+#define EXPORT_SYM
+#endif
+
+
+/* ----- Module API ----- */
+
+
+/**
+ * Defines the module initialisation handler
+ *
+ * @return 0 for success, otherwise errorcode
+ */
+typedef int (mod_init_h)(void);
+
+/**
+ * Defines the module close handler
+ *
+ * @return 0 for success, otherwise errorcode
+ */
+typedef int (mod_close_h)(void);
+
+
+struct mod;
+struct re_printf;
+
+
+/** Defines the module export */
+struct mod_export {
+ const char *name; /**< Module name */
+ const char *type; /**< Module type */
+ mod_init_h *init; /**< Module init handler */
+ mod_close_h *close; /**< Module close handler */
+};
+
+
+/* ----- Application API ----- */
+
+void mod_init(void);
+void mod_close(void);
+
+int mod_load(struct mod **mp, const char *name);
+int mod_add(struct mod **mp, const struct mod_export *me);
+struct mod *mod_find(const char *name);
+const struct mod_export *mod_export(const struct mod *m);
+struct list *mod_list(void);
+int mod_debug(struct re_printf *pf, void *unused);