Refactoring #defines into typedef enums
This is an initial attempt to refactor the various
#defines into structured enums. This brings benefit of having stronger type checking with compilers that supports it (clang has
Ultimately, most of the existing defines should be converted, but I would say that we should make it in small steps.