From: Leandro Lucarella Date: Tue, 6 Jun 2006 07:02:43 +0000 (+0000) Subject: Mejora salida (agrega IP para saber de que proceso se trata). X-Git-Tag: svn_import~56 X-Git-Url: https://git.llucax.com/z.facultad/75.74/practicos.git/commitdiff_plain/99005a685dba8392d7ef48657854b498686223c3 Mejora salida (agrega IP para saber de que proceso se trata). --- diff --git a/practicas/pipi/src/ipin.cpp b/practicas/pipi/src/ipin.cpp index c191b90..15e102c 100644 --- a/practicas/pipi/src/ipin.cpp +++ b/practicas/pipi/src/ipin.cpp @@ -16,12 +16,14 @@ 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 @@ -38,7 +40,7 @@ std::string IPIn::recv(uint8_t proto, IPAddr& src, IPAddr& dst) throw (std::runt } IPHeader iph(buf); #ifdef DEBUG - std::cout << "IPIn::recv: IPHeader: " << iph << "\n"; + std::cout << "IPIn::recv (" << ip << "): IPHeader: " << iph << "\n"; std::string tmp = buf.substr(iph.header_len()); std::cout << "\tdata (" << tmp.size() << ") = " << tmp << "\n"; #endif @@ -85,7 +87,8 @@ std::string IPIn::recv(uint8_t proto, IPAddr& src, IPAddr& dst) throw (std::runt data += i->second; } #ifdef DEBUG - std::cout << "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?) diff --git a/practicas/pipi/src/ipout.cpp b/practicas/pipi/src/ipout.cpp index 6e0c807..6829d2f 100644 --- a/practicas/pipi/src/ipout.cpp +++ b/practicas/pipi/src/ipout.cpp @@ -19,12 +19,14 @@ IPOut::IPOut(const IPAddr& ip, RouteTable& rtable, Dev& forward_que, std::ostrea void IPOut::drop(const std::string& msg, const std::string& buf) { - log << "IPOut::drop: " << msg << "\n\tBuffer: " << buf << "\n"; + log << "IPOut::drop (" << ip << "): " << msg << "\n\tBuffer: " << buf + << "\n"; } void IPOut::drop(const std::string& msg, const IPHeader& iph) { - log << "IPOut::drop: " << msg << "\n\tIPHeader: " << iph << "\n"; + log << "IPOut::drop (" << ip << "): " << msg << "\n\tIPHeader: " << iph + << "\n"; } /// Envía un paquete IP @@ -38,7 +40,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 - std::cout << "IPOut::send: A forwardear\n"; + std::cout << "IPOut::send (" << ip << "): A forwardear\n"; #endif send(iph, buf.substr(iph.header_len())); } @@ -85,7 +87,8 @@ 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 - std::cout << "IPOut::send: Fragmento 0 => IPHeader: " << iph2 << "\n"; + std::cout << "IPOut::send (" << ip << "): Fragmento " << i + << " => IPHeader: " << iph2 << "\n"; std::string tmp = data.substr(i * max_payload, max_payload); std::cout << "\tdata (" << tmp.size() << ") = " << tmp << "\n"; #endif