diff options
Diffstat (limited to 'src/analysis/scan/rule.c')
-rw-r--r-- | src/analysis/scan/rule.c | 28 |
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; |