summaryrefslogtreecommitdiff
path: root/plugins/pychrysa/analysis/db
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2014-08-18 21:55:24 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2014-08-18 21:55:24 (GMT)
commita0a7b6c1e05c78ae433f353d15e3366107b67d03 (patch)
treebca0b187778cf016c6131bfc982b08c67a38442b /plugins/pychrysa/analysis/db
parent161c0f8ab227af5033b1b6456607b9b9c3bc60df (diff)
Inserted storages and collections into loaded binaries (first steps).
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@389 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'plugins/pychrysa/analysis/db')
-rw-r--r--plugins/pychrysa/analysis/db/Makefile.am17
-rw-r--r--plugins/pychrysa/analysis/db/collection.c117
-rw-r--r--plugins/pychrysa/analysis/db/collection.h42
-rw-r--r--plugins/pychrysa/analysis/db/item.c189
-rw-r--r--plugins/pychrysa/analysis/db/item.h42
-rw-r--r--plugins/pychrysa/analysis/db/items/Makefile.am14
-rw-r--r--plugins/pychrysa/analysis/db/items/comment.c233
-rw-r--r--plugins/pychrysa/analysis/db/items/comment.h42
-rw-r--r--plugins/pychrysa/analysis/db/items/module.c91
-rw-r--r--plugins/pychrysa/analysis/db/items/module.h39
-rw-r--r--plugins/pychrysa/analysis/db/module.c93
-rw-r--r--plugins/pychrysa/analysis/db/module.h39
12 files changed, 958 insertions, 0 deletions
diff --git a/plugins/pychrysa/analysis/db/Makefile.am b/plugins/pychrysa/analysis/db/Makefile.am
new file mode 100644
index 0000000..e33130f
--- /dev/null
+++ b/plugins/pychrysa/analysis/db/Makefile.am
@@ -0,0 +1,17 @@
+
+noinst_LTLIBRARIES = libpychrysaanalysisdb.la
+
+libpychrysaanalysisdb_la_SOURCES = \
+ collection.h collection.c \
+ item.h item.c \
+ module.h module.c
+
+libpychrysaanalysisdb_la_LDFLAGS =
+
+
+AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \
+ -I../../../../src
+
+AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
+
+SUBDIRS = items
diff --git a/plugins/pychrysa/analysis/db/collection.c b/plugins/pychrysa/analysis/db/collection.c
new file mode 100644
index 0000000..87d46e5
--- /dev/null
+++ b/plugins/pychrysa/analysis/db/collection.c
@@ -0,0 +1,117 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * collection.c - équivalent Python du fichier "analysis/db/collection.c"
+ *
+ * Copyright (C) 2012 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include "collection.h"
+
+
+#include <pygobject.h>
+
+
+#include <i18n.h>
+#include <analysis/db/collection.h>
+
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Fournit un accès à une définition de type à diffuser. *
+* *
+* Retour : Définition d'objet pour Python. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+PyTypeObject *get_python_db_collection_type(void)
+{
+ static PyMethodDef py_db_collection_methods[] = {
+ { NULL }
+ };
+
+ static PyGetSetDef py_db_collection_getseters[] = {
+
+ { NULL }
+
+ };
+
+ static PyTypeObject py_db_collection_type = {
+
+ PyVarObject_HEAD_INIT(NULL, 0)
+
+ .tp_name = "pychrysalide.analysis.db.DbCollection",
+ .tp_basicsize = sizeof(PyGObject),
+
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+
+ .tp_doc = "PyChrysalide collection for DataBase collection",
+
+ .tp_methods = py_db_collection_methods,
+ .tp_getset = py_db_collection_getseters,
+
+ };
+
+ return &py_db_collection_type;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : module = module dont la définition est à compléter. *
+* *
+* Description : Prend en charge l'objet 'pychrysalide....db.DbCollection'. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool register_python_db_collection(PyObject *module)
+{
+ PyTypeObject *py_db_collection_type; /* Type Python 'DbCollection' */
+ int ret; /* Bilan d'un appel */
+ PyObject *dict; /* Dictionnaire du module */
+
+ py_db_collection_type = get_python_db_collection_type();
+
+ py_db_collection_type->tp_base = &PyGObject_Type;
+ py_db_collection_type->tp_basicsize = py_db_collection_type->tp_base->tp_basicsize;
+
+ if (PyType_Ready(py_db_collection_type) != 0)
+ return false;
+
+ Py_INCREF(py_db_collection_type);
+ ret = PyModule_AddObject(module, "DbCollection", (PyObject *)py_db_collection_type);
+ if (ret != 0) return false;
+
+ dict = PyModule_GetDict(module);
+ pygobject_register_class(dict, "DbCollection", G_TYPE_DB_COLLECTION, py_db_collection_type,
+ Py_BuildValue("(O)", py_db_collection_type->tp_base));
+
+ return true;
+
+}
diff --git a/plugins/pychrysa/analysis/db/collection.h b/plugins/pychrysa/analysis/db/collection.h
new file mode 100644
index 0000000..cb9a88a
--- /dev/null
+++ b/plugins/pychrysa/analysis/db/collection.h
@@ -0,0 +1,42 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * collection.h - prototypes pour l'équivalent Python du fichier "analysis/db/collection.h"
+ *
+ * Copyright (C) 2014 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#ifndef _PLUGINS_PYCHRYSA_ANALYSIS_DB_COLLECTION_H
+#define _PLUGINS_PYCHRYSA_ANALYSIS_DB_COLLECTION_H
+
+
+#include <Python.h>
+#include <stdbool.h>
+
+
+
+/* Fournit un accès à une définition de type à diffuser. */
+PyTypeObject *get_python_db_collection_type(void);
+
+/* Prend en charge l'objet 'pychrysalide.analysis.db.DbCollection'. */
+bool register_python_db_collection(PyObject *);
+
+
+
+#endif /* _PLUGINS_PYCHRYSA_ANALYSIS_DB_COLLECTIONS_H */
diff --git a/plugins/pychrysa/analysis/db/item.c b/plugins/pychrysa/analysis/db/item.c
new file mode 100644
index 0000000..4f536b4
--- /dev/null
+++ b/plugins/pychrysa/analysis/db/item.c
@@ -0,0 +1,189 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * item.c - équivalent Python du fichier "analysis/db/item.c"
+ *
+ * Copyright (C) 2012 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include "item.h"
+
+
+#include <pygobject.h>
+
+
+#include <i18n.h>
+#include <analysis/db/item.h>
+
+
+
+/* Indique si l'élément contient des données à oublier ou non. */
+static PyObject *py_db_item_get_volatile(PyObject *, void *);
+
+/* Définit si l'élément contient des données à oublier ou non. */
+static int py_db_item_set_volatile(PyObject *, PyObject *, void *);
+
+
+
+/******************************************************************************
+* *
+* Paramètres : self = objet Python concerné par l'appel. *
+* closure = non utilisé ici. *
+* *
+* Description : Indique si l'élément contient des données à oublier ou non. *
+* *
+* Retour : Etat de la sauegarde de l'élément consulté. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_db_item_get_volatile(PyObject *self, void *closure)
+{
+ PyObject *result; /* Valeur à retourner */
+ GDbItem *item; /* Elément à consulter */
+
+ item = G_DB_ITEM(pygobject_get(self));
+
+ result = (g_db_item_is_volatile(item) ? Py_True : Py_False);
+ Py_INCREF(result);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = objet Python concerné par l'appel. *
+* value = valeur fournie à intégrer ou prendre en compte. *
+* closure = non utilisé ici. *
+* *
+* Description : Définit si l'élément contient des données à oublier ou non. *
+* *
+* Retour : Bilan de l'opération pour Python. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static int py_db_item_set_volatile(PyObject *self, PyObject *value, void *closure)
+{
+ GDbItem *item; /* Elément à modifier */
+
+ if (!PyBool_Check(value))
+ {
+ PyErr_SetString(PyExc_TypeError, _("The attribute value must be a boolean."));
+ return -1;
+ }
+
+ item = G_DB_ITEM(pygobject_get(self));
+ g_db_item_set_volatile(item, (bool)(value == Py_True));
+
+ return 0;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Fournit un accès à une définition de type à diffuser. *
+* *
+* Retour : Définition d'objet pour Python. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+PyTypeObject *get_python_db_item_type(void)
+{
+ static PyMethodDef py_db_item_methods[] = {
+ { NULL }
+ };
+
+ static PyGetSetDef py_db_item_getseters[] = {
+
+ {
+ "volatile", py_db_item_get_volatile, py_db_item_set_volatile,
+ "Define if a Database item can be forgotten.", NULL
+ },
+ { NULL }
+
+ };
+
+ static PyTypeObject py_db_item_type = {
+
+ PyVarObject_HEAD_INIT(NULL, 0)
+
+ .tp_name = "pychrysalide.analysis.db.DbItem",
+ .tp_basicsize = sizeof(PyGObject),
+
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+
+ .tp_doc = "PyChrysalide item for DataBase collection",
+
+ .tp_methods = py_db_item_methods,
+ .tp_getset = py_db_item_getseters,
+
+ };
+
+ return &py_db_item_type;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : module = module dont la définition est à compléter. *
+* *
+* Description : Prend en charge l'objet 'pychrysalide....db.items.DbItem'. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool register_python_db_item(PyObject *module)
+{
+ PyTypeObject *py_db_item_type; /* Type Python 'DbItem' */
+ int ret; /* Bilan d'un appel */
+ PyObject *dict; /* Dictionnaire du module */
+
+ py_db_item_type = get_python_db_item_type();
+
+ py_db_item_type->tp_base = &PyGObject_Type;
+ py_db_item_type->tp_basicsize = py_db_item_type->tp_base->tp_basicsize;
+
+ if (PyType_Ready(py_db_item_type) != 0)
+ return false;
+
+ Py_INCREF(py_db_item_type);
+ ret = PyModule_AddObject(module, "DbItem", (PyObject *)py_db_item_type);
+ if (ret != 0) return false;
+
+ dict = PyModule_GetDict(module);
+ pygobject_register_class(dict, "DbItem", G_TYPE_DB_ITEM, py_db_item_type,
+ Py_BuildValue("(O)", py_db_item_type->tp_base));
+
+ return true;
+
+}
diff --git a/plugins/pychrysa/analysis/db/item.h b/plugins/pychrysa/analysis/db/item.h
new file mode 100644
index 0000000..eff0d04
--- /dev/null
+++ b/plugins/pychrysa/analysis/db/item.h
@@ -0,0 +1,42 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * item.h - prototypes pour l'équivalent Python du fichier "analysis/db/item.h"
+ *
+ * Copyright (C) 2014 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#ifndef _PLUGINS_PYCHRYSA_ANALYSIS_DB_ITEM_H
+#define _PLUGINS_PYCHRYSA_ANALYSIS_DB_ITEM_H
+
+
+#include <Python.h>
+#include <stdbool.h>
+
+
+
+/* Fournit un accès à une définition de type à diffuser. */
+PyTypeObject *get_python_db_item_type(void);
+
+/* Prend en charge l'objet 'pychrysalide.analysis.db.DbItem'. */
+bool register_python_db_item(PyObject *);
+
+
+
+#endif /* _PLUGINS_PYCHRYSA_ANALYSIS_DB_ITEM_H */
diff --git a/plugins/pychrysa/analysis/db/items/Makefile.am b/plugins/pychrysa/analysis/db/items/Makefile.am
new file mode 100644
index 0000000..b08a558
--- /dev/null
+++ b/plugins/pychrysa/analysis/db/items/Makefile.am
@@ -0,0 +1,14 @@
+
+noinst_LTLIBRARIES = libpychrysaanalysisdbitems.la
+
+libpychrysaanalysisdbitems_la_SOURCES = \
+ comment.h comment.c \
+ module.h module.c
+
+libpychrysaanalysisdbitems_la_LDFLAGS =
+
+
+AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \
+ -I../../../../../src
+
+AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
diff --git a/plugins/pychrysa/analysis/db/items/comment.c b/plugins/pychrysa/analysis/db/items/comment.c
new file mode 100644
index 0000000..1bb2863
--- /dev/null
+++ b/plugins/pychrysa/analysis/db/items/comment.c
@@ -0,0 +1,233 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * comment.c - équivalent Python du fichier "analysis/db/items/comment.c"
+ *
+ * Copyright (C) 2014 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include "comment.h"
+
+
+#include <pygobject.h>
+
+
+#include <i18n.h>
+#include <analysis/db/items/comment.h>
+
+
+#include "../item.h"
+#include "../../../arch/vmpa.h"
+
+
+
+/* Crée un nouvel objet Python de type 'DbComment'. */
+static PyObject *py_db_comment_new(PyTypeObject *, PyObject *, PyObject *);
+
+/* Fournit le commentaire associé à un commentaire. */
+static PyObject *py_db_comment_get_text(PyObject *, void *);
+
+/* Définit le commentaire associé à un commentaire. */
+static int py_db_comment_set_text(PyObject *, PyObject *, void *);
+
+
+
+/******************************************************************************
+* *
+* Paramètres : type = type de l'objet à instancier. *
+* args = arguments fournis à l'appel. *
+* kwds = arguments de type key=val fournis. *
+* *
+* Description : Crée un nouvel objet Python de type 'DbComment'. *
+* *
+* Retour : Instance Python mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_db_comment_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *result; /* Instance à retourner */
+ PyObject *py_vmpa; /* Localisation version Python */
+ char *text; /* Texte à associer */
+ int is_volatile; /* Conservation en mémoire */
+ int ret; /* Bilan de lecture des args. */
+ vmpa2t *addr; /* Localisation version C */
+ GDbComment *comment; /* Version GLib du commentaire */
+
+ ret = PyArg_ParseTuple(args, "Osp", &py_vmpa, &text, &is_volatile);
+ if (!ret) Py_RETURN_NONE;
+
+ addr = get_internal_vmpa(py_vmpa);
+ if (py_vmpa == NULL) Py_RETURN_NONE;
+
+ comment = g_db_comment_new(addr, text, is_volatile);
+
+ result = pygobject_new(G_OBJECT(comment));
+ g_object_unref(comment);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = objet Python concerné par l'appel. *
+* closure = non utilisé ici. *
+* *
+* Description : Fournit le commentaire associé à un commentaire. *
+* *
+* Retour : Texte manipulable en Python. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_db_comment_get_text(PyObject *self, void *closure)
+{
+ GDbComment *comment; /* Commentaire à consulter */
+ const char *content; /* Contenu textuel associé */
+
+ comment = G_DB_COMMENT(pygobject_get(self));
+ content = g_db_comment_get_text(comment);
+
+ return PyUnicode_FromString(content);
+
+}
+
+
+/*********************d*********************************************************
+* *
+* Paramètres : self = objet Python concerné par l'appel. *
+* value = valeur fournie à intégrer ou prendre en compte. *
+* closure = non utilisé ici. *
+* *
+* Description : Définit le commentaire associé à un commentaire. *
+* *
+* Retour : Bilan de l'opération pour Python. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static int py_db_comment_set_text(PyObject *self, PyObject *value, void *closure)
+{
+ GDbComment *comment; /* Commentaire à consulter */
+
+ if (!PyUnicode_Check(value))
+ {
+ PyErr_SetString(PyExc_TypeError, _("The attribute value must be a string."));
+ return -1;
+ }
+
+ comment = G_DB_COMMENT(pygobject_get(self));
+ g_db_comment_set_text(comment, PyUnicode_DATA(value));
+
+ return 0;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Fournit un accès à une définition de type à diffuser. *
+* *
+* Retour : Définition d'objet pour Python. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+PyTypeObject *get_python_db_comment_type(void)
+{
+ static PyMethodDef py_db_comment_methods[] = {
+ { NULL }
+ };
+
+ static PyGetSetDef py_db_comment_getseters[] = {
+ {
+ "text", py_db_comment_get_text, py_db_comment_set_text,
+ "Give access to the content of a given comment.", NULL
+ },
+ { NULL }
+ };
+
+ static PyTypeObject py_db_comment_type = {
+
+ PyVarObject_HEAD_INIT(NULL, 0)
+
+ .tp_name = "pychrysalide.analysis.db.items.DbComment",
+ .tp_basicsize = sizeof(PyGObject),
+
+ .tp_flags = Py_TPFLAGS_DEFAULT,
+
+ .tp_doc = "PyChrysalide comment for edited binary",
+
+ .tp_methods = py_db_comment_methods,
+ .tp_getset = py_db_comment_getseters,
+ .tp_new = (newfunc)py_db_comment_new
+
+ };
+
+ return &py_db_comment_type;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : module = module dont la définition est à compléter. *
+* *
+* Description : Prend en charge l'objet 'pychrysalide....db.items.DbComment'.*
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool register_python_db_comment(PyObject *module)
+{
+ PyTypeObject *py_db_comment_type; /* Type Python 'DbComment' */
+ int ret; /* Bilan d'un appel */
+ PyObject *dict; /* Dictionnaire du module */
+
+ py_db_comment_type = get_python_db_comment_type();
+
+ py_db_comment_type->tp_base = get_python_db_item_type();
+ py_db_comment_type->tp_basicsize = py_db_comment_type->tp_base->tp_basicsize;
+
+ if (PyType_Ready(py_db_comment_type) != 0)
+ return false;
+
+ Py_INCREF(py_db_comment_type);
+ ret = PyModule_AddObject(module, "DbComment", (PyObject *)py_db_comment_type);
+ if (ret != 0) return false;
+
+ dict = PyModule_GetDict(module);
+ pygobject_register_class(dict, "DbComment", G_TYPE_DB_COMMENT, py_db_comment_type,
+ Py_BuildValue("(O)", py_db_comment_type->tp_base));
+
+ return true;
+
+}
diff --git a/plugins/pychrysa/analysis/db/items/comment.h b/plugins/pychrysa/analysis/db/items/comment.h
new file mode 100644
index 0000000..db02dca
--- /dev/null
+++ b/plugins/pychrysa/analysis/db/items/comment.h
@@ -0,0 +1,42 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * comment.h - prototypes pour l'équivalent Python du fichier "analysis/db/items/comment.h"
+ *
+ * Copyright (C) 2014 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#ifndef _PLUGINS_PYCHRYSA_ANALYSIS_DB_ITEMS_COMMENT_H
+#define _PLUGINS_PYCHRYSA_ANALYSIS_DB_ITEMS_COMMENT_H
+
+
+#include <Python.h>
+#include <stdbool.h>
+
+
+
+/* Fournit un accès à une définition de type à diffuser. */
+PyTypeObject *get_python_db_comment_type(void);
+
+/* Prend en charge l'objet 'pychrysalide.analysis.db.items.DbComment'. */
+bool register_python_db_comment(PyObject *);
+
+
+
+#endif /* _PLUGINS_PYCHRYSA_ANALYSIS_DB_ITEMS_COMMENT_H */
diff --git a/plugins/pychrysa/analysis/db/items/module.c b/plugins/pychrysa/analysis/db/items/module.c
new file mode 100644
index 0000000..3c634e3
--- /dev/null
+++ b/plugins/pychrysa/analysis/db/items/module.c
@@ -0,0 +1,91 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * module.c - intégration du répertoire items en tant que module
+ *
+ * Copyright (C) 2014 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include "module.h"
+
+
+#include "comment.h"
+
+
+
+/******************************************************************************
+* *
+* Paramètres : module = module dont la définition est à compléter. *
+* *
+* Description : Ajoute le module 'items' au module Python. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool add_analysis_db_items_module_to_python_module(PyObject *super)
+{
+ bool result; /* Bilan à retourner */
+ PyObject *module; /* Sous-module mis en place */
+ int ret; /* Bilan d'un appel */
+
+ static PyModuleDef py_chrysalide_items_module = {
+
+ .m_base = PyModuleDef_HEAD_INIT,
+
+ .m_name = "pychrysalide.analysis.db.items",
+ .m_doc = "Python module for Chrysalide.analysis.db.items",
+
+ .m_size = -1,
+
+ };
+
+ result = false;
+
+ module = PyModule_Create(&py_chrysalide_items_module);
+ if (module == NULL) return false;
+
+ ret = PyState_AddModule(super, &py_chrysalide_items_module);
+ if (ret != 0) goto aadimtpm_exit;
+
+ ret = _PyImport_FixupBuiltin(module, "pychrysalide.analysis.db.items");
+ if (ret != 0) goto aadimtpm_exit;
+
+ Py_INCREF(module);
+ ret = PyModule_AddObject(super, "items", module);
+ if (ret != 0) goto aadimtpm_exit;
+
+ result = true;
+
+ result &= register_python_db_comment(module);
+
+ aadimtpm_exit:
+
+ if (!result)
+ {
+ printf("something went wrong in %s...\n", __FUNCTION__);
+ /* ... */
+
+ }
+
+ return result;
+
+}
diff --git a/plugins/pychrysa/analysis/db/items/module.h b/plugins/pychrysa/analysis/db/items/module.h
new file mode 100644
index 0000000..d780d30
--- /dev/null
+++ b/plugins/pychrysa/analysis/db/items/module.h
@@ -0,0 +1,39 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * module.h - prototypes pour l'intégration du répertoire items en tant que module
+ *
+ * Copyright (C) 2014 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#ifndef _PLUGINS_PYCHRYSA_ANALYSIS_DB_ITEMS_MODULE_H
+#define _PLUGINS_PYCHRYSA_ANALYSIS_DB_ITEMS_MODULE_H
+
+
+#include <Python.h>
+#include <stdbool.h>
+
+
+
+/* Ajoute le module 'items' au module Python. */
+bool add_analysis_db_items_module_to_python_module(PyObject *);
+
+
+
+#endif /* _PLUGINS_PYCHRYSA_ANALYSIS_DB_ITEMS_MODULE_H */
diff --git a/plugins/pychrysa/analysis/db/module.c b/plugins/pychrysa/analysis/db/module.c
new file mode 100644
index 0000000..8c527a9
--- /dev/null
+++ b/plugins/pychrysa/analysis/db/module.c
@@ -0,0 +1,93 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * module.c - intégration du répertoire db en tant que module
+ *
+ * Copyright (C) 2014 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include "module.h"
+
+
+#include "collection.h"
+#include "item.h"
+
+
+
+/******************************************************************************
+* *
+* Paramètres : module = module dont la définition est à compléter. *
+* *
+* Description : Ajoute le module 'db' au module Python. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool add_analysis_db_module_to_python_module(PyObject *super)
+{
+ bool result; /* Bilan à retourner */
+ PyObject *module; /* Sous-module mis en place */
+ int ret; /* Bilan d'un appel */
+
+ static PyModuleDef py_chrysalide_db_module = {
+
+ .m_base = PyModuleDef_HEAD_INIT,
+
+ .m_name = "pychrysalide.analysis.db",
+ .m_doc = "Python module for Chrysalide.analysis.db",
+
+ .m_size = -1,
+
+ };
+
+ result = false;
+
+ module = PyModule_Create(&py_chrysalide_db_module);
+ if (module == NULL) return false;
+
+ ret = PyState_AddModule(super, &py_chrysalide_db_module);
+ if (ret != 0) goto aadmtpm_exit;
+
+ ret = _PyImport_FixupBuiltin(module, "pychrysalide.analysis.db");
+ if (ret != 0) goto aadmtpm_exit;
+
+ Py_INCREF(module);
+ ret = PyModule_AddObject(super, "db", module);
+ if (ret != 0) goto aadmtpm_exit;
+
+ result = true;
+
+ result &= register_python_db_collection(module);
+ result &= register_python_db_item(module);
+
+ aadmtpm_exit:
+
+ if (!result)
+ {
+ printf("something went wrong in %s...\n", __FUNCTION__);
+ /* ... */
+
+ }
+
+ return result;
+
+}
diff --git a/plugins/pychrysa/analysis/db/module.h b/plugins/pychrysa/analysis/db/module.h
new file mode 100644
index 0000000..d85c092
--- /dev/null
+++ b/plugins/pychrysa/analysis/db/module.h
@@ -0,0 +1,39 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * module.h - prototypes pour l'intégration du répertoire db en tant que module
+ *
+ * Copyright (C) 2014 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#ifndef _PLUGINS_PYCHRYSA_ANALYSIS_DB_MODULE_H
+#define _PLUGINS_PYCHRYSA_ANALYSIS_DB_MODULE_H
+
+
+#include <Python.h>
+#include <stdbool.h>
+
+
+
+/* Ajoute le module 'db' au module Python. */
+bool add_analysis_db_module_to_python_module(PyObject *);
+
+
+
+#endif /* _PLUGINS_PYCHRYSA_ANALYSIS_DB_MODULE_H */