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
- 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
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?)
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
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()));
}
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