*/
PingerItem PingerFactory::createPinger(
const PingProtocol protocol,
- const shared_ptr<io_service> io_serv,
+ io_service &io_serv,
const string &network_interface
)
{
*/
PingRotateItem PingerFactory::createPinger(
const PingProtocolList &protocol_list,
- const shared_ptr<io_service> io_serv,
+ io_service &io_serv,
const string &network_interface,
const string &destination_address,
const uint16_t destination_port,
public:
static PingerItem createPinger(
const PingProtocol protocol,
- const boost::shared_ptr<boost::asio::io_service> io_serv,
+ boost::asio::io_service &io_serv,
const std::string &network_interface
);
static PingRotateItem createPinger(
const PingProtocolList &protocol_list,
- const boost::shared_ptr<boost::asio::io_service> io_serv,
+ boost::asio::io_service &io_serv,
const std::string &network_interface,
const std::string &destination_address,
const uint16_t destination_port,
* host. The protocols will be used in the order they are in the list.
*/
PingRotate::PingRotate(
- const shared_ptr<io_service> io_serv,
+ io_service &io_serv,
const string &network_interface,
const string &destination_address,
const uint16_t destination_port,
{
public:
PingRotate(
- const boost::shared_ptr<boost::asio::io_service> io_serv,
+ boost::asio::io_service &io_serv,
const std::string &network_interface,
const std::string &destination_address,
const uint16_t destination_port,
//
/// The IO service object, which has the loop event
- boost::shared_ptr<boost::asio::io_service> IoService;
+ boost::asio::io_service &IoService;
/// The network interface name
std::string NetworkInterfaceName;
/// The list of IPs which are aliases to the host DNS
BOOST_ASSERT( (0 <= ping_fail_percentage_limit) && (ping_fail_percentage_limit <= 100) );
BOOST_ASSERT( !nameserver.empty() );
- shared_ptr<io_service> io_serv( &IoService );
-
Ping = PingerFactory::createPinger(
ping_protocol_list,
- io_serv,
+ IoService,
network_interface,
destination_address,
destination_port,
* @param echo_reply_timeout_in_sec The amount of time to wait for a reply.
*/
IcmpPinger::IcmpPinger(
- const shared_ptr<io_service> io_serv,
+ io_service &io_serv,
const icmp::socket::protocol_type &protocol,
const string &source_network_interface,
const int echo_reply_timeout_in_sec
IoService( io_serv ),
DestinationEndpoint(),
Protocol( protocol ),
- Socket( *IoService, Protocol ),
+ Socket( IoService, Protocol ),
NetInterface( source_network_interface, Socket ),
- IcmpPacketReceiveTimer( *IoService ),
+ IcmpPacketReceiveTimer( IoService ),
Identifier( 0 ),
SequenceNumber( 0 ),
TimeSent( microsec_clock::universal_time() ),
#include <boost/asio.hpp>
#include <boost/function.hpp>
-#include <boost/shared_ptr.hpp>
#include "host/networkinterface.hpp"
#include "host/pinger.h"
{
public:
IcmpPinger(
- const boost::shared_ptr<boost::asio::io_service> io_serv,
+ boost::asio::io_service &io_serv,
const boost::asio::ip::icmp::socket::protocol_type &protocol,
const std::string &source_network_interface,
const int echo_reply_timeout_in_sec
private:
/// The IO service object, which has the loop event
- boost::shared_ptr<boost::asio::io_service> IoService;
+ boost::asio::io_service &IoService;
/// The destination host
boost::asio::ip::icmp::endpoint DestinationEndpoint;
/// Network layer protocol used to ping, IPv4 or IPv6
* @param echo_reply_timeout_in_sec The amount of time to wait for a reply.
*/
TcpPinger::TcpPinger(
- const shared_ptr<io_service> io_serv,
+ io_service &io_serv,
const tcp_raw_protocol::socket::protocol_type &protocol,
const string &source_network_interface_name,
const int rst_reply_timeout_in_sec
IoService( io_serv ),
DestinationEndpoint(),
Protocol( protocol ),
- Socket( *IoService, Protocol ),
+ Socket( IoService, Protocol ),
NetInterface( source_network_interface_name, Socket ),
- TcpSegmentReceiveTimer( *IoService ),
+ TcpSegmentReceiveTimer( IoService ),
Identifier( 0 ),
SequenceNumber( 0 ),
TimeSent( microsec_clock::universal_time() ),
#include <boost/asio.hpp>
#include <boost/asio/ip/tcp_raw_protocol.hpp>
#include <boost/function.hpp>
-#include <boost/shared_ptr.hpp>
#include "host/networkinterface.hpp"
#include "host/pinger.h"
{
public:
TcpPinger(
- const boost::shared_ptr<boost::asio::io_service> io_serv,
+ boost::asio::io_service &io_serv,
const boost::asio::ip::tcp_raw_protocol::socket::protocol_type &protocol,
const std::string &source_network_interface_name,
const int rst_reply_timeout_in_sec
private:
/// IO service object, which has the loop event
- boost::shared_ptr<boost::asio::io_service> IoService;
+ boost::asio::io_service &IoService;
/// The destination host
boost::asio::ip::tcp_raw_protocol::endpoint DestinationEndpoint;
/// Network layer protocol used to ping, IPv4 or IPv6