X-Git-Url: https://git.llucax.com/z.facultad/75.74/practicos.git/blobdiff_plain/0a2739fe97762f57a80599ef170df98e07422a3d..6758589f5ff68b1775d5a83b01d7ac49f1b612ef:/practicas/pipi/src/test_ipin.cpp?ds=sidebyside diff --git a/practicas/pipi/src/test_ipin.cpp b/practicas/pipi/src/test_ipin.cpp index 01b19aa..eb15d0f 100644 --- a/practicas/pipi/src/test_ipin.cpp +++ b/practicas/pipi/src/test_ipin.cpp @@ -10,12 +10,14 @@ #include #include -// Uso: ./test_ipin ip mtu proto queue_id +// Uso: ./test_ipin ip mtu router forward proto queue_id int main(int argc, char* argv[]) { IPAddr addr("10.10.10.1"); unsigned mtu = 25; + bool router = false; + bool forward = false; unsigned proto = 0; key_t queue_id = DEV_DEFAULT_KEY; if (argc > 1) @@ -23,11 +25,18 @@ int main(int argc, char* argv[]) if (argc > 2) mtu = atoi(argv[2]); if (argc > 3) - proto = atoi(argv[3]); + router = atoi(argv[3]); if (argc > 4) - queue_id = atoi(argv[4]); + forward = atoi(argv[4]); + if (argc > 5) + proto = atoi(argv[5]); + if (argc > 6) + queue_id = atoi(argv[6]); Dev dev(addr, mtu, queue_id); - IPIn ipin(addr, dev); + int que_id = msgget(queue_id+1, IPC_CREAT | 0666); + assert(que_id != -1); + Dev fwque(addr, DEV_MAX_MTU, queue_id+1); + IPIn ipin(addr, dev, fwque, router, forward, std::cerr); struct msqid_ds minfo; for (msgctl(dev.que_id, IPC_STAT, &minfo); minfo.msg_qnum; msgctl(dev.que_id, IPC_STAT, &minfo))