Refactoring the codec for «case enums»

As it seems this patterns of «case enums» will be used even more than
for message types and quality of service, I've tried to remove some
boilerplate on the codec side through the use of implicit vies.

Not sure to be comfortable with what I've done, but it seemed to be at
least a good idea to try it.