Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef PINGPROCESS_H
- #define PINGPROCESS_H
- #include <string>
- #include <boost/asio.hpp>
- #include <boost/bind.hpp>
- #include <boost/asio/time_traits.hpp>
- #include <boost/date_time/posix_time/posix_time.hpp>
- #include <boost/asio/signal_set.hpp>
- #include <Logging_Controller.h>
- #include "Icmp_header.hpp"
- #include "Ipv4_header.hpp"
- class Ping;
- class PingProcess : public boost::noncopyable
- {
- friend Ping;
- public:
- const int timeout_to_fail = 5,
- timeout_to_send_request = 60,
- timeout_to_read_reply = 5;
- private:
- Ping *parent;
- boost::asio::ip::icmp::endpoint m_destination;
- unsigned short m_sequence_number;
- boost::asio::ip::icmp::resolver *m_resolver;
- boost::posix_time::ptime m_time_sent;
- boost::asio::deadline_timer *m_timer;
- boost::asio::streambuf *m_reply_buffer;
- std::size_t m_num_replies;
- boost::asio::ip::icmp::socket *m_socket;
- bool m_camera_availability;
- void HandleTimeout();
- void HandleReceive ( std::size_t length );
- std::string UUID;
- int m_ping_process_id;
- int m_num_timeout;
- void StartSend();
- void StartReceive();
- bool Init();
- bool Query ( std::string destination );
- public:
- PingProcess ( Ping *parent );
- ~PingProcess();
- /*
- PingProcess& operator=(const PingProcess& other);
- PingProcess(const PingProcess& other);
- bool operator==(const PingProcess& other) const;*/
- //short unsigned int GetIdentidier();
- /**
- * Установить ID для камеры или объекта
- * @param uuid - идентификатор камеры
- */
- void SetUUID ( std::string uuid );
- /**
- * Пометить камеру как недоступную
- * @param uuid - идентификатор камеры
- */
- void SetCameraUnavailable ( std::string uuid );
- /**
- * Пометить камеру как доступную
- * @param uuid - идентификатор камеры
- */
- void SetCameraAvailable ( std::string uuid );
- /**
- * Идентификатор процесса пингера. Нужен, чтобы отличать пришедшие пакеты между процессами.
- * @param ID - уникальное число
- */
- void SetPingProcessID ( int ID );
- };
- #endif // PINGPROCESS_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement