Rfc6810 bis

pull request for reviewing code
create an enum for the different error codes and use the enum members instead of the raw error code