* packet will be sent.
* @return a Pinger object to able to ping using the given protocol.
*/
-shared_ptr<Pinger> PingerFactory::createPinger(
+PingerItem PingerFactory::createPinger(
const PingProtocol protocol,
io_service &io_serv,
const string &network_interface
switch ( protocol )
{
case PingProtocol_ICMP:
- return shared_ptr<Pinger>(
+ return PingerItem(
new IcmpPinger( io_serv, icmp::v4(), network_interface, ping_reply_timeout_in_sec )
);
case PingProtocol_ICMPv6:
- return shared_ptr<Pinger>(
+ return PingerItem(
new IcmpPinger( io_serv, icmp::v6(), network_interface, ping_reply_timeout_in_sec )
);
case PingProtocol_TCP:
- return shared_ptr<Pinger>(
+ return PingerItem(
new TcpPinger( io_serv, tcp_raw_protocol::v4(), network_interface, ping_reply_timeout_in_sec )
);
case PingProtocol_TCP_IPv6:
- return shared_ptr<Pinger>(
+ return PingerItem(
new TcpPinger( io_serv, tcp_raw_protocol::v6(), network_interface, ping_reply_timeout_in_sec )
);
default:
BOOST_ASSERT( !"Try to create a pinger from an invalid protocol" ); //lint !e506
- return shared_ptr<Pinger>(); //lint !e527
+ return PingerItem(); //lint !e527
}
}
catch ( const system_error &ex )
exit( EXIT_FAILURE );
}
- return shared_ptr<Pinger>(); //lint !e527
+ return PingerItem(); //lint !e527
}
class PingerFactory
{
public:
- static boost::shared_ptr<Pinger> createPinger(
+ static PingerItem createPinger(
const PingProtocol protocol,
boost::asio::io_service &io_serv,
const std::string &network_interface