summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2010-03-31 21:12:35 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2010-03-31 21:12:35 (GMT)
commit7cbdd17b441b35d48624956aa438bde69f18bc37 (patch)
tree438af8d0a994d6e203cf66ea91cf336bb071ee44 /src/plugins
parentd5e55f2ad015781bd7bee0e3216e47d6218e0841 (diff)
Implemented first steps to a Python plugins support.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@146 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
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);
}