X-Git-Url: https://git.llucax.com/z.facultad/75.74/practicos.git/blobdiff_plain/63516fdd4cb64b01971750be1d29d7244b1f9e5e..f48d95822c7810a45daf26854de7262ccc20a940:/practicas/pipi/src/ip.cpp?ds=sidebyside diff --git a/practicas/pipi/src/ip.cpp b/practicas/pipi/src/ip.cpp index 6bffcfd..0e9d0de 100644 --- a/practicas/pipi/src/ip.cpp +++ b/practicas/pipi/src/ip.cpp @@ -18,12 +18,10 @@ #include #include -// 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; @@ -33,7 +31,7 @@ int main(int argc, char* argv[]) 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; } @@ -48,8 +46,6 @@ int main(int argc, char* argv[]) port = atoi(argv[5]); if (argc > 6) proto = atoi(argv[6]); - // Creo cola para comunicar el IPIn con IPOut - int que_id = msgget(DEVQUE_DEFAULT_KEY-1, IPC_CREAT | 0666); assert(que_id != -1); // Abro archivo con rutas std::ifstream ifs(fname.c_str()); assert(ifs); // Creo medio físico y cola para forwarding @@ -120,21 +116,4 @@ void send_loop(IPOut& ipout, unsigned proto) } } -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, gw, metric, mtu, dev); - } -} - // vim: set et sw=4 sts=4 :