#include <boost/scoped_array.hpp>
#include <logfunc.hpp>
+#include <filefunc.hxx>
#include <tmpfstream.hpp>
#include "boost_assert_handler.h"
//-----------------------------------------------------------------------------
// set default value
-DumpMode IcmpPacketFactory::PacketDumpMode = DUMP_IF_ERROR;
-std::string IcmpPacketFactory::DumpFilePrefix = "/tmp/icmp_";
+DumpMode IcmpPacketFactory::PacketDumpMode = DUMP_ALWAYS; //DUMP_IF_ERROR;
+std::string IcmpPacketFactory::DumpFilePrefix =
+ "/datastore/pingcheck.broken/icmp_";
/**
* @brief Creates an ICMP packet from the input stream @c std::istream.
std::stringstream temp_name;
temp_name << DumpFilePrefix << capture_time << ".pcap.XXXXXX";
+ // check if directory exists
+ if ( !I2n::path_exists( I2n::dirname(temp_name.str()) ) )
+ {
+ GlobalLogger.debug() << "Not saving packet data because directory "
+ << I2n::dirname(temp_name.str()) << " does not exist";
+ return;
+ }
+
// open file
I2n::tmpfstream temp_stream;
if ( !temp_stream.open(temp_name.str()) )
std::stringstream temp_name;
temp_name << DumpFilePrefix << capture_time << ".pcap.XXXXXX";
+ // check if directory exists
+ if ( !I2n::path_exists( I2n::dirname(temp_name.str()) ) )
+ {
+ GlobalLogger.debug() << "Not saving packet data because directory "
+ << I2n::dirname(temp_name.str()) << " does not exist";
+ return;
+ }
+
// open file
I2n::tmpfstream temp_stream;
if ( !temp_stream.open(temp_name.str()) )