External packet decoding.

This moves packet decoding to an external module.
Also adds testing of the packet decoding.
Merge pull request #3 from kmpm/ext-packet

External packet decoding.