We will configure project platform specific variables with cmake now

This commit is contained in:
Pavel Odintsov 2015-06-04 14:08:25 +03:00
parent dcf16db9a5
commit 061661b5d7
3 changed files with 32 additions and 14 deletions

@ -32,6 +32,9 @@ if (FASTNETMON_PROFILER)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${FASTNETMON_PROFILE_FLAGS}")
endif()
set(FASTNETMON_APPLICATION_VERSION "1.1.3 master")
configure_file(fast_platform.h.template "${PROJECT_SOURCE_DIR}/fast_platform.h")
# With this flag we can diable PF_RING build via console: cmake .. -DDISABLE_PF_RING_SUPPORT=ON
if (NOT DISABLE_PF_RING_SUPPORT)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")

@ -0,0 +1,24 @@
#ifndef FAST_PLATFORM_H
#define FAST_PLATFORM_H
// This file automatically generated for your platform (Linux, FreeBSD and others) with cmake
/* Platform specific paths */
std::string fastnetmon_version = "${FASTNETMON_APPLICATION_VERSION}";
std::string pid_path = "/var/run/fastnetmon.pid";
std::string global_config_path = "/etc/fastnetmon.conf";
std::string log_file_path = "/var/log/fastnetmon.log";
std::string attack_details_folder = "/var/log/fastnetmon_attacks";
// Default path to file with networks for whitelising
std::string white_list_path = "/etc/networks_whitelist";
// Default path to file with all networks listing
std::string networks_list_path = "/etc/networks_list";
/* Platform specific paths end */
#endif

@ -25,6 +25,9 @@
#include "fastnetmon_types.h"
#include "fast_library.h"
// Here we store variables which differs for different paltforms
#include "fast_platform.h"
// Plugins
#include "sflow_plugin/sflow_collector.h"
#include "netflow_plugin/netflow_collector.h"
@ -62,6 +65,7 @@
#include "log4cpp/PatternLayout.hh"
#include "log4cpp/Priority.hh"
// Boost libs
#include <boost/algorithm/string.hpp>
@ -73,9 +77,6 @@
#include <hiredis/hiredis.h>
#endif
std::string pid_path = "/var/run/fastnetmon.pid";
std::string global_config_path = "/etc/fastnetmon.conf";
time_t last_call_of_traffic_recalculation;
// Variable with all data from main screen
@ -93,8 +94,6 @@ std::string redis_host = "127.0.0.1";
bool redis_enabled = false;
#endif
std::string fastnetmon_version = "1.1.3 master";
bool monitor_local_ip_addresses = true;
// This flag could enable print of ban actions and thresholds on the client's screen
@ -163,12 +162,6 @@ std::string sort_parameter = "packets";
// Path to notify script
std::string notify_script_path = "/usr/local/bin/notify_about_attack.sh";
// Path to file with networks for whitelising
std::string white_list_path = "/etc/networks_whitelist";
// Path to file with all networks listing
std::string networks_list_path = "/etc/networks_list";
// Number of lines in programm output
unsigned int max_ips_in_list = 7;
@ -187,8 +180,6 @@ unsigned int ban_details_records_count = 500;
// log file
log4cpp::Category& logger = log4cpp::Category::getRoot();
std::string log_file_path = "/var/log/fastnetmon.log";
std::string attack_details_folder = "/var/log/fastnetmon_attacks";
/* Configuration block ends */
@ -1013,7 +1004,7 @@ bool load_our_networks_list() {
if (file_exists(networks_list_path)) {
std::vector<std::string> network_list_from_config =
read_file_to_vector("/etc/networks_list");
read_file_to_vector(networks_list_path);
networks_list_as_string.insert(networks_list_as_string.end(), network_list_from_config.begin(),
network_list_from_config.end());