Fixed (Extended) RCODE handling
Fixes #300 (closed)
RCODE is represented by only one field in query_data
. This covers the whole array of possible non-extended and extended RCODEs. The only Extended RCODE in use now is 16 (BADVERS).
The RCODE should be written into the packet at the very end of response creation, because anywhere up to this point an error may occur that changes the resulting RCODE. Otherwise it could happen, for instance, that the upper 8 bits of the RCODE are already written and subsequent error leads to setting SERVFAIL in the header - that would be interpreted by the client together with the upper 8 bits as some other number. This solution also takes into account possible future Extended RCODEs.