Implementing Communication Protocols on CC2420 motes powered by TinyOS
First, I agree with Joby, you should probably start in a simulator. The reason is simple, there is a large cost to program every device on a network with new software and then collecting data about the cause of a failure can be very hard when it just stops working.

 TinyOS

On that note, you possibly know this already, or you have accepted routing protocols and you want to test how they function in a real world situation. This is very doable. Lets start by clicking over to all of the information on their wiki about their stack. This explains what decisions they made when implementing the stack and how it was designed to allow you to easily change out their protocol with your own communications stack.

It looks like they have done a great job of properly implementing a stack and you should be relatively able to replace the protocol with what you need. Now the challenge here is what I have run into when implementing a wireless protocol. If the algorithm is complex, it can be very very hard to find the root of a problem. At my job we implemented a proprietary 900MHz protocol, let me forewarn of two problems we hit.

Possible Problems

Processing power, try to stay up with how much time you are burning. We found when we started using complicated load equations, and I use the term complicated with reference to how fast an MSP430 runs, the lag on the system and it's response was prohibitive to using a great algorithm.

When we did make errors in our implementation we found that a minor error could stay invisible for hours, days or in one case weeks. This should be solved by using a tried and proven algorithm. The problem we had was our algorithm worked well, but in a certain case the load on the microcontroller was so great it caused large problems, which we exacerbated by our systems response.

Take the time to play with your code in the simulator that tinyOS has.

Let me know if there is anything I can add or make more clear. if you put it in a comment I can try to edit in more info.