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/PX.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 1124
1124:     def initialize(*args)
1125:       @qtype = Types::A
1126:       @qclass = Classes::IN
1127:       if (args.length > 0)
1128:         if (args.length > 1)
1129:           @qtype = Types.new(args[1])
1130:           if (args.length > 2)
1131:             @qclass = Classes.new(args[2])
1132:           end
1133:         end
1134:       else
1135:         raise ArgumentError.new("Must pass at least a name!")
1136:       end
1137:       # If the name looks like an IP address then do an appropriate
1138:       # PTR query.
1139:       @qname=args[0]
1140:       case @qname.to_s
1141:       when IPv4::Regex
1142:         @qname = IPv4.create(@qname).to_name
1143:         @qtype = Types.PTR
1144:       when IPv6::Regex
1145:         @qname = IPv6.create(@qname).to_name
1146:         @qtype = Types.PTR
1147:       when Name
1148:       when IPv6
1149:         @qtype = Types.PTR
1150:       when IPv4
1151:         @qtype = Types.PTR
1152:       else
1153:         @qname = Name.create(@qname)
1154:       end
1155:     end

Public Instance methods

[Source]

      # File lib/Dnsruby/message.rb, line 1161
1161:     def qclass=(qclass)
1162:       @qclass = Classes.new(qclass)
1163:     end

[Source]

      # File lib/Dnsruby/message.rb, line 1165
1165:     def qname=(qname)
1166:       case qname
1167:       when IPv4::Regex
1168:         @qname = IPv4.create(qname).to_name
1169:         @qtype = Types.PTR
1170:       when IPv6::Regex
1171:         @qname = IPv6.create(qname).to_name
1172:         @qtype = Types.PTR
1173:       when Name
1174:       when IPv6
1175:         @qtype = Types.PTR
1176:       when IPv4
1177:         @qtype = Types.PTR
1178:       else
1179:         @qname = Name.create(qname)
1180:       end
1181:     end

[Source]

      # File lib/Dnsruby/message.rb, line 1157
1157:     def qtype=(qtype)
1158:       @qtype = Types.new(qtype)
1159:     end

Returns a string representation of the question record.

[Source]

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

[Validate]