* @returns positive error code or negated number of packets created
*/
int read_packets( std::istream &input_stream, const bool is_icmp,
- const bool is_v4,
- const int dump_mode )
+ const bool is_v4)
{
// peek at start of stream to see if there is a pcap header
bool is_pcap = check_for_pcap_header(input_stream);
GlobalLogger.info() << "Trying to read ICMP v4 packet"
<< std::endl;
packet = IcmpPacketFactory::create_icmp_packet(
- boost::asio::ip::icmp::v4(), input_stream, dump_mode);
+ boost::asio::ip::icmp::v4(), input_stream);
}
else // v6
{
GlobalLogger.info() << "Trying to read ICMP v6 packet"
<< std::endl;
packet = IcmpPacketFactory::create_icmp_packet(
- boost::asio::ip::icmp::v6(), input_stream, dump_mode);
+ boost::asio::ip::icmp::v6(), input_stream);
}
if (packet)
int current_return, return_val = 0;
int packet_count_good = 0;
int packet_count_bad = 0;
- int dump_mode = 0; // never dump
+ DumpMode dump_mode = DUMP_NEVER;
if (argc == 1)
{
return 1;
}
+ IcmpPacketFactory::PacketDumpMode = dump_mode;
+
// convert arguments to vector of strings and loop over them
std::vector<std::string> args(argv+1, argv + argc);
BOOST_FOREACH (const std::string &arg, args)
else if (arg == "--") // read input from stdin
{
GlobalLogger.info() << "Trying to read from stdin" << std::endl;
- current_return = read_packets(std::cin, is_icmp, is_v4, dump_mode);
+ current_return = read_packets(std::cin, is_icmp, is_v4);
}
else // assume is file name
{
}
else
{
- current_return = read_packets( file_stream, is_icmp, is_v4,
- dump_mode);
+ current_return = read_packets( file_stream, is_icmp, is_v4);
file_stream.close();
}
}