detect: split new keyword id from registration

Split DetectHelperKeywordRegister into 2 functions, one for acquiring
a new keyword ID, and another to perform the registration.

This makes it easier to do the traditional C keyword initialization
with a dynamic ID.
pull/12875/head
Jason Ish 7 months ago committed by Victor Julien
parent 9c522a0ac9
commit d3835bbb11

@ -466,8 +466,7 @@ static void NdpInitRiskKeyword(void)
* support all the fields required to register the nDPI keywords,
* so we'll just register with an empty keyword specifier to get
* the ID, then fill in the ID. */
SCSigTableElmt keyword = {};
ndpi_protocol_keyword_id = DetectHelperKeywordRegister(&keyword);
ndpi_protocol_keyword_id = SCDetectHelperNewKeywordId();
SCLogDebug("Registered new ndpi-protocol keyword with ID %" PRIu32, ndpi_protocol_keyword_id);
sigmatch_table[ndpi_protocol_keyword_id].name = "ndpi-protocol";
@ -479,7 +478,7 @@ static void NdpInitRiskKeyword(void)
sigmatch_table[ndpi_protocol_keyword_id].flags =
(SIGMATCH_QUOTES_OPTIONAL | SIGMATCH_HANDLE_NEGATION);
ndpi_risk_keyword_id = DetectHelperKeywordRegister(&keyword);
ndpi_risk_keyword_id = SCDetectHelperNewKeywordId();
SCLogDebug("Registered new ndpi-risk keyword with ID %" PRIu32, ndpi_risk_keyword_id);
sigmatch_table[ndpi_risk_keyword_id].name = "ndpi-risk";

Loading…
Cancel
Save