Extracted common protocol registration code.

Pairing with Philip Arndt