/* The software in this package is distributed under the GNU General Public License version 2 (with a special exception described below). A copy of GNU General Public License (GPL) is included in this distribution, in the file COPYING.GPL. As a special exception, if other files instantiate templates or use macros or inline functions from this file, or you compile this file and link it with other works to produce a work based on this file, this file does not by itself cause the resulting work to be covered by the GNU General Public License. However the source code for this file must still be made available in accordance with section (3) of the GNU General Public License. This exception does not invalidate any other reasons why a work based on this file might be covered by the GNU General Public License. */ #ifndef PINGER_H #define PINGER_H #include #include #include #include #include #include #include #include #include "host/pingstatus.h" //----------------------------------------------------------------------------- // IoServiceItem //----------------------------------------------------------------------------- typedef boost::shared_ptr IoServiceItem; //----------------------------------------------------------------------------- // Pinger //----------------------------------------------------------------------------- /** * @brief Abstract class for pingers. * Scope: one object per host. * * Holds a weak_ptr to itself, so can create shared_ptrs from self * (adapted from amime project) */ class Pinger : boost::noncopyable { public: typedef boost::weak_ptr WeakPtr; virtual void ping( const boost::asio::ip::address &ip, const uint16_t destination_port, boost::function ping_done_callback ) = 0; virtual void stop_pinging() = 0; protected: Pinger(); virtual ~Pinger(); Pinger::WeakPtr get_myself() const; virtual void set_myself(const Pinger::WeakPtr &myself); private: Pinger::WeakPtr Myself; }; //----------------------------------------------------------------------------- // PingerItem //----------------------------------------------------------------------------- typedef boost::shared_ptr PingerItem; #endif // PINGER_H