Class: Dnsruby::SingleResolver

### Home Classes Methods

### In Files

- lib/Dnsruby/SingleResolver.rb

### Parent

Dnsruby::Resolver

### Methods

- ::new
- #add_opt_rr
- #packet_timeout=
- #query_timeout=
- #server
- #server=

### Files

- DNSSEC
- EVENTMACHINE
- EXAMPLES
- README

### Class/Module Index

Quicksearch

- Dnsruby
- Dnsruby::Algorithms
- Dnsruby::Classes
- Dnsruby::CodeMapper
- Dnsruby::Config
- Dnsruby::DNS
- Dnsruby::DecodeError
- Dnsruby::Dnssec
- Dnsruby::Dnssec::ValidationPolicy
- Dnsruby::EncodeError
- Dnsruby::ExtendedRCode
- Dnsruby::FormErr
- Dnsruby::Header
- Dnsruby::Hosts
- Dnsruby::IPv4
- Dnsruby::IPv6
- Dnsruby::Message
- Dnsruby::Message::Section
- Dnsruby::Message::SecurityLevel
- Dnsruby::MetaTypes
- Dnsruby::Modes
- Dnsruby::NXDomain
- Dnsruby::NXRRSet
- Dnsruby::Name
- Dnsruby::Name::Label
- Dnsruby::NotAuth
- Dnsruby::NotImp
- Dnsruby::NotZone
- Dnsruby::Nsec3HashAlgorithms
- Dnsruby::OpCode
- Dnsruby::OtherResolvError
- Dnsruby::QTypes
- Dnsruby::Question
- Dnsruby::RCode
- Dnsruby::RR
- Dnsruby::RR::ANY
- Dnsruby::RR::CERT
- Dnsruby::RR::CERT::CertificateTypes
- Dnsruby::RR::CNAME
- Dnsruby::RR::DHCID
- Dnsruby::RR::DLV
- Dnsruby::RR::DNAME
- Dnsruby::RR::DNSKEY
- Dnsruby::RR::DS
- Dnsruby::RR::DS::DigestTypes
- Dnsruby::RR::DomainName
- Dnsruby::RR::Generic
- Dnsruby::RR::HINFO
- Dnsruby::RR::HIP
- Dnsruby::RR::IN
- Dnsruby::RR::IN::A
- Dnsruby::RR::IN::AAAA
- Dnsruby::RR::IN::AFSDB
- Dnsruby::RR::IN::PX
- Dnsruby::RR::IN::SRV
- Dnsruby::RR::IN::WKS
- Dnsruby::RR::IPSECKEY
- Dnsruby::RR::ISDN
- Dnsruby::RR::KX
- Dnsruby::RR::LOC
- Dnsruby::RR::MB
- Dnsruby::RR::MG
- Dnsruby::RR::MINFO
- Dnsruby::RR::MR
- Dnsruby::RR::MX
- Dnsruby::RR::NAPTR
- Dnsruby::RR::NS
- Dnsruby::RR::NSAP
- Dnsruby::RR::NSEC
- Dnsruby::RR::NSEC3
- Dnsruby::RR::NSEC3PARAM
- Dnsruby::RR::OPT
- Dnsruby::RR::PTR
- Dnsruby::RR::RP
- Dnsruby::RR::RRSIG
- Dnsruby::RR::RT
- Dnsruby::RR::SOA
- Dnsruby::RR::SPF
- Dnsruby::RR::SSHFP
- Dnsruby::RR::SSHFP::Algorithms
- Dnsruby::RR::SSHFP::FpTypes
- Dnsruby::RR::TKEY
- Dnsruby::RR::TSIG
- Dnsruby::RR::TXT
- Dnsruby::RR::X25
- Dnsruby::RRSet
- Dnsruby::Recursor
- Dnsruby::Refused
- Dnsruby::Resolv
- Dnsruby::ResolvError
- Dnsruby::ResolvTimeout
- Dnsruby::Resolver
- Dnsruby::Resolver::EventType
- Dnsruby::SelectThread
- Dnsruby::ServFail
- Dnsruby::SingleResolver
- Dnsruby::TheLog
- Dnsruby::TsigError
- Dnsruby::TsigNotSignedResponseError
- Dnsruby::Types
- Dnsruby::Update
- Dnsruby::VerifyError
- Dnsruby::YXDomain
- Dnsruby::YXRRSet
- Dnsruby::ZoneReader
- Dnsruby::ZoneReader::ParseException
- Dnsruby::ZoneSerialError
- Dnsruby::ZoneTransfer
- Dnsruby::ZoneTransfer::Delta
- Base32

No matching classes.

# 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

- Dnsruby::SingleResolver#send_message(msg [, use_tcp]))

- Dnsruby::SingleResolver#query(name [, type [, klass]])

### Asynchronous

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

- Dnsruby::SingleResolver#send_async(...)

### 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_address6

- :src_port

- :udp_size

- :persistent_tcp

- :persistent_udp

- :tsig

- :packet_timeout

- :recurse

    # File lib/Dnsruby/SingleResolver.rb, line 57
    def initialize(*args)
      arg=args[0]
      @single_res_mutex = Mutex.new
      @packet_timeout = Resolver::DefaultPacketTimeout
      @query_timeout = @packet_timeout
      @port = Resolver::DefaultPort
      @udp_size = Resolver::DefaultUDPSize
      @dnssec = Resolver::DefaultDnssec
      @use_tcp = false
      @no_tcp = false
      @tsig = nil
      @ignore_truncation = false
      @src_address        = nil
      @src_address6        = nil
      @src_port        = [0]
      @recurse = true
      @persistent_udp = false
      @persistent_tcp = false
      @retry_times = 1
      @retry_delay = 0
      @single_resolvers = []
      @configured = false
      @do_caching = true
      @config = Config.new

      if (arg==nil)
        # Get default config
        @config = Config.new
        @config.get_ready
        @server = @config.nameserver[0]
      elsif (arg.kind_of?String)
        @config.get_ready
        @configured= true
        @config.nameserver=[arg]
        @server = @config.nameserver[0]
        #        @server=arg
      elsif (arg.kind_of?Name)
        @config.get_ready
        @configured= true
        @config.nameserver=arg
        @server = @config.nameserver[0]
        #        @server=arg
      elsif (arg.kind_of?Hash)
        arg.keys.each do |attr|
          if (attr == :server)
            @config.get_ready
            @configured= true
            @config.nameserver=[arg[attr]]
            @server = @config.nameserver[0]

          else
            begin
              send(attr.to_s+"=", arg[attr])
            rescue Exception
              Dnsruby.log.error{"Argument #{attr} not valid\n"}
            end
          end
        end
      end

      isr = PacketSender.new({:server=>@server, :dnssec=>@dnssec,
          :use_tcp=>@use_tcp, :no_tcp=>@no_tcp, :packet_timeout=>@packet_timeout,
          :tsig => @tsig, :ignore_truncation=>@ignore_truncation,
          :src_address=>@src_address, :src_address6=>@src_address6, :src_port=>@src_port,
          :recurse=>@recurse, :udp_size=>@udp_size})

      @single_resolvers = [isr]

      #      ResolverRegister::register_single_resolver(self)
    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
    def add_opt_rr(m)
      @single_res_mutex.synchronize {
        @single_resolvers[0].add_opt_rr(m)
      }
    end

packet_timeout=(t) click to toggle source

    # File lib/Dnsruby/SingleResolver.rb, line 161
    def packet_timeout=(t)
      @packet_timeout = t
      @query_timeout = t
    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
    def server
      #      @single_res_mutex.synchronize {
      if (!@configured)
        @config.get_ready
        add_config_nameservers
      end
      return @single_resolvers[0].server
      #      }
    end

server=(s) click to toggle source

    # File lib/Dnsruby/SingleResolver.rb, line 128
    def server=(s)
      if (!@configured)
        @config.get_ready
      end
      @server = Config.resolve_server(s).to_s
      isr = PacketSender.new({:server=>@server, :dnssec=>@dnssec,
          :use_tcp=>@use_tcp, :no_tcp=>@no_tcp, :packet_timeout=>@packet_timeout,
          :tsig => @tsig, :ignore_truncation=>@ignore_truncation,
          :src_address=>@src_address, :src_address6=>@src_address6, :src_port=>@src_port,
          :recurse=>@recurse, :udp_size=>@udp_size})

      @single_res_mutex.synchronize {
        @single_resolvers = [isr]
      }
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.