| 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. |
| question | [R] | The question section, an array of Dnsruby::Question objects. |
| tsigerror | [RW] | If this message has been verified using a TSIG RR then tsigerror contains the error code returned by the TSIG verification. The error will be an RCode |
| tsigstart | [RW] | |
| tsigstate | [RW] |
Can be
in which only every 100th envelope must be signed
|
Create a new Message. Takes optional name, type and class
type defaults to A, and klass defaults to IN
Add a new Question to the Message. Takes either a Question, or a name, and an optional type and class.
Return the encoded form of the message
If there is a TSIG record present and the record has not been signed then sign it
Sets the TSIG to sign this message with. Can either be a Dnsruby::RR::TSIG object, or it can be a (name, key) tuple, or it can be a hash which takes Dnsruby::RR::TSIG attributes (e.g. name, key, fudge, etc.)
Signs the message. If used with no arguments, then the message must have already been set (set_tsig). Otherwise, the arguments can either be a Dnsruby::RR::TSIG object, or a (name, key) tuple, or a hash which takes Dnsruby::RR::TSIG attributes (e.g. name, key, fudge, etc.)