mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-15 23:55:03 +03:00
- Added reference counts to Rule and AuditLog; - Some memory leaks were removed, including GeoLookup; - Deal better with parser errors; - Overriding the AutlogLogWritter destructor.
89 lines
1.8 KiB
C++
89 lines
1.8 KiB
C++
/*
|
|
* ModSecurity, http://www.modsecurity.org/
|
|
* Copyright (c) 2015 Trustwave Holdings, Inc. (http://www.trustwave.com/)
|
|
*
|
|
* You may not use this file except in compliance with
|
|
* the License. You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* If any of the files related to licensing are missing or if you have any
|
|
* other questions related to licensing please contact Trustwave Holdings, Inc.
|
|
* directly using the email address security@modsecurity.org.
|
|
*
|
|
*/
|
|
|
|
#ifdef __cplusplus
|
|
#include <string>
|
|
#include <map>
|
|
#include <stack>
|
|
#include <vector>
|
|
#include <list>
|
|
#endif
|
|
|
|
#ifndef SRC_PARSER_DRIVER_H_
|
|
#define SRC_PARSER_DRIVER_H_
|
|
|
|
#include "modsecurity/modsecurity.h"
|
|
#include "src/rule.h"
|
|
#include "modsecurity/rules.h"
|
|
#include "modsecurity/rules_properties.h"
|
|
#include "src/audit_log.h"
|
|
|
|
#include "parser/seclang-parser.hh"
|
|
|
|
using ModSecurity::Rule;
|
|
using ModSecurity::Rules;
|
|
|
|
|
|
# define YY_DECL \
|
|
yy::seclang_parser::symbol_type yylex(ModSecurity::Parser::Driver& driver)
|
|
|
|
YY_DECL;
|
|
|
|
namespace ModSecurity {
|
|
namespace Parser {
|
|
|
|
#ifdef __cplusplus
|
|
class Driver;
|
|
#else
|
|
typedef struct Driver_t Driver;
|
|
#endif
|
|
|
|
|
|
class Driver : public RulesProperties {
|
|
public:
|
|
Driver();
|
|
virtual ~Driver();
|
|
|
|
int addSecRule(Rule *rule);
|
|
|
|
int result;
|
|
|
|
bool scan_begin();
|
|
void scan_end();
|
|
bool trace_scanning;
|
|
|
|
int parseFile(const std::string& f);
|
|
int parse(const std::string& f, const std::string &ref);
|
|
|
|
std::string file;
|
|
|
|
bool trace_parsing;
|
|
|
|
void error(const yy::location& l, const std::string& m);
|
|
void error(const yy::location& l, const std::string& m,
|
|
const std::string& c);
|
|
|
|
std::list<yy::location *> loc;
|
|
|
|
std::list<std::string> ref;
|
|
std::string buffer;
|
|
};
|
|
|
|
|
|
} // namespace Parser
|
|
} // namespace ModSecurity
|
|
|
|
#endif // SRC_PARSER_DRIVER_H_
|