summaryrefslogtreecommitdiff
path: root/src/analysis/scan/rule.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2023-08-06 16:54:57 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2023-08-06 16:54:57 (GMT)
commit4fcc35a52ccb025b6d803d85e017931cd2452960 (patch)
treee95920f16c273e41f9cae1ea2f02571c221a514e /src/analysis/scan/rule.c
parent74d062d4ec55d7ac3914bbf64b8b6c5ab52227df (diff)
Extend the ROST grammar with a first batch of new features.
Diffstat (limited to 'src/analysis/scan/rule.c')
-rw-r--r--src/analysis/scan/rule.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/analysis/scan/rule.c b/src/analysis/scan/rule.c
index bf37585..6ca97ab 100644
--- a/src/analysis/scan/rule.c
+++ b/src/analysis/scan/rule.c
@@ -91,6 +91,7 @@ static void g_scan_rule_class_init(GScanRuleClass *klass)
static void g_scan_rule_init(GScanRule *rule)
{
rule->name = NULL;
+ rule->name_hash = 0;
rule->data_locals = NULL;
rule->data_allocated = 0;
@@ -168,6 +169,33 @@ GScanRule *g_scan_rule_new(const char *name)
result = g_object_new(G_TYPE_SCAN_RULE, NULL);
result->name = strdup(name);
+ result->name_hash = fnv_64a_hash(name);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : rule = règle de détection à compléter. *
+* hash = empreinte précalculée associée au nom. [OUT] *
+* *
+* Description : Indique le nom associé à une règle de détection. *
+* *
+* Retour : Désignation humaine associée à la règle. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+const char *g_scan_rule_get_name(const GScanRule *rule, fnv64_t *hash)
+{
+ const char *result; /* Désignation à retourner */
+
+ result = rule->name;
+
+ *hash = rule->name_hash;
return result;