| Class | Dnsruby::Message |
| In: |
lib/Dnsruby/message.rb
|
| Parent: | Object |
RFC 1035 Section 4.1, RFC 2136 Section 2, RFC 2845
Message objects have five sections:
msg.header=Header.new(...)
header = msg.header
msg.add_question(Question.new(domain, type, klass))
msg.each_question do |question| .... end
msg.add_answer(RR.create({:name => "a2.example.com",
:type => "A", :address => "10.0.0.2"}))
msg.each_answer {|answer| ... }
msg.add_authority(rr)
msg.each_authority {|rr| ... }
msg.add_additional(rr)
msg.each_additional {|rr| ... }
In addition, each_resource iterates the answer, additional and authority sections :
msg.each_resource {|rr| ... }
Dnsruby::Message#encode
Dnsruby::Message::decode(data)
| question | -> | zone |
| In dynamic update packets, the question section is known as zone and specifies the zone to be updated. | ||
| answer | -> | pre |
| In dynamic update packets, the answer section is known as pre or prerequisite and specifies the RRs or RRsets which must or must not preexist. | ||
| add_answer | -> | add_pre |
| pre | -> | prerequisite |
| In dynamic update packets, the answer section is known as pre or prerequisite and specifies the RRs or RRsets which must or must not preexist. | ||
| add_pre | -> | add_prerequisite |
| authority | -> | update |
| In dynamic update packets, the authority section is known as update and specifies the RRs or RRsets to be added or delted. | ||
| add_authority | -> | add_update |
| additional | [R] | The additional section, an array of Dnsruby::RR objects. |
| answer | [R] | The answer section, an array of Dnsruby::RR objects. |
| answerfrom | [RW] | If this Message is a response from a server, then answerfrom contains the address of the server |
| answersize | [RW] | If this Message is a response from a server, then answersize contains the size of the response |
| authority | [R] | The authority section, an array of Dnsruby::RR objects. |
| header | [RW] | The header section, a Dnsruby::Header object. |
| querytsig | [R] | |
| question | [R] | The question section, an array of Dnsruby::Question objects. |
| tsigerror | [R] | |
| tsigkey | [RW] | |
| tsigstart | [RW] | |
| tsigstate | [RW] |
Add a new Question to the Message. Takes either a Question, or a name, and an optional type and class.
msg.add_question(Question.new("example.com", ‘MX’)) msg.add_question("example.com") # defaults to Types.A, Classes.IN msg.add_question("example.com", Types.LOC)