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)
security_level records the current DNSSEC status of this Message. answerfrom records the server which this Message was received from. cached records whether this response came from the cache.
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 |
answerip | [RW] | If this Message is a response from a server, then answerfrom contains the IP 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. |
cached | [RW] | If the Message was returned from the cache, the cached flag will be set true. It will be false otherwise. |
do_caching | [RW] | do_caching is set by default. If you do not wish dnsruby to inspect the cache before sending the query, nor cache the result of the query, then set do_caching to false. |
do_validation | [RW] | do_validation is set by default. If you do not wish dnsruby to validate this message (on a Resolver with @dnssec==true), then set do_validation to false. This option does not affect caching, or the header options |
header | [RW] | The header section, a Dnsruby::Header object. |
question | [R] | The question section, an array of Dnsruby::Question objects. |
security_error | [RW] | If there was a problem verifying this message with DNSSEC, then securiy_error will hold a description of the problem. It defaults to "" |
security_level | [RW] | If dnssec is set on, then each message will have the security level set To find the precise error (if any), call Dnsruby::Dnssec::validate(msg) - the resultant exception will define the error. |
send_raw | [RW] |
Set send_raw if you wish to send and receive the response to this Message with no additional processing. In other
words, if set, then Dnsruby will not touch
the Header of the outgoing Message. This option does not affect caching or
dnssec validation
This option should not normally be set. |
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
Return the first rrset of the specified attributes in the message
Return a hash, with the section as key, and the RRSets in that section as the data : {section => section_rrs}
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.)