-/* Copyright (C) 2007-2012 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
static pcre *parse_regex;
static pcre_extra *parse_regex_study;
-int DetectTagMatch (ThreadVars *, DetectEngineThreadCtx *, Packet *, Signature *, SigMatch *);
-static int DetectTagSetup (DetectEngineCtx *, Signature *, char *);
+int DetectTagMatch(ThreadVars *, DetectEngineThreadCtx *, Packet *, Signature *, SigMatch *);
+static int DetectTagSetup(DetectEngineCtx *, Signature *, char *);
void DetectTagRegisterTests(void);
void DetectTagDataFree(void *);
/**
* \brief Registration function for keyword tag
*/
-void DetectTagRegister (void) {
+void DetectTagRegister(void)
+{
sigmatch_table[DETECT_TAG].name = "tag";
sigmatch_table[DETECT_TAG].Match = DetectTagMatch;
sigmatch_table[DETECT_TAG].Setup = DetectTagSetup;
* \retval 0 no match
* \retval 1 match
*/
-int DetectTagMatch (ThreadVars *t, DetectEngineThreadCtx *det_ctx, Packet *p, Signature *s, SigMatch *m)
+int DetectTagMatch(ThreadVars *t, DetectEngineThreadCtx *det_ctx, Packet *p, Signature *s, SigMatch *m)
{
DetectTagData *td = (DetectTagData *) m->ctx;
DetectTagDataEntry tde;
* \retval td pointer to DetectTagData on success
* \retval NULL on failure
*/
-DetectTagData *DetectTagParse (char *tagstr)
+DetectTagData *DetectTagParse(char *tagstr)
{
DetectTagData td;
#define MAX_SUBSTRINGS 30
* \retval 0 on Success
* \retval -1 on Failure
*/
-int DetectTagSetup (DetectEngineCtx *de_ctx, Signature *s, char *tagstr)
+int DetectTagSetup(DetectEngineCtx *de_ctx, Signature *s, char *tagstr)
{
DetectTagData *td = NULL;
SigMatch *sm = NULL;
*
* \param td pointer to DetectTagDataEntry
*/
-static void DetectTagDataEntryFree(void *ptr) {
+static void DetectTagDataEntryFree(void *ptr)
+{
if (ptr != NULL) {
DetectTagDataEntry *dte = (DetectTagDataEntry *)ptr;
SCFree(dte);
*
* \param td pointer to DetectTagDataEntryList
*/
-void DetectTagDataListFree(void *ptr) {
+void DetectTagDataListFree(void *ptr)
+{
if (ptr != NULL) {
DetectTagDataEntry *entry = ptr;
*
* \param td pointer to DetectTagData
*/
-void DetectTagDataFree(void *ptr) {
+void DetectTagDataFree(void *ptr)
+{
DetectTagData *td = (DetectTagData *)ptr;
SCFree(td);
}
* \test DetectTagTestParse01 is a test to make sure that we return "something"
* when given valid tag opt
*/
-int DetectTagTestParse01 (void) {
+static int DetectTagTestParse01(void)
+{
int result = 0;
DetectTagData *td = NULL;
td = DetectTagParse("session, 123, packets");
/**
* \test DetectTagTestParse02 is a test to check that we parse tag correctly
*/
-int DetectTagTestParse02 (void) {
+static int DetectTagTestParse02(void)
+{
int result = 0;
DetectTagData *td = NULL;
td = DetectTagParse("host, 200, bytes, src");
/**
* \test DetectTagTestParse03 is a test for setting the stateless tag opt
*/
-int DetectTagTestParse03 (void) {
+static int DetectTagTestParse03(void)
+{
int result = 0;
DetectTagData *td = NULL;
td = DetectTagParse("host, 200, bytes, dst");
/**
* \test DetectTagTestParse04 is a test for default opts
*/
-int DetectTagTestParse04 (void) {
+static int DetectTagTestParse04(void)
+{
int result = 0;
DetectTagData *td = NULL;
td = DetectTagParse("session");
/**
* \test DetectTagTestParse05 is a test for default opts
*/
-int DetectTagTestParse05 (void) {
+static int DetectTagTestParse05(void)
+{
int result = 0;
DetectTagData *td = NULL;
td = DetectTagParse("host");
/**
* \brief this function registers unit tests for DetectTag
*/
-void DetectTagRegisterTests(void) {
+void DetectTagRegisterTests(void)
+{
#ifdef UNITTESTS
UtRegisterTest("DetectTagTestParse01", DetectTagTestParse01, 1);
UtRegisterTest("DetectTagTestParse02", DetectTagTestParse02, 1);
DetectEngineTagRegisterTests();
#endif /* UNITTESTS */
}
-
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
static pcre *parse_regex;
static pcre_extra *parse_regex_study;
-static int DetectThresholdMatch (ThreadVars *, DetectEngineThreadCtx *, Packet *, Signature *, SigMatch *);
-static int DetectThresholdSetup (DetectEngineCtx *, Signature *, char *);
+static int DetectThresholdMatch(ThreadVars *, DetectEngineThreadCtx *, Packet *, Signature *, SigMatch *);
+static int DetectThresholdSetup(DetectEngineCtx *, Signature *, char *);
static void DetectThresholdFree(void *);
/**
* \brief Registration function for threshold: keyword
*/
-void DetectThresholdRegister (void) {
+void DetectThresholdRegister(void)
+{
sigmatch_table[DETECT_THRESHOLD].name = "threshold";
sigmatch_table[DETECT_THRESHOLD].desc = "control the rule's alert frequency";
sigmatch_table[DETECT_THRESHOLD].url = "https://redmine.openinfosecfoundation.org/projects/suricata/wiki/Rule-Thresholding#threshold";
}
-static int DetectThresholdMatch (ThreadVars *thv, DetectEngineThreadCtx *det_ctx, Packet *p, Signature *s, SigMatch *sm)
+static int DetectThresholdMatch(ThreadVars *thv, DetectEngineThreadCtx *det_ctx, Packet *p, Signature *s, SigMatch *sm)
{
return 1;
}
* \retval de pointer to DetectThresholdData on success
* \retval NULL on failure
*/
-static DetectThresholdData *DetectThresholdParse (char *rawstr)
+static DetectThresholdData *DetectThresholdParse(char *rawstr)
{
DetectThresholdData *de = NULL;
#define MAX_SUBSTRINGS 30
* \retval 0 on Success
* \retval -1 on Failure
*/
-static int DetectThresholdSetup (DetectEngineCtx *de_ctx, Signature *s, char *rawstr)
+static int DetectThresholdSetup(DetectEngineCtx *de_ctx, Signature *s, char *rawstr)
{
DetectThresholdData *de = NULL;
SigMatch *sm = NULL;
*
* \param de pointer to DetectThresholdData
*/
-static void DetectThresholdFree(void *de_ptr) {
+static void DetectThresholdFree(void *de_ptr)
+{
DetectThresholdData *de = (DetectThresholdData *)de_ptr;
if (de) {
DetectAddressFree(de->addr);
* \retval 1 on succces
* \retval 0 on failure
*/
-static int ThresholdTestParse01 (void) {
+static int ThresholdTestParse01(void)
+{
DetectThresholdData *de = NULL;
de = DetectThresholdParse("type limit,track by_dst,count 10,seconds 60");
if (de && (de->type == TYPE_LIMIT) && (de->track == TRACK_DST) && (de->count == 10) && (de->seconds == 60)) {
* \retval 1 on succces
* \retval 0 on failure
*/
-static int ThresholdTestParse02 (void) {
+static int ThresholdTestParse02(void)
+{
DetectThresholdData *de = NULL;
de = DetectThresholdParse("type any,track by_dst,count 10,seconds 60");
if (de && (de->type == TYPE_LIMIT) && (de->track == TRACK_DST) && (de->count == 10) && (de->seconds == 60)) {
* \retval 1 on succces
* \retval 0 on failure
*/
-static int ThresholdTestParse03 (void) {
+static int ThresholdTestParse03(void)
+{
DetectThresholdData *de = NULL;
de = DetectThresholdParse("track by_dst, type limit, seconds 60, count 10");
if (de && (de->type == TYPE_LIMIT) && (de->track == TRACK_DST) && (de->count == 10) && (de->seconds == 60)) {
* \retval 1 on succces
* \retval 0 on failure
*/
-static int ThresholdTestParse04 (void) {
+static int ThresholdTestParse04(void)
+{
DetectThresholdData *de = NULL;
de = DetectThresholdParse("count 10, track by_dst, seconds 60, type both, count 10");
if (de && (de->type == TYPE_BOTH) && (de->track == TRACK_DST) && (de->count == 10) && (de->seconds == 60)) {
* \retval 1 on succces
* \retval 0 on failure
*/
-static int ThresholdTestParse05 (void) {
+static int ThresholdTestParse05(void)
+{
DetectThresholdData *de = NULL;
de = DetectThresholdParse("count 10, track by_dst, seconds 60, type both");
if (de && (de->type == TYPE_BOTH) && (de->track == TRACK_DST) && (de->count == 10) && (de->seconds == 60)) {
* \retval 0 on failure
*/
-static int DetectThresholdTestSig1(void) {
-
+static int DetectThresholdTestSig1(void)
+{
Packet *p = NULL;
Signature *s = NULL;
ThreadVars th_v;
* \retval 0 on failure
*/
-static int DetectThresholdTestSig2(void) {
+static int DetectThresholdTestSig2(void)
+{
Packet *p = NULL;
Signature *s = NULL;
ThreadVars th_v;
* \retval 0 on failure
*/
-static int DetectThresholdTestSig3(void) {
+static int DetectThresholdTestSig3(void)
+{
Packet *p = NULL;
Signature *s = NULL;
ThreadVars th_v;
* \retval 0 on failure
*/
-static int DetectThresholdTestSig4(void) {
+static int DetectThresholdTestSig4(void)
+{
Packet *p = NULL;
Signature *s = NULL;
ThreadVars th_v;
* \retval 0 on failure
*/
-static int DetectThresholdTestSig5(void) {
+static int DetectThresholdTestSig5(void)
+{
Packet *p = NULL;
Signature *s = NULL;
ThreadVars th_v;
return result;
}
-static int DetectThresholdTestSig6Ticks(void) {
+static int DetectThresholdTestSig6Ticks(void)
+{
Packet *p = NULL;
Signature *s = NULL;
ThreadVars th_v;
/**
* \test Test drop action being set even if thresholded
*/
-static int DetectThresholdTestSig7(void) {
+static int DetectThresholdTestSig7(void)
+{
Packet *p = NULL;
Signature *s = NULL;
ThreadVars th_v;
/**
* \test Test drop action being set even if thresholded
*/
-static int DetectThresholdTestSig8(void) {
+static int DetectThresholdTestSig8(void)
+{
Packet *p = NULL;
Signature *s = NULL;
ThreadVars th_v;
/**
* \test Test drop action being set even if thresholded
*/
-static int DetectThresholdTestSig10(void) {
+static int DetectThresholdTestSig10(void)
+{
Packet *p = NULL;
Signature *s = NULL;
ThreadVars th_v;
/**
* \test Test drop action being set even if thresholded
*/
-static int DetectThresholdTestSig11(void) {
+static int DetectThresholdTestSig11(void)
+{
Packet *p = NULL;
Signature *s = NULL;
ThreadVars th_v;
/**
* \test Test drop action being set even if thresholded
*/
-static int DetectThresholdTestSig12(void) {
+static int DetectThresholdTestSig12(void)
+{
Packet *p = NULL;
Signature *s = NULL;
ThreadVars th_v;
#endif /* UNITTESTS */
-void ThresholdRegisterTests(void) {
+void ThresholdRegisterTests(void)
+{
#ifdef UNITTESTS
UtRegisterTest("ThresholdTestParse01", ThresholdTestParse01, 1);
UtRegisterTest("ThresholdTestParse02", ThresholdTestParse02, 0);