Clean up the structure of some source code

New **protocol** module *<ripple/protocol/>* contains what was in src/ripple/data/protocol. Each file now includes what it uses.
Reviewers: @josh-ripple @donovanhide 
This looks like something to do with the algorithm, so does the rest of the changes in this file.