Object
# File resolv.rb, line 1258
def put_label(d)
self.put_string(d.string)
end
# File resolv.rb, line 1244
def put_labels(d)
d.each_index {|i|
domain = d[i..-1]
if idx = @names[domain]
self.put_pack("n", 0xc000 | idx)
return
else
@names[domain] = @data.length
self.put_label(d[i])
end
}
@data << "\00""
end
# File resolv.rb, line 1220
def put_length16
length_index = @data.length
@data << "\00\\00""
data_start = @data.length
yield
data_end = @data.length
@data[length_index, 2] = [data_end - data_start].pack("n")
end
# File resolv.rb, line 1240
def put_name(d)
put_labels(d.to_a)
end
# File resolv.rb, line 1216
def put_pack(template, *d)
@data << d.pack(template)
end
# File resolv.rb, line 1229
def put_string(d)
self.put_pack("C", d.length)
@data << d
end
Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.
If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.
If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.
If you want to help improve the Ruby documentation, please see Improve the docs, or visit Documenting-ruby.org.