summaryrefslogtreecommitdiff
path: root/src/glibext/gbinportion.h
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2013-08-31 15:56:10 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2013-08-31 15:56:10 (GMT)
commited4bb73e5d68c1f81b8e0c3210aa221ec6f2675b (patch)
tree006a4641fc7a5c820d6a4253ff75e79ef01e368b /src/glibext/gbinportion.h
parent4658d4fa406bad4abe36a76746412cf02c984af0 (diff)
Loaded a binary strip into the editor.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@358 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/glibext/gbinportion.h')
-rw-r--r--src/glibext/gbinportion.h148
1 files changed, 148 insertions, 0 deletions
diff --git a/src/glibext/gbinportion.h b/src/glibext/gbinportion.h
new file mode 100644
index 0000000..826d65f
--- /dev/null
+++ b/src/glibext/gbinportion.h
@@ -0,0 +1,148 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * binportion.h - prototypes pour la représentation graphique de portions de binaire
+ *
+ * Copyright (C) 2013 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 _GLIBEXT_BINPORTION_H
+#define _GLIBEXT_BINPORTION_H
+
+
+#include <glib-object.h>
+#include <stdbool.h>
+#include <gtk/gtk.h>
+
+
+#include "../arch/archbase.h"
+#include "../common/fnv1a.h"
+
+
+
+/* --------------------------- COULEURS DE REPRESENTATION --------------------------- */
+
+
+/* Converion code -> identifiant unique */
+typedef fnv64_t bp_color_t;
+
+/* Identifiant non valide */
+#define BP_NO_COLOR 0
+
+/* Identifiant pour la transparence */
+#define BP_INHERIT_COLOR 1
+
+
+
+#define BPC_RAW "raw"
+#define BPC_CODE "code"
+#define BPC_DATA "data"
+#define BPC_DATA_RO "data-ro"
+#define BPC_DISASS_ERROR "disassembly-error"
+
+
+
+
+
+/* Enregistre une couleur pour le dessin de portions. */
+bool register_binary_portion_color(const char *, uint8_t, uint8_t, uint8_t, uint8_t);
+
+/* Supprime une couleur pour le dessin de portions. */
+void unregister_binary_portion_color(const char *);
+
+/* Enregistre les couleurs de base pour le dessin des portions. */
+void init_binary_portion_colors(void);
+
+/* Supprime les couleurs de base pour le dessin des portions. */
+void exit_binary_portion_colors(void);
+
+
+
+
+
+#define G_TYPE_BIN_PORTION (g_binary_portion_get_type())
+#define G_BIN_PORTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_BIN_PORTION, GBinPortion))
+#define G_IS_BIN_PORTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_BIN_PORTION))
+#define G_BIN_PORTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_BIN_PORTION, GBinPortionClass))
+#define G_IS_BIN_PORTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_BIN_PORTION))
+#define G_BIN_PORTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_BIN_PORTION, GBinPortionClass))
+
+
+/* Portion de données binaires quelconques (instance) */
+typedef struct _GBinPortion GBinPortion;
+
+/* Portion de données binaires quelconques (classe) */
+typedef struct _GBinPortionClass GBinPortionClass;
+
+
+/* Droits d'accès à une portion */
+typedef enum _PortionAccessRights
+{
+ PAC_NONE = (0 << 0), /* Aucun */
+ PAC_READ = (1 << 0), /* Lecture */
+ PAC_WRITE = (1 << 1), /* Ecriture */
+ PAC_EXEC = (1 << 2) /* Exécution */
+
+} PortionAccessRights;
+
+
+/* Indique le type défini par la GLib pour les blocs de données. */
+GType g_binary_portion_get_type(void);
+
+/* Crée une description de partie de code vierge. */
+GBinPortion *g_binary_portion_new(const char *);
+
+/* Attribue une description humaine à une partie de code. */
+void g_binary_portion_set_desc(GBinPortion *, const char *);
+
+/* Fournit la description attribuée à une partie de code. */
+const char *g_binary_portion_get_desc(const GBinPortion *);
+
+/* Définit les valeurs utiles d'une partie de code. */
+void g_binary_portion_set_values(GBinPortion *, off_t, off_t, vmpa_t);
+
+/* Définit les droits associés à une partie de code. */
+void g_binary_portion_set_rights(GBinPortion *, PortionAccessRights);
+
+/* Fournit les droits associés à une partie de code. */
+PortionAccessRights g_binary_portion_get_rights(const GBinPortion *);
+
+/* Procède à l'inclusion d'une portion dans une autre. */
+void g_binary_portion_include(GBinPortion *, GBinPortion *);
+
+/* Recherche la portion présente à un point donné. */
+GBinPortion *g_binary_portion_find_at_pos(GBinPortion *, gint, GdkRectangle *);
+
+/* Recherche la portion présente à une adresse donnée. */
+GBinPortion *g_binary_portion_find_at_addr(GBinPortion *, vmpa_t, GdkRectangle *);
+
+/* Fournit la position correspondant à une adresse donnée. */
+bool g_binary_portion_get_addr_from_pos(GBinPortion *, gint, const GdkRectangle *, vmpa_t *);
+
+/* Fournit l'adresse correspondant à une position donnée. */
+bool g_binary_portion_get_pos_from_addr(GBinPortion *, vmpa_t, const GdkRectangle *, gint *);
+
+/* Prépare une astuce concernant une portion pour son affichage. */
+gboolean g_binary_portion_query_tooltip(GBinPortion *, gint, gint, const GdkRectangle *, GtkTooltip *);
+
+/* Représente la portion sur une bande dédiée. */
+void g_binary_portion_draw(GBinPortion *, cairo_t *, const GdkRectangle *);
+
+
+
+#endif /* _GLIBEXT_BINPORTION_H */