summaryrefslogtreecommitdiff
path: root/src/analysis/contents/memory.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2024-05-19 22:55:29 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2024-05-19 22:55:29 (GMT)
commit79662ede83b35ad9d91b942218cf09e856e48b4c (patch)
treea2bd2c2e7070aeda9cf2eb97f867cf3ff1b7c92a /src/analysis/contents/memory.c
parent49ae908b6aa3c8c6bca2c79b0a68f587f51b600f (diff)
Restore full featured Python bindings for binary contents.
Diffstat (limited to 'src/analysis/contents/memory.c')
-rw-r--r--src/analysis/contents/memory.c48
1 files changed, 36 insertions, 12 deletions
diff --git a/src/analysis/contents/memory.c b/src/analysis/contents/memory.c
index f8ff863..f7d2bd0 100644
--- a/src/analysis/contents/memory.c
+++ b/src/analysis/contents/memory.c
@@ -62,11 +62,13 @@ static void g_memory_content_finalize(GMemoryContent *);
/* --------------------- IMPLEMENTATION DES FONCTIONS DE CLASSE --------------------- */
+#if 0 // FIXME
/* Associe un ensemble d'attributs au contenu binaire. */
static void g_memory_content_set_attributes(GMemoryContent *, GContentAttributes *);
/* Fournit l'ensemble des attributs associés à un contenu. */
static GContentAttributes *g_memory_content_get_attributes(const GMemoryContent *);
+#endif
/* Donne l'origine d'un contenu binaire. */
static GBinContent *g_memory_content_get_root(GMemoryContent *);
@@ -75,16 +77,16 @@ static GBinContent *g_memory_content_get_root(GMemoryContent *);
static char *g_memory_content_describe(const GMemoryContent *, bool);
/* Fournit une empreinte unique (SHA256) pour les données. */
-static void g_memory_content_compute_checksum(GMemoryContent *, GChecksum *);
+static void g_memory_content_compute_checksum(const GMemoryContent *, GChecksum *);
/* Détermine le nombre d'octets lisibles. */
static phys_t g_memory_content_compute_size(const GMemoryContent *);
/* Détermine la position initiale d'un contenu. */
-static void g_memory_content_compute_start_pos(const GMemoryContent *, vmpa2t *);
+static bool g_memory_content_compute_start_pos(const GMemoryContent *, vmpa2t *);
/* Détermine la position finale d'un contenu. */
-static void g_memory_content_compute_end_pos(const GMemoryContent *, vmpa2t *);
+static bool g_memory_content_compute_end_pos(const GMemoryContent *, vmpa2t *);
/* Avance la tête de lecture d'une certaine quantité de données. */
static bool g_memory_content_seek(const GMemoryContent *, vmpa2t *, phys_t);
@@ -116,12 +118,13 @@ static bool g_memory_content_read_uleb128(const GMemoryContent *, vmpa2t *, uleb
/* Lit un nombre signé encodé au format LEB128. */
static bool g_memory_content_read_leb128(const GMemoryContent *, vmpa2t *, leb128_t *);
+#if 0 // FIXME
/* Charge un contenu depuis une mémoire tampon. */
static bool g_memory_content_load(GMemoryContent *, GObjectStorage *, packed_buffer_t *);
/* Sauvegarde un contenu dans une mémoire tampon. */
static bool g_memory_content_store(const GMemoryContent *, GObjectStorage *, packed_buffer_t *);
-
+#endif
/* ---------------------------------------------------------------------------------- */
@@ -157,8 +160,10 @@ static void g_memory_content_class_init(GMemoryContentClass *klass)
content = G_BIN_CONTENT_CLASS(klass);
+#if 0 // FIXME
content->set_attribs = (set_content_attributes)g_memory_content_set_attributes;
content->get_attribs = (get_content_attributes)g_memory_content_get_attributes;
+#endif
content->get_root = (get_content_root_fc)g_memory_content_get_root;
@@ -184,8 +189,10 @@ static void g_memory_content_class_init(GMemoryContentClass *klass)
content->read_uleb128 = (read_uleb128_fc)g_memory_content_read_uleb128;
content->read_leb128 = (read_leb128_fc)g_memory_content_read_leb128;
+#if 0 // FIXME
content->load = (load_content_cb)g_memory_content_load;
content->store = (store_content_cb)g_memory_content_store;
+#endif
}
@@ -204,6 +211,7 @@ static void g_memory_content_class_init(GMemoryContentClass *klass)
static void g_memory_content_init(GMemoryContent *content)
{
+#if 0 // FIXME
GContentAttributes *empty; /* Jeu d'attributs vide */
content->attribs = NULL;
@@ -213,6 +221,7 @@ static void g_memory_content_init(GMemoryContent *content)
g_binary_content_set_attributes(G_BIN_CONTENT(content), empty);
g_object_unref(G_OBJECT(empty));
+#endif
content->data = NULL;
content->length = 0;
@@ -238,7 +247,9 @@ static void g_memory_content_init(GMemoryContent *content)
static void g_memory_content_dispose(GMemoryContent *content)
{
+#if 0 // FIXME
g_clear_object(&content->attribs);
+#endif
G_OBJECT_CLASS(g_memory_content_parent_class)->dispose(G_OBJECT(content));
@@ -362,7 +373,7 @@ bool g_memory_content_create(GMemoryContent *content, const bin_t *data, phys_t
* Remarques : - *
* *
******************************************************************************/
-
+#if 0 // FIXME
static void g_memory_content_set_attributes(GMemoryContent *content, GContentAttributes *attribs)
{
g_clear_object(&content->attribs);
@@ -397,7 +408,7 @@ static GContentAttributes *g_memory_content_get_attributes(const GMemoryContent
return result;
}
-
+#endif
/******************************************************************************
* *
@@ -464,7 +475,7 @@ static char *g_memory_content_describe(const GMemoryContent *content, bool full)
* *
******************************************************************************/
-static void g_memory_content_compute_checksum(GMemoryContent *content, GChecksum *checksum)
+static void g_memory_content_compute_checksum(const GMemoryContent *content, GChecksum *checksum)
{
g_checksum_update(checksum, content->data, content->length);
@@ -501,16 +512,22 @@ static phys_t g_memory_content_compute_size(const GMemoryContent *content)
* *
* Description : Détermine la position initiale d'un contenu. *
* *
-* Retour : - *
+* Retour : Validité finale de la position fournie. *
* *
* Remarques : - *
* *
******************************************************************************/
-static void g_memory_content_compute_start_pos(const GMemoryContent *content, vmpa2t *pos)
+static bool g_memory_content_compute_start_pos(const GMemoryContent *content, vmpa2t *pos)
{
+ bool result; /* Bilan à retourner */
+
+ result = true;
+
init_vmpa(pos, 0, VMPA_NO_VIRTUAL);
+ return result;
+
}
@@ -521,18 +538,24 @@ static void g_memory_content_compute_start_pos(const GMemoryContent *content, vm
* *
* Description : Détermine la position finale d'un contenu. *
* *
-* Retour : - *
+* Retour : Validité finale de la position fournie. *
* *
* Remarques : - *
* *
******************************************************************************/
-static void g_memory_content_compute_end_pos(const GMemoryContent *content, vmpa2t *pos)
+static bool g_memory_content_compute_end_pos(const GMemoryContent *content, vmpa2t *pos)
{
+ bool result; /* Bilan à retourner */
+
+ result = true;
+
g_memory_content_compute_start_pos(content, pos);
advance_vmpa(pos, content->length);
+ return result;
+
}
@@ -898,7 +921,7 @@ static bool g_memory_content_read_leb128(const GMemoryContent *content, vmpa2t *
* Remarques : - *
* *
******************************************************************************/
-
+#if 0 // FIXME
static bool g_memory_content_load(GMemoryContent *content, GObjectStorage *storage, packed_buffer_t *pbuf)
{
bool result; /* Bilan à retourner */
@@ -1004,3 +1027,4 @@ static bool g_memory_content_store(const GMemoryContent *content, GObjectStorage
return result;
}
+#endif