-std::string IPIn::recv(uint8_t proto, IPAddr& src, IPAddr& dst) throw (std::runtime_error)
+std::string IPIn::recv(uint8_t& proto, IPAddr& src, IPAddr& dst)
+ throw (std::runtime_error)
std::cout << "IPIn::recv (" << ip << "): IPHeader: " << iph << "\n";
std::string tmp = buf.substr(iph.header_len());
std::cout << "\tdata (" << tmp.size() << ") = " << tmp << "\n";
#endif
if (iph.version != 4)
{
std::cout << "IPIn::recv (" << ip << "): IPHeader: " << iph << "\n";
std::string tmp = buf.substr(iph.header_len());
std::cout << "\tdata (" << tmp.size() << ") = " << tmp << "\n";
#endif
if (iph.version != 4)
{
drop("Versión IP incorrecta", iph);
continue;
}
if (!iph.check_checksum())
{
drop("Versión IP incorrecta", iph);
continue;
}
if (!iph.check_checksum())
{
drop("Es para nosotros pero somos un router", iph);
continue;
}
// Es para nosotros y somos un host
// Guarda en buffer
buffer[iph][iph.offset] = buf.substr(iph.header_len());
drop("Es para nosotros pero somos un router", iph);
continue;
}
// Es para nosotros y somos un host
// Guarda en buffer
buffer[iph][iph.offset] = buf.substr(iph.header_len());