Add a constant for detecting whether we are in debug mode.
Common protocols file added.

This is used to keep loose coupling between classes.