Class: Dnsruby::RR::IPSECKEY

### Home Classes Methods

### In Files

- lib/Dnsruby/resource/IPSECKEY.rb

### Parent

Dnsruby::RR

### Methods

- #from_hash
- #from_string
- #load_gateway_from_string
- #public_key_from_string
- #public_key_string

### 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::RR::IPSECKEY

### Attributes

algorithm[RW]

The algorithm used by this key :

    0 - no key present
    1 - DSA key present
    2 - RSA key present

gateway[RW]

The gateway. May either be a 32-bit network order IPv4 address, or a 128-bit IPv6 address, or a domain name, or may not be present.

gateway_type[RW]

Specifies the type of gateway :

    0 - no gateway present
    1 - 4 byte IPv4 address present
    2 - 16 byte IPv6 address present
    3 - wire-encoded domain name present

precedence[RW]

An 8-bit precedence for this field. Lower values are preferred.

### Public Instance Methods

from_hash(hash) click to toggle source

    # File lib/Dnsruby/resource/IPSECKEY.rb, line 53
    def from_hash(hash)
      @precedence = hash[:precedence]
      @gateway_type = hash[:gateway_type]
      @algorithm = hash[:algorithm]
      @gateway = load_gateway_from_string(@gateway_type, hash[:gateway])
      @public_key = hash[:public_key]
    end

from_string(input) click to toggle source

    # File lib/Dnsruby/resource/IPSECKEY.rb, line 88
    def from_string(input)
      if (input.length > 0)
        split = input.split(" ")

        @precedence = split[0].to_i
        @gateway_type = split[1].to_i
        @algorithm = split[2].to_i

        @gateway = load_gateway_from_string(@gateway_type, split[3])

        @public_key = public_key_from_string(split[4])
      end
    end

load_gateway_from_string(gateway_type, s) click to toggle source

    # File lib/Dnsruby/resource/IPSECKEY.rb, line 61
    def load_gateway_from_string(gateway_type, s)
      gateway = nil
      if (gateway_type == 0)
        gateway = nil
      elsif (gateway_type == 1)
        # Load IPv4 gateway
        gateway = IPv4.create(s)
      elsif (gateway_type == 2)
        # Load IPv6 gateway
        gateway = IPv6.create(s)
      else
        # Load gateway domain name
        gateway = Name.create(s)
      end
      return gateway
    end

public_key_from_string(key_text) click to toggle source

    # File lib/Dnsruby/resource/IPSECKEY.rb, line 82
    def public_key_from_string(key_text)
      key_text.gsub!(/\n/, "")
      key_text.gsub!(/ /, "")
      return key_text.unpack("m*")[0]
    end

public_key_string() click to toggle source

    # File lib/Dnsruby/resource/IPSECKEY.rb, line 78
    def public_key_string
      [@public_key.to_s].pack("m*").gsub("\n", "")
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.