78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
# File 'lib/faildns/resourcerecord.rb', line 78
def self.parse (string, original)
string.force_encoding 'BINARY'
ResourceRecord.new {|r|
r.name = DomainName.parse(string, original)
r.type = Type.parse(string)
r.class = Class.parse(string)
r.ttl = string.unpack('N').first; string[0, 4] = ''
r.length = string.unpack('n').first; string[0, 2] = ''
r.data = ResourceRecord.const_get(r.class.to_sym).const_get(r.type.to_sym) rescue nil
if !r.data
r.data = ResourceRecord.const_get(r.class.to_sym).const_get(:NULL)
DNS.debug "ResourceRecord::#{r.class}::#{r.type} not found."
end
DNS.debug r.data.inspect, { :level => 2 }
r.data = r.data.parse(string, r.length, original)
}
end
|