X-Git-Url: https://git.llucax.com/z.facultad/75.74/practicos.git/blobdiff_plain/49f488eb5e757db401a81bc40a30a84d1abcaf88..ac1d74a402f344ad8135f125cbac73ecda46172e:/practicas/pipi/src/test_ipout.cpp?ds=sidebyside diff --git a/practicas/pipi/src/test_ipout.cpp b/practicas/pipi/src/test_ipout.cpp index 1dd289f..1f11fc1 100644 --- a/practicas/pipi/src/test_ipout.cpp +++ b/practicas/pipi/src/test_ipout.cpp @@ -2,7 +2,7 @@ #include "ipout.h" #include "ipaddr.h" #include "routetable.h" -#include "dev.h" +#include "devque.h" #include #include #include @@ -16,7 +16,7 @@ // Uso: ./test_ipout ip dst mtu routes_file proto queue_id -void add_routes(RouteTable& rt, std::istream& is, Dev& dev); +void add_routes(RouteTable& rt, std::istream& is, size_t mtu, Dev& dev); int main(int argc, char* argv[]) { @@ -24,7 +24,7 @@ int main(int argc, char* argv[]) IPAddr dst("10.10.10.1"); unsigned mtu = 25; unsigned proto = 0; - key_t queue_id = DEV_DEFAULT_KEY; + key_t queue_id = DEVQUE_DEFAULT_KEY; std::string fname = "route.txt"; if (argc > 1) addr = IPAddr(argv[1]); @@ -41,11 +41,11 @@ int main(int argc, char* argv[]) int que_id = msgget(queue_id, IPC_CREAT | 0666); assert(que_id != -1); que_id = msgget(queue_id+1, IPC_CREAT | 0666); assert(que_id != -1); std::ifstream ifs(fname.c_str()); assert(ifs); - Dev dev(addr, mtu, queue_id); - Dev fwque(addr, DEV_MAX_MTU, queue_id+1); + DevQue dev(addr, mtu, queue_id); + DevQue fwque(addr, DEV_MAX_MTU, queue_id+1); RouteTable table(dev); - add_routes(table, ifs, dev); - IPOut ipout(addr, table, fwque); + add_routes(table, ifs, mtu, dev); + IPOut ipout(addr, table, fwque, std::cerr); std::string msg; while (std::getline(std::cin, msg)) { @@ -57,7 +57,7 @@ int main(int argc, char* argv[]) return 0; } -void add_routes(RouteTable& rt, std::istream& is, Dev& dev) +void add_routes(RouteTable& rt, std::istream& is, size_t mtu, Dev& dev) { std::string line; while (std::getline(is, line)) @@ -69,7 +69,7 @@ void add_routes(RouteTable& rt, std::istream& is, Dev& dev) iss >> net >> gw >> 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, dev); + rt.add(net, gw, mtu, metric, dev); } }