return DetectU8Match(pitype, itd);
}
-/**
- * \brief This function is used to parse itype options passed via itype: keyword
- *
- * \param de_ctx Pointer to the detection engine context
- * \param itypestr Pointer to the user provided itype options
- *
- * \retval itd pointer to DetectU8Data on success
- * \retval NULL on failure
- */
-static DetectU8Data *DetectITypeParse(DetectEngineCtx *de_ctx, const char *itypestr)
-{
- return DetectU8Parse(itypestr);
-}
-
/**
* \brief this function is used to add the parsed itype data into the current signature
*
DetectU8Data *itd = NULL;
SigMatch *sm = NULL;
- itd = DetectITypeParse(de_ctx, itypestr);
- if (itd == NULL) goto error;
+ itd = DetectU8Parse(itypestr);
+ if (itd == NULL)
+ return -1;
sm = SigMatchAlloc();
if (sm == NULL) goto error;
static int DetectITypeParseTest01(void)
{
DetectU8Data *itd = NULL;
- itd = DetectITypeParse(NULL, "8");
+ itd = DetectU8Parse("8");
FAIL_IF_NULL(itd);
FAIL_IF_NOT(itd->arg1 == 8);
FAIL_IF_NOT(itd->mode == DETECT_UINT_EQ);
static int DetectITypeParseTest02(void)
{
DetectU8Data *itd = NULL;
- itd = DetectITypeParse(NULL, ">8");
+ itd = DetectU8Parse(">8");
FAIL_IF_NULL(itd);
FAIL_IF_NOT(itd->arg1 == 8);
FAIL_IF_NOT(itd->mode == DETECT_UINT_GT);
static int DetectITypeParseTest03(void)
{
DetectU8Data *itd = NULL;
- itd = DetectITypeParse(NULL, "<8");
+ itd = DetectU8Parse("<8");
FAIL_IF_NULL(itd);
FAIL_IF_NOT(itd->arg1 == 8);
FAIL_IF_NOT(itd->mode == DETECT_UINT_LT);
static int DetectITypeParseTest04(void)
{
DetectU8Data *itd = NULL;
- itd = DetectITypeParse(NULL, "8<>20");
+ itd = DetectU8Parse("8<>20");
FAIL_IF_NULL(itd);
FAIL_IF_NOT(itd->arg1 == 8);
FAIL_IF_NOT(itd->arg2 == 20);
static int DetectITypeParseTest05(void)
{
DetectU8Data *itd = NULL;
- itd = DetectITypeParse(NULL, " 8 ");
+ itd = DetectU8Parse(" 8 ");
FAIL_IF_NULL(itd);
FAIL_IF_NOT(itd->arg1 == 8);
FAIL_IF_NOT(itd->mode == DETECT_UINT_EQ);
static int DetectITypeParseTest06(void)
{
DetectU8Data *itd = NULL;
- itd = DetectITypeParse(NULL, " > 8 ");
+ itd = DetectU8Parse(" > 8 ");
FAIL_IF_NULL(itd);
FAIL_IF_NOT(itd->arg1 == 8);
FAIL_IF_NOT(itd->mode == DETECT_UINT_GT);
static int DetectITypeParseTest07(void)
{
DetectU8Data *itd = NULL;
- itd = DetectITypeParse(NULL, " 8 <> 20 ");
+ itd = DetectU8Parse(" 8 <> 20 ");
FAIL_IF_NULL(itd);
FAIL_IF_NOT(itd->arg1 == 8);
FAIL_IF_NOT(itd->arg2 == 20);
static int DetectITypeParseTest08(void)
{
DetectU8Data *itd = NULL;
- itd = DetectITypeParse(NULL, "> 8 <> 20");
+ itd = DetectU8Parse("> 8 <> 20");
FAIL_IF_NOT_NULL(itd);
PASS;
SCReturnInt(0);
}
-/**
- * \internal
- * \brief Function to parse options passed via rfb.sectype keywords.
- *
- * \param rawstr Pointer to the user provided options.
- *
- * \retval dd pointer to DetectU32Data on success.
- * \retval NULL on failure.
- */
-static DetectU32Data *DetectRfbSectypeParse(const char *rawstr)
-{
- return DetectU32Parse(rawstr);
-}
-
/**
* \brief Function to add the parsed RFB security type field into the current signature.
*
if (DetectSignatureSetAppProto(s, ALPROTO_RFB) != 0)
return -1;
- DetectU32Data *dd = DetectRfbSectypeParse(rawstr);
+ DetectU32Data *dd = DetectU32Parse(rawstr);
if (dd == NULL) {
SCLogError("Parsing \'%s\' failed", rawstr);
- goto error;
+ return -1;
}
/* okay so far so good, lets get this into a SigMatch