I need to have five entities created in C++ for a wireless routing system: a Mobile Node, a Home Agent, 2 Foreign Agents, and a Data Source. The Foreign Agents and Mobile Node processes will be run on the same physical machine.
You will ultimately be writing 4 programs (all very small).
The Data Source opens a UDP port, sets the destination to the Home Agent IP/Mobile Node port, and sends a packet once per second, with increasing sequence numbers. The source IP/port do not matter.
The Home Agent opens a UDP port with source bound to Home Agent IP/Mobile Node port and sets destination to Foreign Agent IP/Foreign Agent port. If it receives a packet on this port, it is either a registration request from the Mobile Node or a data packet from the Data Source. If it is a registration packet, the Home Agent changes the destination to
Foreign Agent IP/ new Foreign Agent port. If it is a data packet, it sends the packet to the current care-of address.
The 2 Foreign Agents open a UDP port, bind the source to Foreign Agent IP/Foreign Agent port, and set the destination to Foreign Agent IP/Mobile Node port. (Remember that Foreign Agent IP = Mobile Node IP.) Each time they receive a packet, they forward it on to the mobile.
The Mobile Node opens a UDP port with source bound to Foreign Agent IP/Mobile Node port and destination set to Home Agent IP/Mobile Node port. Every 5 seconds, it sends a registration request to the Home Agent with the alternate Foreign Agent's care-of address in the packet. (We assume that the Mobile Node knows the care-of addresses for the 2 Foreign Agents.) When it receives a packet, it must make sure that it has come from the right Foreign Agent (by comparing the source port to the currently registered Foreign Agent). When the Mobile Node has run for 100 seconds it should exit.
Upon acceptance of the bid, I will post two example programs which send and receive UDP packets respectively. If you choose to, you can use these as a starting point and modify them for the requirements specified above.