#include "host.h"
#include "util-profiling.h"
-static int DetectReplaceSetup (DetectEngineCtx *, Signature *, char *);
+static int DetectReplaceSetup(DetectEngineCtx *, Signature *, char *);
void DetectReplaceRegisterTests(void);
void DetectReplaceRegister (void)
* earlier changes. Thus the highest priority modifications should be
* applied last.
*/
-DetectReplaceList * DetectReplaceAddToList(DetectReplaceList *replist, uint8_t *found, DetectContentData *cd)
+DetectReplaceList *DetectReplaceAddToList(DetectReplaceList *replist,
+ uint8_t *found,
+ DetectContentData *cd)
{
DetectReplaceList *newlist;
DetectReplaceList *tlist = NULL;
SCLogDebug("replace: Executing match");
- while(replist) {
+ while (replist) {
memcpy(replist->found, replist->cd->replace, replist->cd->replace_len);
SCLogDebug("replace: injecting '%s'", replist->cd->replace);
p->flags |= PKT_STREAM_MODIFIED;
void DetectReplaceFreeInternal(DetectReplaceList *replist)
{
DetectReplaceList *tlist = NULL;
- while(replist) {
+ while (replist) {
SCLogDebug("replace: Freeing match");
tlist = replist;
replist = replist->next;
* \retval return 1 if match
* \retval return 0 if not
*/
-int DetectReplaceLongPatternMatchTest(uint8_t *raw_eth_pkt, uint16_t pktsize, char *sig,
- uint32_t sid, uint8_t *pp, uint16_t *len)
+static
+int DetectReplaceLongPatternMatchTest(uint8_t *raw_eth_pkt, uint16_t pktsize,
+ char *sig, uint32_t sid, uint8_t *pp,
+ uint16_t *len)
{
int result = 0;
/**
* \test Check if replace is working
*/
-int DetectReplaceMatchTest01()
+static int DetectReplaceMatchTest01(void)
{
char *sig = "alert tcp any any -> any any (msg:\"Nothing..\";"
" content:\"big\"; replace:\"pig\"; sid:1;)";
/**
* \test Check if replace is working with offset
*/
-int DetectReplaceMatchTest02()
+static int DetectReplaceMatchTest02(void)
{
char *sig = "alert tcp any any -> any any (msg:\"Nothing..\";"
" content:\"th\"; offset: 4; replace:\"TH\"; sid:1;)";
/**
* \test Check if replace is working with offset and keyword inversion
*/
-int DetectReplaceMatchTest03()
+static int DetectReplaceMatchTest03(void)
{
char *sig = "alert tcp any any -> any any (msg:\"Nothing..\";"
" content:\"th\"; replace:\"TH\"; offset: 4; sid:1;)";
/**
* \test Check if replace is working with second content
*/
-int DetectReplaceMatchTest04()
+static int DetectReplaceMatchTest04(void)
{
char *sig = "alert tcp any any -> any any (msg:\"Nothing..\";"
" content:\"th\"; replace:\"TH\"; content:\"patter\"; replace:\"matter\"; sid:1;)";
/**
* \test Check if replace is not done when second content don't match
*/
-int DetectReplaceMatchTest05()
+static int DetectReplaceMatchTest05(void)
{
char *sig = "alert tcp any any -> any any (msg:\"Nothing..\";"
" content:\"th\"; replace:\"TH\"; content:\"nutella\"; sid:1;)";
* \test Check if replace is not done when second content match and not
* first
*/
-int DetectReplaceMatchTest06()
+static int DetectReplaceMatchTest06(void)
{
char *sig = "alert tcp any any -> any any (msg:\"Nothing..\";"
" content:\"nutella\"; replace:\"commode\"; content:\"this is\"; sid:1;)";
/**
* \test Check if replace is working when nocase used
*/
-int DetectReplaceMatchTest07()
+static int DetectReplaceMatchTest07(void)
{
char *sig = "alert tcp any any -> any any (msg:\"Nothing..\";"
" content:\"BiG\"; nocase; replace:\"pig\"; sid:1;)";
/**
* \test Check if replace is working when depth is used
*/
-int DetectReplaceMatchTest08()
+static int DetectReplaceMatchTest08(void)
{
char *sig = "alert tcp any any -> any any (msg:\"Nothing..\";"
" content:\"big\"; depth:17; replace:\"pig\"; sid:1;)";
/**
* \test Check if replace is working when depth block match used
*/
-int DetectReplaceMatchTest09()
+static int DetectReplaceMatchTest09(void)
{
char *sig = "alert tcp any any -> any any (msg:\"Nothing..\";"
" content:\"big\"; depth:16; replace:\"pig\"; sid:1;)";
/**
* \test Check if replace is working when depth block match used
*/
-int DetectReplaceMatchTest10()
+static int DetectReplaceMatchTest10(void)
{
char *sig = "alert tcp any any -> any any (msg:\"Nothing..\";"
" content:\"big\"; depth:17; replace:\"pig\"; offset: 14; sid:1;)";
/**
* \test Check if replace is working with within
*/
-int DetectReplaceMatchTest11()
+static int DetectReplaceMatchTest11(void)
{
char *sig = "alert tcp any any -> any any (msg:\"Nothing..\";"
" content:\"big\"; replace:\"pig\"; content:\"to\"; within: 11; sid:1;)";
/**
* \test Check if replace is working with within
*/
-int DetectReplaceMatchTest12()
+static int DetectReplaceMatchTest12(void)
{
char *sig = "alert tcp any any -> any any (msg:\"Nothing..\";"
" content:\"big\"; replace:\"pig\"; content:\"to\"; within: 4; sid:1;)";
/**
* \test Check if replace is working with within
*/
-int DetectReplaceMatchTest13()
+static int DetectReplaceMatchTest13(void)
{
char *sig = "alert tcp any any -> any any (msg:\"Nothing..\";"
" content:\"big\"; replace:\"pig\"; content:\"test\"; distance: 1; sid:1;)";
/**
* \test Check if replace is working with within
*/
-int DetectReplaceMatchTest14()
+static int DetectReplaceMatchTest14(void)
{
char *sig = "alert tcp any any -> any any (msg:\"Nothing..\";"
" content:\"big\"; replace:\"pig\"; content:\"test\"; distance: 2; sid:1;)";
/**
* \test Check if replace is working with within
*/
-int DetectReplaceMatchTest15()
+static int DetectReplaceMatchTest15(void)
{
char *sig = "alert udp any any -> any any (msg:\"Nothing..\";"
" content:\"com\"; replace:\"org\"; sid:1;)";
/**
* \test Parsing test
*/
-int DetectReplaceParseTest01(void)
+static int DetectReplaceParseTest01(void)
{
int run_mode_backup = run_mode;
run_mode = RUNMODE_NFQ;
/**
* \test Parsing test: non valid because of http protocol
*/
-int DetectReplaceParseTest02(void)
+static int DetectReplaceParseTest02(void)
{
int run_mode_backup = run_mode;
run_mode = RUNMODE_NFQ;
* \test Parsing test: non valid because of http_header on same content
* as replace keyword
*/
-int DetectReplaceParseTest03(void)
+static int DetectReplaceParseTest03(void)
{
int run_mode_backup = run_mode;
run_mode = RUNMODE_NFQ;
/**
* \test Parsing test no content
*/
-int DetectReplaceParseTest04(void)
+static int DetectReplaceParseTest04(void)
{
int run_mode_backup = run_mode;
run_mode = RUNMODE_NFQ;
/**
* \test Parsing test content after replace
*/
-int DetectReplaceParseTest05(void)
+static int DetectReplaceParseTest05(void)
{
int run_mode_backup = run_mode;
run_mode = RUNMODE_NFQ;
/**
* \test Parsing test content and replace length differ
*/
-int DetectReplaceParseTest06(void)
+static int DetectReplaceParseTest06(void)
{
int run_mode_backup = run_mode;
run_mode = RUNMODE_NFQ;
/**
* \test Parsing test content and replace length differ
*/
-int DetectReplaceParseTest07(void)
+static int DetectReplaceParseTest07(void)
{
int run_mode_backup = run_mode;
run_mode = RUNMODE_NFQ;