[MINOR] move error codes to common/errors.h

It's useful to be able to share error codes between C files,
so move the codes currently only used in protocols to a generic
file.
5 files changed