Go to the documentation of this file.
35 #define PARSE_REGEX "^true|false|yes|no$"
38 static int mqtt_connack_session_present_id = 0;
91 const bool *
de = (
const bool *)ctx;
97 if (rs_mqtt_tx_get_connack_sessionpresent(txv, &value) ==0 ) {
116 static bool *DetectMQTTConnackSessionPresentParse(
const char *rawstr)
124 if (strcmp(rawstr,
"yes") == 0) {
126 }
else if (strcmp(rawstr,
"true") == 0) {
128 }
else if (strcmp(rawstr,
"no") == 0) {
130 }
else if (strcmp(rawstr,
"false") == 0) {
133 SCLogError(
"invalid session_present flag definition: %s", rawstr);
164 de = DetectMQTTConnackSessionPresentParse(rawstr);
210 static int MQTTConnackSessionPresentTestParse01 (
void)
214 de = DetectMQTTConnackSessionPresentParse(
"yes");
218 de = DetectMQTTConnackSessionPresentParse(
"true");
222 de = DetectMQTTConnackSessionPresentParse(
"false");
226 de = DetectMQTTConnackSessionPresentParse(
"no");
239 static int MQTTConnackSessionPresentTestParse02 (
void)
242 de = DetectMQTTConnackSessionPresentParse(
"nix");
257 static int MQTTConnackSessionPresentTestParse03 (
void)
260 de = DetectMQTTConnackSessionPresentParse(
"");
275 static int MQTTConnackSessionPresentTestParse04 (
void)
278 de = DetectMQTTConnackSessionPresentParse(
",");
296 UtRegisterTest(
"MQTTConnackSessionPresentTestParse01", MQTTConnackSessionPresentTestParse01);
297 UtRegisterTest(
"MQTTConnackSessionPresentTestParse02", MQTTConnackSessionPresentTestParse02);
298 UtRegisterTest(
"MQTTConnackSessionPresentTestParse03", MQTTConnackSessionPresentTestParse03);
299 UtRegisterTest(
"MQTTConnackSessionPresentTestParse04", MQTTConnackSessionPresentTestParse04);
int DetectSignatureSetAppProto(Signature *s, AppProto alproto)
#define FAIL_IF_NULL(expr)
Fail a test if expression evaluates to NULL.
void SigMatchAppendSMToList(Signature *s, SigMatch *new, const int list)
Append a SigMatch to the list type.
void(* Free)(DetectEngineCtx *, void *)
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
main detection engine ctx
int(* AppLayerTxMatch)(DetectEngineThreadCtx *, Flow *, uint8_t flags, void *alstate, void *txv, const Signature *, const SigMatchCtx *)
void MQTTConnackSessionPresentRegisterTests(void)
this function registers unit tests for MQTTConnackSessionPresent
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
int DetectBufferTypeGetByName(const char *name)
#define SIG_FLAG_TOSERVER
#define PASS
Pass the test.
void DetectSetupParseRegexes(const char *parse_str, DetectParseRegex *detect_parse)
void DetectAppLayerInspectEngineRegister2(const char *name, AppProto alproto, uint32_t dir, int progress, InspectEngineFuncPtr2 Callback2, InspectionBufferGetDataPtr GetData)
register inspect engine at start up time
@ DETECT_AL_MQTT_CONNACK_SESSION_PRESENT
SigMatch * SigMatchAlloc(void)
Used to start a pointer to SigMatch context Should never be dereferenced without casting to something...
SigTableElmt sigmatch_table[DETECT_TBLSIZE]
uint8_t DetectEngineInspectGenericList(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, const struct DetectEngineAppInspectionEngine_ *engine, const Signature *s, Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id)
Do the content inspection & validation for a signature.
#define SCLogError(...)
Macro used to log ERROR messages.
a single match condition for a signature
void DetectMQTTConnackSessionPresentRegister(void)
Registration function for mqtt.connack.session_present: keyword.
void DetectMQTTConnackSessionPresentFree(DetectEngineCtx *de_ctx, void *)
void(* RegisterTests)(void)