summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/Makefile.am1
-rw-r--r--src/plugins/pglist.c24
-rw-r--r--src/plugins/plugin-def.h3
-rw-r--r--src/plugins/plugin-int.h74
-rw-r--r--src/plugins/plugin.c36
5 files changed, 105 insertions, 33 deletions
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index 36fc9b4..9a76f74 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -4,6 +4,7 @@ lib_LTLIBRARIES = libplugins.la
libplugins_la_SOURCES = \
pglist.h pglist.c \
plugin-def.h \
+ plugin-int.h \
plugin.h plugin.c
libplugins_la_CFLAGS = $(AM_CFLAGS)
diff --git a/src/plugins/pglist.c b/src/plugins/pglist.c
index 6d47f57..f242cba 100644
--- a/src/plugins/pglist.c
+++ b/src/plugins/pglist.c
@@ -233,3 +233,27 @@ GPluginModule **get_all_plugins_for_action(PluginAction action, size_t *count)
return result;
}
+
+
+/******************************************************************************
+* *
+* Paramètres : plugin = greffon à ajouter aux autres disponibles. *
+* *
+* Description : Ajoute un greffon à la liste principale de greffons. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void add_plugin_to_main_list(GPluginModule *plugin)
+{
+ plugins_list *list; /* Liste à modifier */
+
+ list = &_list;
+
+ list->plugins = (GPluginModule **)realloc(list->plugins, ++list->plugins_count * sizeof(GPluginModule *));
+ list->plugins[list->plugins_count - 1] = plugin;
+
+}
diff --git a/src/plugins/plugin-def.h b/src/plugins/plugin-def.h
index f8f8fe3..1b47bd6 100644
--- a/src/plugins/plugin-def.h
+++ b/src/plugins/plugin-def.h
@@ -41,13 +41,14 @@ typedef enum _PluginAction
+struct _GPluginModule;
/* Fournit une indication sur le type d'opération(s) menée(s). */
typedef PluginAction (* get_plugin_action_fc) (void);
/* Exécute une action définie sur un binaire chargé. */
-typedef bool (* execute_action_on_binary_fc) (GOpenidaBinary *, PluginAction);
+typedef bool (* execute_action_on_binary_fc) (struct _GPluginModule *, GOpenidaBinary *, PluginAction);
diff --git a/src/plugins/plugin-int.h b/src/plugins/plugin-int.h
new file mode 100644
index 0000000..7e2703b
--- /dev/null
+++ b/src/plugins/plugin-int.h
@@ -0,0 +1,74 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * elf-int.h - prototypes pour les structures internes du format ELF
+ *
+ * Copyright (C) 2008 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * OpenIDA is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * OpenIDA 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _FORMAT_PLUGINS_PLUGIN_INT_H
+#define _FORMAT_PLUGINS_PLUGIN_INT_H
+
+
+#include <glib-object.h>
+
+
+#include "plugin-def.h"
+
+
+
+
+/* Procède à l'initialisation du greffon */
+typedef bool (* init_plugin_fc) (GObject *);
+
+
+
+/* Greffon pour OpenIDA (instance) */
+struct _GPluginModule
+{
+ GObject parent; /* A laisser en premier */
+
+ GModule *module; /* Abstration de manipulation */
+
+ PluginAction action; /* Opération(s) menée(s) */
+
+ init_plugin_fc init; /* Procédure d'initialisation */
+
+ execute_action_on_binary_fc exec_on_bin;/* Action sur un binaire */
+
+};
+
+
+/* Greffon pour OpenIDA (classe) */
+struct _GPluginModuleClass
+{
+ GObjectClass parent; /* A laisser en premier */
+
+};
+
+
+
+
+
+/* Ajoute un greffon à la liste principale de greffons. */
+void add_plugin_to_main_list(GPluginModule *);
+
+
+
+
+#endif /* _FORMAT_PLUGINS_PLUGIN_INT_H */
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index e6e4a1a..ed4c39d 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -1,6 +1,6 @@
/* OpenIDA - Outil d'analyse de fichiers binaires
- * plugin.h - interactions avec un greffon donné
+ * plugin.c - interactions avec un greffon donné
*
* Copyright (C) 2009 Cyrille Bagard
*
@@ -29,38 +29,10 @@
#include <stdbool.h>
+#include "plugin-int.h"
-/* Procède à l'initialisation du greffon */
-typedef bool (* init_plugin_fc) (GObject *);
-
-
-
-/* Greffon pour OpenIDA (instance) */
-struct _GPluginModule
-{
- GObject parent; /* A laisser en premier */
-
- GModule *module; /* Abstration de manipulation */
-
- PluginAction action; /* Opération(s) menée(s) */
-
- init_plugin_fc init; /* Procédure d'initialisation */
-
- execute_action_on_binary_fc exec_on_bin;/* Action sur un binaire */
-
-};
-
-
-/* Greffon pour OpenIDA (classe) */
-struct _GPluginModuleClass
-{
- GObjectClass parent; /* A laisser en premier */
-
-};
-
-
/* Initialise la classe des greffons. */
static void g_plugin_module_class_init(GPluginModuleClass *);
@@ -135,7 +107,7 @@ GPluginModule *g_plugin_module_new(const gchar *filename, GObject *ref)
result->module = g_module_open(filename, G_MODULE_BIND_LAZY);
-#if 1
+#if 0
if (!g_module_symbol(result->module, "get_plugin_action", (gpointer *)&__get_action))
{
printf("Err plugin get_action sym\n");
@@ -213,6 +185,6 @@ PluginAction g_plugin_module_get_action(const GPluginModule *plugin)
bool g_plugin_module_execute_action_on_binary(const GPluginModule *plugin, GOpenidaBinary *binary, PluginAction action)
{
- return plugin->exec_on_bin(binary, action);
+ return plugin->exec_on_bin(plugin, binary, action);
}