Class Dnsruby::Question
In: lib/Dnsruby/message.rb
Parent: Object
Message Update ResolvError EncodeError OtherResolvError ServFail FormErr DecodeError NXRRSet YXDomain NotImp NXDomain VerifyError NotAuth YXRRSet NotZone Refused TsigError CodeMapper Types MetaTypes QTypes Nsec3HashAlgorithms Algorithms OpCode Classes ExtendedRCode Modes RCode Comparable Name RRSet TsigNotSignedResponseError Resolver SingleResolver StandardError TimeoutError ResolvTimeout DNS Dnssec Hosts RR\n[lib/Dnsruby/resource/A.rb\nlib/Dnsruby/resource/AAAA.rb\nlib/Dnsruby/resource/AFSDB.rb\nlib/Dnsruby/resource/CERT.rb\nlib/Dnsruby/resource/DHCID.rb\nlib/Dnsruby/resource/DLV.rb\nlib/Dnsruby/resource/DNSKEY.rb\nlib/Dnsruby/resource/DS.rb\nlib/Dnsruby/resource/HINFO.rb\nlib/Dnsruby/resource/HIP.rb\nlib/Dnsruby/resource/IN.rb\nlib/Dnsruby/resource/IPSECKEY.rb\nlib/Dnsruby/resource/ISDN.rb\nlib/Dnsruby/resource/KX.rb\nlib/Dnsruby/resource/LOC.rb\nlib/Dnsruby/resource/MINFO.rb\nlib/Dnsruby/resource/MX.rb\nlib/Dnsruby/resource/NAPTR.rb\nlib/Dnsruby/resource/NSAP.rb\nlib/Dnsruby/resource/NSEC.rb\nlib/Dnsruby/resource/NSEC3.rb\nlib/Dnsruby/resource/NSEC3PARAM.rb\nlib/Dnsruby/resource/OPT.rb\nlib/Dnsruby/resource/PX.rb\nlib/Dnsruby/resource/RP.rb\nlib/Dnsruby/resource/RRSIG.rb\nlib/Dnsruby/resource/RT.rb\nlib/Dnsruby/resource/SOA.rb\nlib/Dnsruby/resource/SPF.rb\nlib/Dnsruby/resource/SRV.rb\nlib/Dnsruby/resource/SSHFP.rb\nlib/Dnsruby/resource/TKEY.rb\nlib/Dnsruby/resource/TSIG.rb\nlib/Dnsruby/resource/TXT.rb\nlib/Dnsruby/resource/X25.rb\nlib/Dnsruby/resource/domain_name.rb\nlib/Dnsruby/resource/generic.rb\nlib/Dnsruby/resource/resource.rb] Recursor IPv6 IPv4 ZoneTransfer MessageDecoder MessageEncoder Question Header TheLog ValidatorThread PacketSender ResolverRuby Config KeyCache Cache SingleVerifier SelectThread Resolv ZoneReader lib/Dnsruby/DNS.rb lib/Dnsruby/dnssec.rb lib/Dnsruby/Hosts.rb lib/Dnsruby/resource/generic.rb lib/Dnsruby/Recursor.rb lib/Dnsruby/update.rb lib/Dnsruby/ipv6.rb lib/Dnsruby/ipv4.rb lib/Dnsruby/code_mapper.rb lib/Dnsruby/zone_transfer.rb lib/Dnsruby/message.rb lib/Dnsruby/TheLog.rb lib/Dnsruby/resource/resource.rb lib/Dnsruby/validator_thread.rb lib/Dnsruby/PacketSender.rb lib/Dnsruby/Resolver.rb lib/Dnsruby/Config.rb lib/Dnsruby/key_cache.rb lib/Dnsruby/Cache.rb lib/Dnsruby/single_verifier.rb lib/Dnsruby/SingleResolver.rb lib/Dnsruby/select_thread.rb lib/Dnsruby/name.rb lib/dnsruby.rb lib/Dnsruby/resource/TKEY.rb lib/Dnsruby/zone_reader.rb Dnsruby dot/m_61_0.png

A Dnsruby::Question object represents a record in the question section of a DNS packet.

RFC 1035 Section 4.1.2

Methods

new   qclass=   qname=   qtype=   to_s  

External Aliases

qname -> zname
  For Updates, the qname field is redefined to zname (RFC2136, section 2.3)
qtype -> ztype
  For Updates, the qtype field is redefined to ztype (RFC2136, section 2.3)
qclass -> zclass
  For Updates, the qclass field is redefined to zclass (RFC2136, section 2.3)
qtype -> type

Attributes

qclass  [R]  The Question class
qname  [R]  The Question name
qtype  [R]  The Question type

Public Class methods

Creates a question object from the domain, type, and class passed as arguments.

If a String is passed in, a Name, IPv4 or IPv6 object is created.

If an IPv4 or IPv6 object is used then the type is set to PTR.

[Source]

      # File lib/Dnsruby/message.rb, line 1116
1116:     def initialize(*args)
1117:       @qtype = Types::A
1118:       @qclass = Classes::IN
1119:       if (args.length > 0)
1120:         if (args.length > 1)
1121:           @qtype = Types.new(args[1])
1122:           if (args.length > 2)
1123:             @qclass = Classes.new(args[2])
1124:           end
1125:         end
1126:       else
1127:         raise ArgumentError.new("Must pass at least a name!")
1128:       end
1129:       # If the name looks like an IP address then do an appropriate
1130:       # PTR query.
1131:       @qname=args[0]
1132:       case @qname.to_s
1133:       when IPv4::Regex
1134:         @qname = IPv4.create(@qname).to_name
1135:         @qtype = Types.PTR
1136:       when IPv6::Regex
1137:         @qname = IPv6.create(@qname).to_name
1138:         @qtype = Types.PTR
1139:       when Name
1140:       when IPv6
1141:         @qtype = Types.PTR
1142:       when IPv4
1143:         @qtype = Types.PTR
1144:       else
1145:         @qname = Name.create(@qname)
1146:       end
1147:     end

Public Instance methods

[Source]

      # File lib/Dnsruby/message.rb, line 1153
1153:     def qclass=(qclass)
1154:       @qclass = Classes.new(qclass)
1155:     end

[Source]

      # File lib/Dnsruby/message.rb, line 1157
1157:     def qname=(qname)
1158:       case qname
1159:       when IPv4::Regex
1160:         @qname = IPv4.create(qname).to_name
1161:         @qtype = Types.PTR
1162:       when IPv6::Regex
1163:         @qname = IPv6.create(qname).to_name
1164:         @qtype = Types.PTR
1165:       when Name
1166:       when IPv6
1167:         @qtype = Types.PTR
1168:       when IPv4
1169:         @qtype = Types.PTR
1170:       else
1171:         @qname = Name.create(qname)
1172:       end
1173:     end

[Source]

      # File lib/Dnsruby/message.rb, line 1149
1149:     def qtype=(qtype)
1150:       @qtype = Types.new(qtype)
1151:     end

Returns a string representation of the question record.

[Source]

      # File lib/Dnsruby/message.rb, line 1176
1176:     def to_s
1177:       return "#{@qname}.\t#{@qclass.string}\t#{@qtype.string}";
1178:     end

[Validate]