X-Git-Url: https://git.llucax.com/z.facultad/75.74/practicos.git/blobdiff_plain/093ef819f410add240cf97b72f9e7dcab5abd16c..26fc1173c5122fd73d1cd2191e20d49fef1e1f32:/practicas/pipi/src/ipout.cpp diff --git a/practicas/pipi/src/ipout.cpp b/practicas/pipi/src/ipout.cpp index cf5c28c..6e0c807 100644 --- a/practicas/pipi/src/ipout.cpp +++ b/practicas/pipi/src/ipout.cpp @@ -7,6 +7,9 @@ #include #include #include +#ifdef DEBUG +#include +#endif /// Constructor IPOut::IPOut(const IPAddr& ip, RouteTable& rtable, Dev& forward_que, std::ostream& log): @@ -35,7 +38,7 @@ bool IPOut::send(const std::string& data, uint8_t proto, IPAddr dst, IPAddr src, std::string buf = forward_que.receive(); IPHeader iph(buf); #ifdef DEBUG - log << "IPOut::send: A forwardear => IPHeader: " << iph << "\n"; + std::cout << "IPOut::send: A forwardear\n"; #endif send(iph, buf.substr(iph.header_len())); } @@ -82,8 +85,9 @@ bool IPOut::send(IPHeader iph, std::string data) throw (std::runtime_error) std::string buf((char*) &iph2, sizeof(IPHeader)); buf += data.substr(i * max_payload, max_payload); #ifdef DEBUG - log << "IPOut::send: Fragmento 0 => IPHeader: " << iph2 << "\n"; - log << "\tbuf (" << buf.size() << ") = " << buf << "\n"; + std::cout << "IPOut::send: Fragmento 0 => IPHeader: " << iph2 << "\n"; + std::string tmp = data.substr(i * max_payload, max_payload); + std::cout << "\tdata (" << tmp.size() << ") = " << tmp << "\n"; #endif r->iface->transmit(buf, r->gateway ? r->gateway : IPAddr(iph.dst)); }