Switched to use only .hpp extension for header files as standard for this repo

This commit is contained in:
Pavel Odintsov 2022-06-26 15:10:12 +01:00
parent ae5336f508
commit 6833220676
52 changed files with 98 additions and 96 deletions

View File

@ -125,7 +125,7 @@ add_executable(fastnetmon fastnetmon.cpp)
execute_process(COMMAND git rev-list HEAD COMMAND head -n 1 OUTPUT_VARIABLE GIT_LAST_COMMIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE)
set(FASTNETMON_APPLICATION_VERSION "${FASTNETMON_VERSION_MAJOR}.${FASTNETMON_VERSION_MINOR}.${FASTNETMON_VERSION_PATCH} master git-${GIT_LAST_COMMIT_HASH}")
configure_file(fast_platform.h.template "${PROJECT_SOURCE_DIR}/fast_platform.h")
configure_file(fast_platform.h.template "${PROJECT_SOURCE_DIR}/fast_platform.hpp")
# Use new Memory Model Aware Atomic Operations
# You could enable it using: cmake .. -DUSE_NEW_ATOMIC_BUILTINS=ON

View File

@ -2,9 +2,9 @@
#include <string>
#include "../fast_library.h"
#include "../fast_library.hpp"
#include "../all_logcpp_libraries.h"
#include "../all_logcpp_libraries.hpp"
extern bool exabgp_enabled;
extern std::string exabgp_community;

View File

@ -1,4 +1,4 @@
#include "../fastnetmon_types.h"
#include "../fastnetmon_types.hpp"
#include <string>
void exabgp_ban_manage(std::string action, std::string ip_as_string, attack_details_t current_attack);

View File

@ -1,6 +1,6 @@
#include "gobgp_action.h"
#include "../fastnetmon_actions.h"
#include "../fastnetmon_types.h"
#include "gobgp_action.hpp"
#include "../fastnetmon_actions.hpp"
#include "../fastnetmon_types.hpp"
#ifdef __GNUC__
#pragma GCC diagnostic push

View File

@ -1,7 +1,7 @@
#ifndef GOBGP_ACTION_H
#define GOBGP_ACTION_H
#include "../fastnetmon_types.h"
#include "../fastnetmon_types.hpp"
#include <string>
void gobgp_action_init();

View File

@ -1,9 +1,9 @@
#include "../all_logcpp_libraries.h"
#include "../all_logcpp_libraries.hpp"
#include <boost/algorithm/string.hpp>
#include <boost/version.hpp>
#include "../fast_library.h"
#include "../fast_library.hpp"
// For support uint32_t, uint16_t
#include <sys/types.h>
@ -16,14 +16,14 @@
#include <stdio.h>
#include <string>
#include "../fastnetmon_packet_parser.h"
#include "../fastnetmon_packet_parser.hpp"
// For support: IPPROTO_TCP, IPPROTO_ICMP, IPPROTO_UDP
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>
#include "afpacket_collector.h"
#include "afpacket_collector.hpp"
#include <arpa/inet.h>
#include <boost/thread.hpp>

View File

@ -1,7 +1,7 @@
#ifndef AFPACKET_PLUGIN_H
#define AFPACKET_PLUGIN_H
#include "../fastnetmon_types.h"
#include "../fastnetmon_types.hpp"
void start_afpacket_collection(process_packet_pointer func_ptr);
void start_af_packet_capture_for_interface(std::string capture_interface, int fanout_group_id, unsigned int num_cpus);

View File

@ -9,7 +9,7 @@
#include "log4cpp/PatternLayout.hh"
#include "log4cpp/Priority.hh"
#include "all_logcpp_libraries.h"
#include "all_logcpp_libraries.hpp"
// Get log4cpp logger from main programme
extern log4cpp::Category& logger;

View File

@ -4,8 +4,8 @@
#include <string>
#include <vector>
#include "fast_library.h"
#include "fastnetmon_types.h"
#include "fast_library.hpp"
#include "fastnetmon_types.hpp"
// Helper for serialization by comma
template <typename T> std::string serialize_vector_by_string(const std::vector<T> vect, std::string delimiter) {

View File

@ -1,4 +1,4 @@
#include "../all_logcpp_libraries.h"
#include "../all_logcpp_libraries.hpp"
// For support uint32_t, uint16_t
#include <sys/types.h>
@ -12,7 +12,7 @@
#include <sys/socket.h>
#include <sys/types.h>
#include "example_collector.h"
#include "example_collector.hpp"
// Get log4cpp logger from main program
extern log4cpp::Category& logger;

View File

@ -1,7 +1,7 @@
#ifndef EXAMPLE_PLUGIN_H
#define EXAMPLE_PLUGIN_H
#include "../fastnetmon_types.h"
#include "../fastnetmon_types.hpp"
// This function should be implemented in plugin
void start_example_collection(process_packet_pointer func_ptr);

View File

@ -1,4 +1,4 @@
#include "fast_library.h"
#include "fast_library.hpp"
#include <arpa/inet.h>
#include <fstream>
#include <iostream>
@ -13,7 +13,7 @@
#include <sys/types.h>
#include <unistd.h>
#include "all_logcpp_libraries.h"
#include "all_logcpp_libraries.hpp"
#include <boost/asio.hpp>

View File

@ -1,12 +1,13 @@
#pragma once
#include "fastnetmon_types.h"
#include "fastnetmon_types.hpp"
#include <iostream>
#include <map>
#include <sstream>
#include <stdint.h>
#include <string>
#include <sys/types.h>
#include <unistd.h>
#include <utility>

View File

@ -24,14 +24,14 @@
#include <sys/stat.h>
#include "bgp_protocol.hpp"
#include "fast_library.h"
#include "fastnetmon_packet_parser.h"
#include "fastnetmon_types.h"
#include "fast_library.hpp"
#include "fastnetmon_packet_parser.hpp"
#include "fastnetmon_types.hpp"
#include "libpatricia/patricia.hpp"
#include "packet_storage.h"
#include "packet_storage.hpp"
// Here we store variables which differs for different paltforms
#include "fast_platform.h"
#include "fast_platform.hpp"
#include "fastnetmon_logic.hpp"
@ -54,24 +54,24 @@
#endif
// Plugins
#include "netflow_plugin/netflow_collector.h"
#include "pcap_plugin/pcap_collector.h"
#include "sflow_plugin/sflow_collector.h"
#include "netflow_plugin/netflow_collector.hpp"
#include "pcap_plugin/pcap_collector.hpp"
#include "sflow_plugin/sflow_collector.hpp"
#ifdef NETMAP_PLUGIN
#include "netmap_plugin/netmap_collector.h"
#include "netmap_plugin/netmap_collector.hpp"
#endif
#ifdef FASTNETMON_ENABLE_AFPACKET
#include "afpacket_plugin/afpacket_collector.h"
#include "afpacket_plugin/afpacket_collector.hpp"
#endif
#ifdef ENABLE_GOBGP
#include "actions/gobgp_action.h"
#include "actions/gobgp_action.hpp"
#endif
// Yes, maybe it's not an good idea but with this we can guarantee working code in example plugin
#include "example_plugin/example_collector.h"
#include "example_plugin/example_collector.hpp"
#include <algorithm>
#include <fstream>
@ -88,7 +88,7 @@
#include <boost/program_options.hpp>
#include "all_logcpp_libraries.h"
#include "all_logcpp_libraries.hpp"
// Boost libs
#include <boost/algorithm/string.hpp>
@ -102,7 +102,7 @@
#include <hiredis/hiredis.h>
#endif
#include "packet_bucket.h"
#include "packet_bucket.hpp"
#include "ban_list.hpp"

View File

@ -1,6 +1,6 @@
#include "all_logcpp_libraries.h"
#include "all_logcpp_libraries.hpp"
#include "fast_library.h"
#include "fast_library.hpp"
// Get log4cpp logger from main program
extern log4cpp::Category& logger;

View File

@ -5,33 +5,33 @@
#include <sstream>
#include <vector>
#include "all_logcpp_libraries.h"
#include "all_logcpp_libraries.hpp"
#include "bgp_protocol.hpp"
#include "fast_library.h"
#include "fast_platform.h"
#include "fastnetmon_packet_parser.h"
#include "fast_library.hpp"
#include "fast_platform.hpp"
#include "fastnetmon_packet_parser.hpp"
// Plugins
#include "netflow_plugin/netflow_collector.h"
#include "pcap_plugin/pcap_collector.h"
#include "sflow_plugin/sflow_collector.h"
#include "netflow_plugin/netflow_collector.hpp"
#include "pcap_plugin/pcap_collector.hpp"
#include "sflow_plugin/sflow_collector.hpp"
#ifdef NETMAP_PLUGIN
#include "netmap_plugin/netmap_collector.h"
#include "netmap_plugin/netmap_collector.hpp"
#endif
#ifdef FASTNETMON_ENABLE_AFPACKET
#include "afpacket_plugin/afpacket_collector.h"
#include "afpacket_plugin/afpacket_collector.hpp"
#endif
#ifdef ENABLE_GOBGP
#include "actions/gobgp_action.h"
#include "actions/gobgp_action.hpp"
#endif
#include "actions/exabgp_action.hpp"
// Yes, maybe it's not an good idea but with this we can guarantee working code in example plugin
#include "example_plugin/example_collector.h"
#include "example_plugin/example_collector.hpp"
#ifdef MONGO
#include <bson.h>
@ -42,7 +42,7 @@
#include "abstract_subnet_counters.hpp"
#include "packet_bucket.h"
#include "packet_bucket.hpp"
#include "ban_list.hpp"

View File

@ -1,12 +1,12 @@
#include "bgp_protocol.hpp"
#include "fastnetmon_types.h"
#include "fastnetmon_types.hpp"
#ifdef REDIS
#include <hiredis/hiredis.h>
#endif
#include "all_logcpp_libraries.h"
#include "packet_bucket.h"
#include "all_logcpp_libraries.hpp"
#include "packet_bucket.hpp"
#include "fastnetmon.grpc.pb.h"
#include <grpc++/grpc++.h>

View File

@ -1,4 +1,4 @@
#include "fastnetmon_packet_parser.h"
#include "fastnetmon_packet_parser.hpp"
/* This code is copy & paste from PF_RING user space library licensed under LGPL terms */

View File

@ -1,4 +1,4 @@
#include "fastnetmon_pcap_format.h"
#include "fastnetmon_pcap_format.hpp"
#include <errno.h>
#include <string.h>

View File

@ -4,16 +4,16 @@
#include <netinet/in.h> // struct in6_addr
#include <stdint.h> // uint32_t
#include <sys/time.h> // struct timeval
#include <utility> // std::pair
#include <utility> // std::pair
#include <map>
#include <string>
#include <unordered_map>
#include <vector>
#include "packet_storage.h"
#include "packet_storage.hpp"
#include "fastnetmon_simple_packet.h"
#include "fastnetmon_simple_packet.hpp"
#include "map_element.hpp"

View File

@ -1,5 +1,5 @@
#pragma once
#include "fastnetmon_pcap_format.h"
#include "fastnetmon_pcap_format.hpp"
// We are using this class for storing packet meta information with their payload into fixed size memory region
class fixed_size_packet_storage_t {

View File

@ -1,4 +1,4 @@
#include "ipfix_rfc.h"
#include "ipfix_rfc.hpp"
#include <iostream>
#include <map>

View File

@ -1,4 +1,4 @@
#include "libsflow.h"
#include "libsflow.hpp"
#include <sstream>

View File

@ -1,12 +1,12 @@
#include "graphite.hpp"
#include "../fast_library.h"
#include "../fastnetmon_types.h"
#include "../fast_library.hpp"
#include "../fastnetmon_types.hpp"
#include <vector>
#include "../all_logcpp_libraries.h"
#include "../all_logcpp_libraries.hpp"
extern log4cpp::Category& logger;
extern struct timeval graphite_thread_execution_time;

View File

@ -1,10 +1,10 @@
#include "influxdb.hpp"
#include "../abstract_subnet_counters.hpp"
#include "../fast_library.h"
#include "../fastnetmon_types.h"
#include "../fast_library.hpp"
#include "../fastnetmon_types.hpp"
#include "../all_logcpp_libraries.h"
#include "../all_logcpp_libraries.hpp"
#include <vector>

View File

@ -3,7 +3,7 @@
#include <string>
#include <vector>
#include "../fastnetmon_types.h"
#include "../fastnetmon_types.hpp"
bool push_system_counters_to_influxdb(std::string influx_database,
std::string influx_host,

View File

@ -1,6 +1,6 @@
#include "netflow.hpp"
#include "../ipfix_rfc.h"
#include "../ipfix_rfc.hpp"
#include <vector>
extern ipfix_information_database ipfix_db_instance;

View File

@ -13,13 +13,13 @@
#include <mutex>
#include <vector>
#include "../fast_library.h"
#include "../ipfix_rfc.h"
#include "../fast_library.hpp"
#include "../ipfix_rfc.hpp"
#include "../all_logcpp_libraries.h"
#include "../all_logcpp_libraries.hpp"
#include "netflow.hpp"
#include "netflow_collector.h"
#include "netflow_collector.hpp"
#include <boost/serialization/map.hpp>
#include <boost/serialization/vector.hpp>
@ -28,7 +28,7 @@
#include <boost/archive/xml_oarchive.hpp>
// For Netflow lite parsing
#include "../simple_packet_parser_ng.h"
#include "../simple_packet_parser_ng.hpp"
// Get it from main programme
extern log4cpp::Category& logger;

View File

@ -1,7 +1,7 @@
#pragma once
/* netflow plugin header */
#include "../fastnetmon_types.h"
#include "../fastnetmon_types.hpp"
// For testing
bool process_netflow_packet(uint8_t* packet, uint32_t len, std::string& client_addres_in_string_format, uint32_t client_ipv4_address);

View File

@ -7,8 +7,8 @@
#include <map>
#include <sstream>
#include "iana_ethertypes.h"
#include "iana_ip_protocols.h"
#include "iana_ethertypes.hpp"
#include "iana_ip_protocols.hpp"
/*

View File

@ -1,10 +1,11 @@
#pragma once
#include "fastnetmon_pcap_format.h"
#include "fastnetmon_pcap_format.hpp"
#include <stdlib.h>
#include <string.h>
#include "fastnetmon_types.h"
#include "fastnetmon_types.hpp"
#include "fixed_size_packet_storage.hpp"
// This is dynamically allocated packet storage

View File

@ -17,9 +17,9 @@
#include <netinet/udp.h>
#include <pcap.h>
#include "../all_logcpp_libraries.h"
#include "../all_logcpp_libraries.hpp"
#include "pcap_collector.h"
#include "pcap_collector.hpp"
// Standard shift for type DLT_EN10MB, Ethernet
unsigned int DATA_SHIFT_VALUE = 14;

View File

@ -1,7 +1,7 @@
#ifndef PCAP_PLUGIN_H
#define PCAP_PLUGIN_H
#include "../fastnetmon_types.h"
#include "../fastnetmon_types.hpp"
#include <iostream>
void start_pcap_collection(process_packet_pointer func_ptr);

View File

@ -5,8 +5,8 @@
#include <sys/types.h>
#include <type_traits>
#include "../libsflow/libsflow.h"
#include "sflow_collector.h"
#include "../libsflow/libsflow.hpp"
#include "sflow_collector.hpp"
#include <arpa/inet.h>
#include <netinet/in.h>
@ -19,13 +19,13 @@
#include <string.h>
#include <sys/socket.h>
#include "../fast_library.h"
#include "../fast_library.hpp"
#include "../all_logcpp_libraries.h"
#include "../all_logcpp_libraries.hpp"
extern log4cpp::Category& logger;
#include "../simple_packet_parser_ng.h"
#include "../simple_packet_parser_ng.hpp"
// Global configuration map
extern std::map<std::string, std::string> configuration_map;

View File

@ -1,6 +1,6 @@
#pragma once
#include "../fastnetmon_types.h"
#include "../fastnetmon_types.hpp"
#include <stdint.h>
void start_sflow_collection(process_packet_pointer func_ptr);

View File

@ -1,5 +1,5 @@
#include "simple_packet_parser_ng.h"
#include "all_logcpp_libraries.h"
#include "simple_packet_parser_ng.hpp"
#include "all_logcpp_libraries.hpp"
#include "network_data_structures.hpp"
#include <cstring>

View File

@ -1,4 +1,4 @@
#include "fastnetmon_simple_packet.h"
#include "fastnetmon_simple_packet.hpp"
#include "network_data_structures.hpp"
network_data_stuctures::parser_code_t parse_raw_packet_to_simple_packet_full_ng(uint8_t* pointer,

View File

@ -18,7 +18,7 @@
#include <boost/pool/pool_alloc.hpp>
#include <boost/pool/singleton_pool.hpp>
#include "../fastnetmon_types.h"
#include "../fastnetmon_types.hpp"
#ifdef TEST_TBB_LIBRARY
@ -31,7 +31,7 @@
#include <sys/ipc.h>
#include <sys/shm.h>
#include "../all_logcpp_libraries.h"
#include "../all_logcpp_libraries.hpp"
// #define ABSEIL
@ -46,7 +46,7 @@
#include <sparsehash/dense_hash_map>
#endif
#include "../fast_library.h"
#include "../fast_library.hpp"
log4cpp::Category& logger = log4cpp::Category::getRoot();

View File

@ -1,6 +1,6 @@
#include "unified_parser.hpp"
#include "fastnetmon_packet_parser.h"
#include "fastnetmon_packet_parser.hpp"
bool parse_raw_packet_to_simple_packet(u_char* buffer, int len, simple_packet_t& packet, bool read_packet_length_from_ip_header) {

View File

@ -1,6 +1,6 @@
#pragma once
#include "fastnetmon_types.h"
#include "fastnetmon_types.hpp"
#include <stdint.h>
#include <sys/types.h>