#include <sys/msg.h>
#include <signal.h>
-// Uso: ./test_ipout ip [router forward routes_file port proto]
+// Uso: ./ip ip [router forward routes_file port proto]
void send_loop(IPOut& ipout, unsigned proto);
-void add_routes(RouteTable& rt, std::istream& is, Dev& dev);
-
int main(int argc, char* argv[])
{
bool router = false;
bool forward = false;
- unsigned proto = 0;
+ uint8_t proto = 0;
uint16_t port = DEVTCP_DEFAULT_PORT;
std::string fname = "route.txt";
if (argc < 2)
{
- std::cerr << "Uso: ./test_ipout ip [router forward routes_file "
+ std::cerr << "Uso: " << argv[0] << " ip [router forward routes_file "
"port proto]\n";
return 1;
}
IPAddr src, dst;
std::string s = ipin.recv(proto, src, dst);
std::cout << "Recibido '" << s << "' (len " << s.size() << ") de "
- << src << " para " << dst << " (proto = " << proto << ")\n";
+ << src << " para " << dst << " (proto = " << unsigned(proto)
+ << ")\n";
}
return 0;
}
}
}
-void add_routes(RouteTable& rt, std::istream& is, Dev& dev)
-{
- std::string line;
- while (std::getline(is, line))
- {
- std::istringstream iss(line);
- std::string net;
- std::string gw;
- unsigned mtu;
- unsigned metric;
- iss >> net >> gw >> mtu >> metric;
- if (net == "0") net = "0.0.0.0";
- if (gw == "0") gw = "0.0.0.0";
- rt.add(net.c_str(), gw.c_str(), metric, mtu, dev);
- }
-}
-
// vim: set et sw=4 sts=4 :