Examples/IcmpFileTransfer/Common.cpp
/**
 * Go over all interfaces and output their names
 */
Go over all interfaces and output their names
Go over all interfaces and output their names
void listInterfaces()
{
	const std::vector<pcpp::PcapLiveDevice*>& devList = pcpp::PcapLiveDeviceList::getInstance().getPcapLiveDevicesList();
	std::cout << std::endl << "Network interfaces:" << std::endl;
	for (std::vector<pcpp::PcapLiveDevice*>::const_iterator iter = devList.begin(); iter != devList.end(); iter++)
	{
		std::cout << "    -> Name: '" << (*iter)->getName() << "'   IP address: " << (*iter)->getIPv4Address().toString() << std::endl;
	}
	exit(0);
}
void listInterfaces ( ) { const std :: vector < pcpp :: PcapLiveDevice * > & devList = pcpp :: PcapLiveDeviceList :: getInstance ( ) . getPcapLiveDevicesList ( ) ; std :: cout << std :: endl << " " << std :: endl ; for ( std :: vector < pcpp :: PcapLiveDevice * > :: const_iterator iter = devList . begin ( ) ; iter != devList . end ( ) ; iter ++ ) { std :: cout << " " << ( * iter ) -> getName ( ) << " " << ( * iter ) -> getIPv4Address ( ) . toString ( ) << std :: endl ; } exit ( 0 ) ; }
Go over all interfaces and output their names
Go over all interfaces and output their names