/** * \file hop.h * \Author Andrea Barberio * \date October 2015 * \brief Definition of the Hop class * * This file contains the definition of the Hop class, which represent every * single hop in a traceroute. A Hop includes the sent packet, the matching * received packet (if any), NAT information and last-hop information. * * This module currently offers the set-up of the logging facilities. * * \sa hop.cc */ #ifndef _HOP_H #define _HOP_H #include #include #include #include using namespace Tins; class Hop { private: std::shared_ptr sent_; std::shared_ptr received_; std::shared_ptr sent_timestamp_; std::shared_ptr received_timestamp_; std::string name_ = ""; bool last_hop_; public: Hop(): last_hop_(false) { } std::shared_ptr sent() { return sent_; } std::shared_ptr received() { return received_; } std::string name() { if (name_.empty()) name_ = resolve(); return name_; } std::shared_ptr received_timestamp() { return received_timestamp_; } std::shared_ptr sent_timestamp() { return sent_timestamp_; } std::string resolve(); uint16_t nat_id(); const bool zerottl_forwarding_bug(); void sent(IP &packet); void received(IP &packet, const Tins::Timestamp ×tamp); void name(std::string &name); void sent_timestamp(const Tins::Timestamp ×tamp); const bool is_last_hop() const { return last_hop_; } void is_last_hop(bool is_last) { last_hop_ = is_last; } unsigned int rtt(); const uint16_t flowhash(); operator bool() const { return (bool)received_; } Json::Value to_json(); std::string summary(); }; #endif /* _HOP_H */