summaryrefslogtreecommitdiff
path: root/src/analysis/scan/context.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/scan/context.h')
-rw-r--r--src/analysis/scan/context.h111
1 files changed, 111 insertions, 0 deletions
diff --git a/src/analysis/scan/context.h b/src/analysis/scan/context.h
new file mode 100644
index 0000000..c3b979d
--- /dev/null
+++ b/src/analysis/scan/context.h
@@ -0,0 +1,111 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * context.h - prototypes pour le suivi d'analyses via contextes
+ *
+ * Copyright (C) 2022 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide 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.
+ *
+ * Chrysalide 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 _ANALYSIS_SCAN_CONTEXT_H
+#define _ANALYSIS_SCAN_CONTEXT_H
+
+
+#include <glib-object.h>
+
+
+#include "matches.h"
+#include "options.h"
+#include "matches/area.h"
+#include "patterns/patid.h"
+#include "../content.h"
+
+
+
+/* Depuis expr.h : expression d'évaluation généraliste (instance) */
+typedef struct _GScanExpression GScanExpression;
+
+
+#define G_TYPE_SCAN_CONTEXT g_scan_context_get_type()
+#define G_SCAN_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_SCAN_CONTEXT, GScanContext))
+#define G_IS_SCAN_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_SCAN_CONTEXT))
+#define G_SCAN_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_SCAN_CONTEXT, GScanContextClass))
+#define G_IS_SCAN_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_SCAN_CONTEXT))
+#define G_SCAN_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_SCAN_CONTEXT, GScanContextClass))
+
+
+/* Contexte de suivi d'une analyse en cours (instance) */
+typedef struct _GScanContext GScanContext;
+
+/* Contexte de suivi d'une analyse en cours (classe) */
+typedef struct _GScanContextClass GScanContextClass;
+
+
+/* Indique le type défini pour un contexte de suivi d'analyse. */
+GType g_scan_context_get_type(void);
+
+/* Définit un contexte pour suivi d'analyse. */
+GScanContext *g_scan_context_new(GScanOptions *);
+
+/* Fournit l'ensemble des options à respecter pour les analyses. */
+GScanOptions *g_scan_context_get_options(const GScanContext *);
+
+/* Définit le contenu principal à analyser. */
+void g_scan_context_set_content(GScanContext *, GBinContent *, size_t);
+
+/* Fournit une référence au contenu principal analysé. */
+GBinContent *g_scan_context_get_content(const GScanContext *);
+
+/* Indique si la phase d'analyse de contenu est terminée. */
+bool g_scan_context_is_scan_done(const GScanContext *);
+
+/* Note que la phase d'analyse de contenu est terminée. */
+void g_scan_context_mark_scan_as_done(GScanContext *);
+
+/* Retourne tous les correspondances partielles notées. */
+void g_scan_context_store_atom_match_end(GScanContext *, patid_t, phys_t);
+
+/* Retourne tous les correspondances partielles notées. */
+match_area_t *g_scan_context_get_atom_matches(const GScanContext *, patid_t);
+
+/* Enregistre toutes les correspondances établies pour un motif. */
+void g_scan_context_register_full_matches(GScanContext *, GSearchPattern *, GScanMatches *);
+
+/* Fournit la liste de toutes les correspondances pour un motif. */
+GScanMatches *g_scan_context_get_full_matches(const GScanContext *, const GSearchPattern *);
+
+/* Dénombre les correspondances associées à un motif. */
+size_t g_scan_context_count_full_matches(const GScanContext *, const GSearchPattern *);
+
+/* Intègre une condition de correspondance pour règle. */
+bool g_scan_context_set_rule_condition(GScanContext *, const char *, GScanExpression *);
+
+/* Indique si un nom donné correspond à une règle. */
+bool g_scan_context_has_rule_for_name(const GScanContext *, const char *);
+
+/* Indique le bilan des règles globales. */
+bool g_scan_context_has_global_match(const GScanContext *);
+
+/* Définit le bilan des règles globales. */
+void g_scan_context_set_global_match(GScanContext *, bool);
+
+/* Indique si une correspondance globale a pu être établie. */
+bool g_scan_context_has_match_for_rule(GScanContext *, const char *);
+
+
+
+#endif /* _ANALYSIS_SCAN_CONTEXT_H */