end
})
+-- Metatype for RR types to allow anonymous string types
+setmetatable(const_type_str, {
+ __index = function (t, k)
+ local v = rawget(t, k)
+ if v then return v end
+ return string.format('TYPE%d', k)
+ end
+})
+
-- Metatype for sockaddr
local addr_buf = ffi.new('char[16]')
local sockaddr_t = ffi.typeof('struct sockaddr')
-- Test inverset tables to convert constants to text
same(kres.tostring.class[1], 'IN', 'text class constants work')
same(kres.tostring.type[2], 'NS', 'text record type constants work')
+ same(kres.tostring.type[65535], 'TYPE65535', 'text record type undefined constants work')
same(kres.tostring.section[0], 'ANSWER', 'text section constants work')
same(kres.tostring.rcode[2], 'SERVFAIL', 'text rcode constants work')
same(kres.tostring.opcode[5], 'UPDATE', 'text opcode constants work')