- avoid hidden dependencies, by including the class header file first.
- keep a inclusion order of C headers, C++ headers, Boost headers and Project headers.
- be relative to the source directory, this keeps clear which package the source file belongs.
# include directories where the source code is located
include_directories(
- config
- dns
- icmp
- ping
+ ${CMAKE_CURRENT_SOURCE_DIR}
${Boost_INCLUDE_DIRS}
)
-#include <boost/assert.hpp>
+#include "config/configuration.h"
-#include "configuration.h"
+#include <boost/assert.hpp>
using namespace std;
#define CONFIGURATION_H
#include <stdint.h>
+
#include <string>
#include <vector>
-#include "host.h"
+#include "config/host.h"
//-----------------------------------------------------------------------------
// Configuration
-#include <boost/assert.hpp>
-#include <boost/foreach.hpp>
+#include "config/configurationreader.h"
+
#include <fstream>
#include <iostream>
-#include "configurationreader.h"
+#include <boost/assert.hpp>
+#include <boost/foreach.hpp>
using namespace std;
using namespace boost;
#define CONFIGURATIONREADER_H
#include <string>
+
#include <boost/program_options.hpp>
-#include "configuration.h"
+#include "config/configuration.h"
//-----------------------------------------------------------------------------
// ConfigurationReader
-#include <boost/assert.hpp>
+#include "config/host.h"
+
#include <limits>
-#include "host.h"
+#include <boost/assert.hpp>
//-----------------------------------------------------------------------------
// Host
#ifndef HOST_H
#define HOST_H
-#include <boost/shared_ptr.hpp>
#include <stdint.h>
+
#include <string>
#include <vector>
+#include <boost/shared_ptr.hpp>
+
//-----------------------------------------------------------------------------
// Host
//-----------------------------------------------------------------------------
-#include <boost/asio.hpp>
+#include "dns/dnsresolver.h"
+
#include <iostream>
-#include "hostaddress.h"
+#include <boost/asio.hpp>
-#include "dnsresolver.h"
+#include "dns/hostaddress.h"
using namespace std;
using namespace boost::asio;
-#include "hostaddress.h"
+#include "dns/hostaddress.h"
using namespace std;
#ifndef HOSTADDRESS_H_
#define HOSTADDRESS_H_
-#include <string>
#include <sys/types.h>
+#include <string>
+
//-----------------------------------------------------------------------------
// HostAddress
//-----------------------------------------------------------------------------
#ifndef ICMPCHECKSUMCALCULATOR_H
#define ICMPCHECKSUMCALCULATOR_H
-#include "checksumcalculator.h"
-#include "icmpdata.h"
+#include "icmp/checksumcalculator.h"
+#include "icmp/icmpdata.h"
//-----------------------------------------------------------------------------
// IcmpChecksumCalculator
-#include "icmpheader.h"
+#include "icmp/icmpheader.h"
//-----------------------------------------------------------------------------
// IcmpHeader
#ifndef ICMP_HEADER_HPP
#define ICMP_HEADER_HPP
+#include <stdint.h>
+
#include <istream>
#include <ostream>
-#include <stdint.h>
//-----------------------------------------------------------------------------
// IcmpHeader
-#include "icmppacket.h"
+#include "icmp/icmppacket.h"
//-----------------------------------------------------------------------------
// IcmpPacket
#ifndef ICMPPACKET_H
#define ICMPPACKET_H
+#include <stdint.h>
+
#include <istream>
#include <ostream>
-#include <stdint.h>
-#include "ipv4header.h"
-#include "icmpheader.h"
-#include "icmpdata.h"
+#include "icmp/ipv4header.h"
+#include "icmp/icmpheader.h"
+#include "icmp/icmpdata.h"
//-----------------------------------------------------------------------------
// IcmpPacket
-#include "ipv4header.h"
+#include "icmp/ipv4header.h"
//-----------------------------------------------------------------------------
// Ipv4Header
#ifndef IPV4_HEADER_HPP
#define IPV4_HEADER_HPP
-#include <algorithm>
-#include <boost/asio/ip/address_v4.hpp>
#include <stdint.h>
+#include <boost/asio/ip/address_v4.hpp>
+
//-----------------------------------------------------------------------------
// Ipv4Header
//-----------------------------------------------------------------------------
#include <boost/foreach.hpp>
#include <vector>
-#include "configurationreader.h"
-#include "host.h"
-#include "pingscheduler.h"
+#include "config/configurationreader.h"
+#include "config/host.h"
+#include "ping/pingscheduler.h"
using namespace std;
using namespace boost::asio;
-#include <boost/bind.hpp>
+#include "ping/boostpinger.h"
+
#include <iostream>
#include <istream>
#include <ostream>
-#include "icmpchecksumcalculator.h"
-#include "icmpdata.h"
-#include "icmpheader.h"
-#include "icmppacket.h"
-#include "ipv4header.h"
+#include <boost/bind.hpp>
-#include "boostpinger.h"
+#include "icmp/icmpchecksumcalculator.h"
+#include "icmp/icmpdata.h"
+#include "icmp/icmpheader.h"
+#include "icmp/icmppacket.h"
+#include "icmp/ipv4header.h"
using namespace std;
using namespace boost::asio;
#define BOOSTPINGER_H
#include <boost/asio.hpp>
-#include "pinger.h"
+
+#include "ping/pinger.h"
class IcmpPacket;
-#include "pinger.h"
+#include "ping/pinger.h"
//-----------------------------------------------------------------------------
// Pinger
-#include <boost/bind.hpp>
+#include "ping/pingscheduler.h"
+
#include <iostream>
-#include "boostpinger.h"
-#include "dnsresolver.h"
+#include <boost/bind.hpp>
-#include "pingscheduler.h"
+#include "dns/dnsresolver.h"
+#include "ping/boostpinger.h"
using namespace std;
using namespace boost;
#ifndef PINGSCHEDULER_H
#define PINGSCHEDULER_H
+#include <string>
+
#include <boost/asio.hpp>
#include <boost/shared_ptr.hpp>
-#include <string>
-#include "dnsresolver.h"
+#include "dns/dnsresolver.h"
//-----------------------------------------------------------------------------
// PingScheduler