summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2024-02-24 22:52:58 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2024-02-24 22:53:37 (GMT)
commitf65fdbad3ae0b2accfe324f996eef0c193ad9dfc (patch)
tree2ba4668b9b39aaa102a9c5e28067153419b4b6e1 /src/analysis
parentea9be67a9ddec2b4b96b3114bab5f192e53c7911 (diff)
Provide the match count for bytes using the generic API.
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/scan/context.c2
-rw-r--r--src/analysis/scan/matches.c2
-rw-r--r--src/analysis/scan/matches/bytes.c51
-rw-r--r--src/analysis/scan/matches/bytes.h3
4 files changed, 30 insertions, 28 deletions
diff --git a/src/analysis/scan/context.c b/src/analysis/scan/context.c
index fc4194b..9a0e9ac 100644
--- a/src/analysis/scan/context.c
+++ b/src/analysis/scan/context.c
@@ -483,7 +483,7 @@ size_t g_scan_context_count_full_matches(const GScanContext *context, const GSea
matches = g_hash_table_lookup(context->full_trackers, pattern);
if (matches != NULL)
- result = g_scan_bytes_matches_count(matches);
+ result = g_scan_matches_count(matches);
else
result = 0;
diff --git a/src/analysis/scan/matches.c b/src/analysis/scan/matches.c
index d83114c..1290c90 100644
--- a/src/analysis/scan/matches.c
+++ b/src/analysis/scan/matches.c
@@ -207,7 +207,7 @@ GSearchPattern *g_scan_matches_get_source(const GScanMatches *matches)
/******************************************************************************
* *
-* Paramètres : matches = définition de correspondance à consulter. *
+* Paramètres : matches = définition de correspondances à consulter. *
* *
* Description : Dénombre les correspondances enregistrées pour un motif. *
* *
diff --git a/src/analysis/scan/matches/bytes.c b/src/analysis/scan/matches/bytes.c
index 218121d..a23188b 100644
--- a/src/analysis/scan/matches/bytes.c
+++ b/src/analysis/scan/matches/bytes.c
@@ -56,6 +56,9 @@ static void g_scan_bytes_matches_finalize(GScanBytesMatches *);
/* --------------------- IMPLEMENTATION DES FONCTIONS DE CLASSE --------------------- */
+/* Dénombre les correspondances enregistrées pour un motif. */
+static size_t g_scan_bytes_matches_count(const GScanBytesMatches *);
+
/* Affiche une correspondance au format texte. */
static void g_scan_bytes_matches_output_to_text(const GScanBytesMatches *, int);
@@ -97,6 +100,8 @@ static void g_scan_bytes_matches_class_init(GScanBytesMatchesClass *klass)
matches = G_SCAN_MATCHES_CLASS(klass);
+ matches->count = (count_scan_matches_fc)g_scan_bytes_matches_count;
+
matches->to_text = (output_scan_matches_to_text_fc)g_scan_bytes_matches_output_to_text;
matches->to_json = (output_scan_matches_to_json_fc)g_scan_bytes_matches_output_to_json;
@@ -210,29 +215,6 @@ void g_scan_bytes_matches_set_list(GScanBytesMatches *matches, match_area_t *lis
/******************************************************************************
* *
* Paramètres : matches = suivi de correspondances à consulter. *
-* *
-* Description : Indique le nombre de correspondances pour une définition. *
-* *
-* Retour : Quantité de correspondances établies pour un motif entier. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-size_t g_scan_bytes_matches_count(const GScanBytesMatches *matches)
-{
- size_t result; /* Quantité à retourner */
-
- result = matches->count;
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : matches = suivi de correspondances à consulter. *
* index = indice de la correspondance recherchée. *
* *
* Description : Fournit les informations relatives à une correspondance. *
@@ -337,6 +319,29 @@ char *g_scan_bytes_matches_get_modifier_path(const GScanBytesMatches *matches)
/******************************************************************************
* *
+* Paramètres : matches = suivi de correspondances à consulter. *
+* *
+* Description : Dénombre les correspondances enregistrées pour un motif. *
+* *
+* Retour : Quantité de correspondances établies. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static size_t g_scan_bytes_matches_count(const GScanBytesMatches *matches)
+{
+ size_t result; /* Quantité à retourner */
+
+ result = matches->count;
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : matches = définition de correspondance à manipuler. *
* fd = canal d'écriture. *
* *
diff --git a/src/analysis/scan/matches/bytes.h b/src/analysis/scan/matches/bytes.h
index 50f60a4..90d6062 100644
--- a/src/analysis/scan/matches/bytes.h
+++ b/src/analysis/scan/matches/bytes.h
@@ -61,9 +61,6 @@ GScanMatches *g_scan_bytes_matches_new(void);
/* Intègre une liste de correspondances vérifiées. */
void g_scan_bytes_matches_set_list(GScanBytesMatches *, match_area_t *, size_t);
-/* Indique le nombre de correspondances pour une définition. */
-size_t g_scan_bytes_matches_count(const GScanBytesMatches *);
-
/* Fournit les informations relatives à une correspondance. */
const match_area_t *g_scan_bytes_matches_get(const GScanBytesMatches *, size_t);