For this homework, you have to start implementing the RAP protocol.
Don't stress
This is a first version of the protocol only, and this assignment is a "best-effort" assignment: do it as well as you can, but don't stress out if you run into trouble. You will be mostly graded on later versions of the protocol you implement (for instance, the one that will be due on May 24). However, it is worth trying to do as good a job as possible, not to leave too much to be done later.
What to do
What you have to do is to implement the RR and RP packets (the broadcast packets) and, if you can, start working on RC packets (which are routed). More in detail:
- Generate, from the PC, reasonable RR packets (babble.c probably does this already for you).
- Lego bricks, and PCs, should be able to:
- Receive RR and RP packets
- Check their nonce
- If the host is not the final destination, rebroadcast the packets after a random delay, with the route updated as in the packet format specification.
How to do it
Go to the RAP: Robos Ad-Hoc Protocol page, and download rap-tarball.tgz. Follow these set-up instructions:
cd rap-class/robos ./configure make cd ../rap make depend make
Note that I am giving you adhoc.c; you can use this as a starting point for your implementation. In particular, I recommend that you keep the #define and #include at the top, to ensure that what you write can be compiled both for the PC, and for the lego.
The reason for the makelinks script is the following. You can compile adhoc.c (or however you want to call your implementation) both for the lego, and for the PC.
- The copy that lives in the robos/rap directory is the one that will end up on the lego.
- The copy that lives in the rap/applications directory is the one that you can run on the PC.
Defines in the Makefiles ensure that the proper versions of libraries are used in both versions. The symbolic links are so that you can edit only one version of the files, and you can then compile the same file, both for the PC, and for the lego.
- Please try not to use malloc's in your implementation, and to implement everything statically. The copy that
- It might be that you need to be root to run lnpd. Try it (and see the note at the bottom of the page above). If this is the case, ask the TA to add lnpd to the set of sudo programs.
What you don't need to implement yet
- Proper generation of RR packets (since this depends on the route table).
- Other packet types.
- The route table, and the management of the route table.
General Information
Every one of you needs an address (a small integer), for the PC and for the Robot. Choose an ordering for the tables in the lab, and let the first PC be number 1, the first Robot be number 2, the second PC be number 3, the second robot be number 4, and so on.
Feel free (in fact, it is advised) to work in groups for debugging the program, so that you can try to receive and send packets others are sending. However, for this assignment you must write your own code, and you can discuss only the code architecture with other students; you cannot share pieces of code.
