Class Index [+]

Quicksearch

Dnsruby::SingleResolver

Dnsruby::SingleResolver

 This class has been deprecated.
 This implementation exists for legacy clients. New code should use the Dnsruby::Resolver class.
 The SingleResolver class targets a single resolver, and controls the sending of a single
 packet with a packet timeout. It performs no retries. Only two threads are used - the client
 thread and a select thread (which is reused across all queries).

Methods

Synchronous

These methods raise an exception or return a response message with rcode==NOERROR

Asynchronous

These methods use a response queue to return the response and the error to the client. Support for EventMachine has been deprecated

Public Class Methods

new(*args) click to toggle source

Can take a hash with the following optional keys :

  • :server

  • :port

  • :use_tcp

  • :no_tcp

  • :ignore_truncation

  • :src_address

  • :src_port

  • :udp_size

  • :persistent_tcp

  • :persistent_udp

  • :tsig

  • :packet_timeout

  • :recurse

     # File lib/Dnsruby/SingleResolver.rb, line 56
 56:     def initialize(*args)
 57:       arg=args[0]
 58:       @single_res_mutex = Mutex.new
 59:       @packet_timeout = Resolver::DefaultPacketTimeout
 60:       @query_timeout = @packet_timeout
 61:       @port = Resolver::DefaultPort
 62:       @udp_size = Resolver::DefaultUDPSize
 63:       @dnssec = Resolver::DefaultDnssec
 64:       @use_tcp = false
 65:       @no_tcp = false
 66:       @tsig = nil
 67:       @ignore_truncation = false
 68:       @src_address        = nil
 69:       @src_port        = [0]
 70:       @recurse = true
 71:       @persistent_udp = false
 72:       @persistent_tcp = false
 73:       @retry_times = 1
 74:       @retry_delay = 0
 75:       @single_resolvers = []
 76:       @configured = false
 77:       @do_caching = true
 78:       @config = Config.new
 79: 
 80:       if (arg==nil)
 81:         # Get default config
 82:         @config = Config.new
 83:         @config.get_ready
 84:         @server = @config.nameserver[0]
 85:       elsif (arg.kind_of?String)
 86:         @config.get_ready
 87:         @configured= true
 88:         @config.nameserver=[arg]
 89:         @server = @config.nameserver[0]
 90:         #        @server=arg
 91:       elsif (arg.kind_of?Name)
 92:         @config.get_ready
 93:         @configured= true
 94:         @config.nameserver=arg
 95:         @server = @config.nameserver[0]
 96:         #        @server=arg
 97:       elsif (arg.kind_of?Hash)
 98:         arg.keys.each do |attr|
 99:           if (attr == :server)
100:             @config.get_ready
101:             @configured= true
102:             @config.nameserver=[arg[attr]]
103:             @server = @config.nameserver[0]
104: 
105:           else
106:             begin
107:               send(attr.to_s+"=", arg[attr])
108:             rescue Exception
109:               Dnsruby.log.error{"Argument #{attr} not valid\n"}
110:             end
111:           end
112:         end
113:       end
114: 
115:       isr = PacketSender.new({:server=>@server, :dnssec=>@dnssec,
116:           :use_tcp=>@use_tcp, :no_tcp=>@no_tcp, :packet_timeout=>@packet_timeout,
117:           :tsig => @tsig, :ignore_truncation=>@ignore_truncation,
118:           :src_address=>@src_address, :src_port=>@src_port,
119:           :do_caching=>@do_caching,
120:           :recurse=>@recurse, :udp_size=>@udp_size})
121: 
122:       @single_resolvers = [isr]
123: 
124:       #      ResolverRegister::register_single_resolver(self)
125:     end

Public Instance Methods

add_opt_rr(m) click to toggle source

Add the appropriate EDNS OPT RR for the specified packet. This is done automatically, unless you are using Resolver#send_plain_message

     # File lib/Dnsruby/SingleResolver.rb, line 168
168:     def add_opt_rr(m)
169:       @single_res_mutex.synchronize {
170:         @single_resolvers[0].add_opt_rr(m)
171:       }
172:     end
packet_timeout=(t) click to toggle source
     # File lib/Dnsruby/SingleResolver.rb, line 161
161:     def packet_timeout=(t)
162:       @packet_timeout = t
163:       @query_timeout = t
164:     end
Also aliased as: query_timeout=
query_timeout=(t) click to toggle source
Alias for: packet_timeout=
server() click to toggle source
     # File lib/Dnsruby/SingleResolver.rb, line 144
144:     def server
145:       #      @single_res_mutex.synchronize {
146:       if (!@configured)
147:         @config.get_ready
148:         add_config_nameservers
149:       end
150:       return @single_resolvers[0].server
151:       #      }
152:     end
server=(s) click to toggle source
     # File lib/Dnsruby/SingleResolver.rb, line 127
127:     def server=(s)
128:       if (!@configured)
129:         @config.get_ready
130:       end
131:       @server = Config.resolve_server(s).to_s
132:       isr = PacketSender.new({:server=>@server, :dnssec=>@dnssec,
133:           :use_tcp=>@use_tcp, :no_tcp=>@no_tcp, :packet_timeout=>@packet_timeout,
134:           :tsig => @tsig, :ignore_truncation=>@ignore_truncation,
135:           :src_address=>@src_address, :src_port=>@src_port,
136:           :do_caching=>@do_caching,
137:           :recurse=>@recurse, :udp_size=>@udp_size})
138: 
139:       @single_res_mutex.synchronize {
140:         @single_resolvers = [isr]
141:       }
142:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.