build: Searching for LMDB during the configuration phase

This commit is contained in:
Felipe Zimmerle 2016-07-05 11:53:02 -03:00
parent afd7a21d11
commit 5daf4873b5
No known key found for this signature in database
GPG Key ID: E6DFB08CE8B11277
6 changed files with 191 additions and 2 deletions

View File

@ -94,6 +94,10 @@ PROG_GEOIP
AM_CONDITIONAL([GEOIP_CFLAGS], [test "GEOIP_CFLAGS" != ""])
# Check for LMDB
PROG_LMDB
AM_CONDITIONAL([LMDB_CFLAGS], [test "LMDB_CFLAGS" != ""])
#
# Check for curl
#
@ -373,6 +377,24 @@ if test "x$YAJL_FOUND" = "x2"; then
fi
## LMDB
if test "x$LMDB_FOUND" = "x0"; then
echo " + LMDB ....not found"
fi
if test "x$LMDB_FOUND" = "x1"; then
echo -n " + LMDB ....found "
if ! test "x$LMDB_VERSION" = "x"; then
echo "v${LMDB_VERSION}"
else
echo ""
fi
echo " ${LMDB_DISPLAY}"
fi
if test "x$LMDB_FOUND" = "x2"; then
echo " + LMDB ....disabled"
fi
## libxml2
if test "x$LIBXML2_FOUND" = "x0"; then
echo " + LibXML2 ....not found"

View File

@ -200,7 +200,8 @@ UTILS = \
COLLECTION = \
collection/collections.cc \
collection/backend/in_memory-per_process.cc
collection/backend/in_memory-per_process.cc \
collection/backend/lmdb.cc
BODY_PROCESSORS = \
@ -250,6 +251,7 @@ libmodsecurity_la_CPPFLAGS = \
$(GLOBAL_CPPFLAGS) \
$(MODSEC_NO_LOGS) \
$(YAJL_CFLAGS) \
$(LMDB_CFLAGS) \
$(PCRE_CFLAGS) \
$(LIBXML2_CFLAGS)
@ -260,6 +262,7 @@ libmodsecurity_la_LIBADD = \
@LEXLIB@ \
$(PCRE_LDADD) \
$(YAJL_LDFLAGS) $(YAJL_LDADD) \
$(LMDB_LDFLAGS) $(LMDB_LDADD) \
$(LIBXML2_LDADD) \
../others/libinjection.la \
libmbedtls.la

View File

@ -0,0 +1,81 @@
/*
* 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.
*
*/
#include "src/collection/backend/lmdb.h"
#include "lmdb.h"
#include <string>
#include "modsecurity/collection/variable.h"
#include "src/utils.h"
namespace modsecurity {
namespace collection {
namespace backend {
LMDB::LMDB() {
}
LMDB::~LMDB() {
}
void LMDB::store(std::string key, std::string value) {
}
bool LMDB::storeOrUpdateFirst(const std::string &key,
const std::string &value) {
return true;
}
bool LMDB::updateFirst(const std::string &key,
const std::string &value) {
}
void LMDB::del(const std::string& key) {
}
void LMDB::resolveSingleMatch(const std::string& var,
std::vector<const Variable *> *l) {
}
void LMDB::resolveMultiMatches(const std::string& var,
std::vector<const Variable *> *l) {
}
void LMDB::resolveRegularExpression(const std::string& var,
std::vector<const Variable *> *l) {
}
std::string* LMDB::resolveFirst(const std::string& var) {
}
} // namespace backend
} // namespace collection
} // namespace modsecurity

View File

@ -0,0 +1,76 @@
/*
* 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 <iostream>
#include <unordered_map>
#include <list>
#include <vector>
#include <algorithm>
#endif
#include <lmdb.h>
#include "modsecurity/collection/variable.h"
#include "modsecurity/collection/collection.h"
#ifndef SRC_COLLECTION_BACKEND_LMDB_H_
#define SRC_COLLECTION_BACKEND_LMDB_H_
#ifdef __cplusplus
namespace modsecurity {
namespace collection {
namespace backend {
class LMDB :
public Collection {
public:
LMDB();
~LMDB();
void store(std::string key, std::string value) override;
bool storeOrUpdateFirst(const std::string &key,
const std::string &value) override;
bool updateFirst(const std::string &key,
const std::string &value) override;
void del(const std::string& key) override;
std::string* resolveFirst(const std::string& var) override;
void resolveSingleMatch(const std::string& var,
std::vector<const Variable *> *l) override;
void resolveMultiMatches(const std::string& var,
std::vector<const Variable *> *l) override;
void resolveRegularExpression(const std::string& var,
std::vector<const Variable *> *l) override;
private:
MDB_env *m_env;
MDB_dbi m_dbi;
MDB_txn *m_txn;
};
} // namespace backend
} // namespace collection
} // namespace modsecurity
#endif
#endif // SRC_COLLECTION_BACKEND_LMDB_H_

View File

@ -35,6 +35,7 @@ unit_tests_LDADD = \
$(GEOIP_LDFLAGS) $(GEOIP_LDADD) \
$(PCRE_LDADD) \
$(YAJL_LDFLAGS) $(YAJL_LDADD) \
$(LMDB_LDFLAGS) $(LMDB_LDADD) \
$(LIBXML2_LDADD)
@ -49,6 +50,7 @@ unit_tests_CPPFLAGS = \
$(MODSEC_NO_LOGS) \
$(GEOIP_CFLAGS) \
$(GLOBAL_CPPFLAGS) \
$(LMDB_CFLAGS) \
$(PCRE_CFLAGS) \
$(YAJL_CFLAGS) \
$(LIBXML2_CFLAGS)
@ -69,6 +71,7 @@ regression_tests_LDADD = \
$(GEOIP_LDFLAGS) $(GEOIP_LDADD) \
$(PCRE_LDADD) \
$(YAJL_LDFLAGS) $(YAJL_LDADD) \
$(LMDB_LDFLAGS) $(LMDB_LDADD) \
$(LIBXML2_LDADD)
@ -83,6 +86,7 @@ regression_tests_CPPFLAGS = \
$(MODSEC_NO_LOGS) \
$(GEOIP_CFLAGS) \
$(GLOBAL_CPPFLAGS) \
$(LMDB_CFLAGS) \
$(PCRE_CFLAGS) \
$(YAJL_CFLAGS) \
$(LIBXML2_CFLAGS)
@ -102,6 +106,7 @@ rules_optimization_LDADD = \
$(GEOIP_LDFLAGS) $(GEOIP_LDADD) \
$(PCRE_LDADD) \
$(YAJL_LDFLAGS) $(YAJL_LDADD) \
$(LMDB_LDFLAGS) $(LMDB_LDADD) \
$(LIBXML2_LDADD)
@ -116,6 +121,7 @@ rules_optimization_CPPFLAGS = \
$(MODSEC_NO_LOGS) \
$(GEOIP_CFLAGS) \
$(GLOBAL_CPPFLAGS) \
$(LMDB_CFLAGS) \
$(PCRE_CFLAGS) \
$(YAJL_CFLAGS) \
$(LIBXML2_CFLAGS)

View File

@ -12,6 +12,7 @@ benchmark_LDADD = \
$(GEOIP_LDFLAGS) $(GEOIP_LDADD) \
$(PCRE_LDADD) \
$(YAJL_LDFLAGS) $(YAJL_LDADD) \
$(LMDB_LDFLAGS) $(LMDB_LDADD) \
$(LIBXML2_LDADD)
benchmark_CPPFLAGS = \
@ -19,9 +20,9 @@ benchmark_CPPFLAGS = \
-I$(top_builddir)/headers \
$(GLOBAL_CPPFLAGS) \
$(PCRE_CFLAGS) \
$(LMDB_CFLAGS) \
$(LIBXML2_CFLAGS)
MAINTAINERCLEANFILES = \
Makefile.in