First version of global' and ip' collections

This commit is contained in:
Felipe Zimmerle
2016-03-30 18:22:00 -03:00
parent 214cc15785
commit e5acc95de8
9 changed files with 368 additions and 10 deletions

View File

@@ -46,15 +46,30 @@ bool InitCol::init(std::string *error) {
m_collection_key = std::string(action, posInit, posEquals - posInit);
m_collection_value = std::string(action, posEquals + 1);
if (m_collection_key != "ip" && m_collection_key != "global") {
return false;
}
return true;
}
bool InitCol::evaluate(Rule *rule, Transaction *transaction) {
bool InitCol::evaluate(Rule *rule, Transaction *t) {
std::string collectionName;
collectionName = MacroExpansion::expand(m_collection_value, transaction);
std::cout << "Collection is not implemented yet, here is the ";
std::cout << "collection name: " << collectionName << std::endl;
collectionName = MacroExpansion::expand(m_collection_value, t);
if (m_collection_key == "ip") {
t->m_collections.m_ip_collection_key = collectionName;
} else if (m_collection_key == "global") {
t->m_collections.m_global_collection_key = collectionName;
} else {
return false;
}
t->debug(5, "Collection `" + m_collection_key + "' initialized with " \
"value: " + collectionName);
return true;
}