I am working on a client server based communication protocol stack.
I have a list of errors that could occur during the course of communication
So, if the server finds an error in connection due to cause7 of subtype3Code:Errortype  Type1  Type2  Type1 Subtype1  Subtype2  Type2 Subtype3  Subtype1 cause1  cause2  cause3  Subtype2 cause4  Subtype3 cause5  cause6  cause7  cause8 
and type2, it has to send the error report as:
Code:errortype : 0x01 Type : 0x01 Subtype : 0x00 Cause : 0x02
So the data transferes is 01 01 00 02
I found that i can't have enum of enums in c++. And other suggestion I got
was to used a 4 byte integer for the whole error structure, so that the most significant 8 bit will show errortype, the next 8bit shows type, the next shows subtype and the least significant 8 bit shows cause. Is there any better way to do it, so that the types and subtypes and cause don't get mixed up, like type2 an't have subtype1 cause1.?