Refactoring: new structure for logging alerts

Disruptive actions were moved to actions::disruptive namespace
This commit is contained in:
Felipe Zimmerle
2016-12-01 14:14:54 -03:00
parent bfc30dad34
commit cce6179dcc
14 changed files with 98 additions and 52 deletions

View File

@@ -23,11 +23,47 @@ namespace modsecurity {
typedef struct ModSecurityIntervention_t {
int status;
int pause;
const char *url;
const char *log;
char *url;
char *log;
int disruptive;
} ModSecurityIntervention;
#ifdef __cplusplus
namespace intervention {
static void reset(ModSecurityIntervention_t *i) {
i->status = 200;
i->pause = 0;
i->disruptive = 0;
}
static void clean(ModSecurityIntervention_t *i) {
i->url = NULL;
i->log = NULL;
reset(i);
}
static void freeUrl(ModSecurityIntervention_t *i) {
if (i->url) {
free(i->url);
i->url = NULL;
}
}
static void freeLog(ModSecurityIntervention_t *i) {
if (i->log) {
free(i->log);
i->log = NULL;
}
}
static void free(ModSecurityIntervention_t *i) {
freeUrl(i);
freeLog(i);
}
} // namespace modsecurity
#endif
#ifdef __cplusplus
} // namespace modsecurity
#endif