Class: ReDNS::Question
Instance Attribute Summary
Attributes inherited from Fragment
#attributes
Instance Method Summary
collapse
Methods inherited from Fragment
attribute, #initialize
Methods included from Support
#addr_to_arpa, #bind_all_addr, #default_nameservers, #default_resolver_address, #dns_port, #inet_aton, #inet_ntoa, #io_nonblock, #io_nonblock?, #io_set_nonblock, #is_ip?
Instance Method Details
#deserialize(buffer) ⇒ Object
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/redns/question.rb', line 30
def deserialize(buffer)
self.name = ReDNS::Name.new(buffer)
data = buffer.unpack('nn')
self.qtype = ReDNS::RR_TYPE_LABEL[data.shift]
self.qclass = ReDNS::RR_CLASS_LABEL[data.shift]
self
end
|
#serialize(buffer = ReDNS::Buffer.new) ⇒ Object
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/redns/question.rb', line 19
def serialize(buffer = ReDNS::Buffer.new)
name.serialize(buffer)
buffer.pack(
'nn',
ReDNS::RR_TYPE[self.qtype],
ReDNS::RR_CLASS[self.qclass]
)
buffer
end
|
#to_s ⇒ Object
Instance Methods =====================================================
15
16
17
|
# File 'lib/redns/question.rb', line 15
def to_s
"#{name} #{qclass.to_s.upcase} #{qtype.to_s.upcase}"
end
|