Cleaned up the code and documented fucntions.
This commit is contained in:
@ -68,6 +68,7 @@
|
|||||||
#include <session.h>
|
#include <session.h>
|
||||||
#include <plugin.h>
|
#include <plugin.h>
|
||||||
#include <skygw_types.h>
|
#include <skygw_types.h>
|
||||||
|
#include <skygw_debug.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <regex.h>
|
#include <regex.h>
|
||||||
@ -118,13 +119,13 @@ typedef enum {
|
|||||||
}ruletype_t;
|
}ruletype_t;
|
||||||
|
|
||||||
const char* rule_names[] = {
|
const char* rule_names[] = {
|
||||||
"RT_UNDEFINED",
|
"UNDEFINED",
|
||||||
"RT_COLUMN",
|
"COLUMN",
|
||||||
"RT_THROTTLE",
|
"THROTTLE",
|
||||||
"RT_PERMISSION",
|
"PERMISSION",
|
||||||
"RT_WILDCARD",
|
"WILDCARD",
|
||||||
"RT_REGEX",
|
"REGEX",
|
||||||
"RT_CLAUSE"
|
"CLAUSE"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -299,9 +300,9 @@ static void* hrulefree(void* fval)
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace all non-essential characters with whitespace from a null-terminated string.
|
* Strips the single or double quotes from a string.
|
||||||
* This function modifies the passed string.
|
* This function modifies the passed string.
|
||||||
* @param str String to purify
|
* @param str String to parse
|
||||||
* @return Pointer to the modified string
|
* @return Pointer to the modified string
|
||||||
*/
|
*/
|
||||||
char* strip_tags(char* str)
|
char* strip_tags(char* str)
|
||||||
@ -435,9 +436,14 @@ bool check_time(char* str)
|
|||||||
return numbers == 12 && colons == 4 && dashes == 1;
|
return numbers == 12 && colons == 4 && dashes == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CHK_TIMES(t)(assert(t->tm_sec > -1 && t->tm_sec < 62 \
|
|
||||||
|
#ifdef SS_DEBUG
|
||||||
|
#define CHK_TIMES(t)(ss_dassert(t->tm_sec > -1 && t->tm_sec < 62 \
|
||||||
&& t->tm_min > -1 && t->tm_min < 60 \
|
&& t->tm_min > -1 && t->tm_min < 60 \
|
||||||
&& t->tm_hour > -1 && t->tm_hour < 24))
|
&& t->tm_hour > -1 && t->tm_hour < 24))
|
||||||
|
#else
|
||||||
|
#define CHK_TIMES(t)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define IS_RVRS_TIME(tr) (mktime(&tr->end) < mktime(&tr->start))
|
#define IS_RVRS_TIME(tr) (mktime(&tr->end) < mktime(&tr->start))
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user