#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
+#ifdef DEBUG
+#include <iostream>
+#endif
/// Constructor
IPOut::IPOut(const IPAddr& ip, RouteTable& rtable, Dev& forward_que, std::ostream& log):
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()));
}
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));
}