13 // Uso: ./test_ipin ip mtu router forward proto queue_id
15 int main(int argc, char* argv[])
17 IPAddr addr("10.10.10.1");
22 key_t queue_id = DEV_DEFAULT_KEY;
24 addr = IPAddr(argv[1]);
28 router = atoi(argv[3]);
30 forward = atoi(argv[4]);
32 proto = atoi(argv[5]);
34 queue_id = atoi(argv[6]);
35 Dev dev(addr, mtu, queue_id);
36 int que_id = msgget(queue_id+1, IPC_CREAT | 0666);
38 Dev fwque(addr, DEV_MAX_MTU, queue_id+1);
39 IPIn ipin(addr, dev, fwque, router, forward, std::cerr);
40 struct msqid_ds minfo;
41 for (msgctl(dev.que_id, IPC_STAT, &minfo); minfo.msg_qnum;
42 msgctl(dev.que_id, IPC_STAT, &minfo))
45 std::cout << "Quedan " << minfo.msg_qnum << " mensajes en la cola\n";
46 std::string s = ipin.recv(proto, src, dst);
47 std::cout << "Recibido '" << s << "' (len " << s.size() << ") de "
48 << src << " para " << dst << " (proto = " << proto << ")\n";
53 // vim: set et sw=4 sts=4 :