#include "ipin.h"
#include "ipheader.h"
+#ifdef DEBUG
+#include <iostream>
+#endif
/// Constructor
IPIn::IPIn(const IPAddr& ip, Dev& dev, Dev& forward_que, bool router,
void IPIn::drop(const std::string& msg, const std::string& buf)
{
- log << "IPIn::drop: " << msg << "\n\tBuffer: " << buf << "\n";
+ log << "IPIn::drop (" << ip << "): " << msg << "\n\tBuffer: " << buf
+ << "\n";
}
void IPIn::drop(const std::string& msg, const IPHeader& iph)
{
- log << "IPIn::drop: " << msg << "\n\tIPHeader: " << iph << "\n";
+ log << "IPIn::drop (" << ip << "): " << msg << "\n\tIPHeader: " << iph
+ << "\n";
}
/// Recibe un paquete IP
}
IPHeader iph(buf);
#ifdef DEBUG
- log << "IPIn::recv: IPHeader: " << iph << "\n";
+ std::cout << "IPIn::recv (" << ip << "): IPHeader: " << iph << "\n";
std::string tmp = buf.substr(iph.header_len());
- log << "\tdata (" << tmp.size() << ") = " << tmp << "\n";
+ std::cout << "\tdata (" << tmp.size() << ") = " << tmp << "\n";
#endif
if (iph.version != 4)
{
data += i->second;
}
#ifdef DEBUG
- log << "IPIn::recv: Paquete completo: data = '" << data << "'\n";
+ std::cout << "IPIn::recv (" << ip << "): Paquete completo: data = '"
+ << data << "'\n";
#endif
buffer.erase(iph);
//TODO faltaría limpiar fragmentos viejos cada tanto (timer?)