#include <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
#include <boost/serialization/serialization.hpp>
-#include <boost/serialization/export.hpp>
#include "command_server.hxx"
#include "container.hxx"
+#include "log.hxx"
using namespace std;
/// handle a command including deserialization and answering
void command_server::handle_packet(const std::string& packet, server_connection* conn)
{
+ OBJLOGSTREAM(s,debug,"handling packet from connection " << conn->get_id());
+
// deserialize packet
istringstream ifs(packet);
boost::archive::binary_iarchive ia(ifs);
// TODO: catch
ia >> ccont;
+ std::ostream* ostr;
+ if ((ostr=s.get_logstream(fulldebug))!=NULL)
+ {
+ (*ostr) << "decoded packet data: " << std::endl;
+ boost::archive::xml_oarchive xo(*ostr);
+ xo << BOOST_SERIALIZATION_NVP(ccont);
+ }
+
// TODO: cast to command subclass (template)
command *cmd=ccont.get_command();
// TODO: catch
oa << res;
+ if ((ostr=s.get_logstream(fulldebug))!=NULL)
+ {
+ (*ostr) << "returning result, decoded data: " << std::endl;
+ boost::archive::xml_oarchive xo(*ostr);
+ xo << BOOST_SERIALIZATION_NVP(res);
+ }
+
conn->write(ofs.str());
}