123456789_123456789_123456789_123456789_123456789_

Class: Resolv::DNS::Resource::LOC

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: Resolv::DNS::Resource
Defined in: lib/resolv.rb

Overview

Location resource

Constant Summary

::Resolv::DNS::Resource - Inherited

ClassHash, ClassInsensitiveTypes, ClassValue

Class Method Summary

Instance Attribute Summary

  • #altitude readonly

    The altitude of the LOC above a reference sphere whose surface sits 100km below the WGS84 spheroid in centimeters as an unsigned 32bit integer.

  • #hprecision readonly

    The horizontal precision using ssize type values in meters using scientific notation as 2 integers of XeY for precision use value/2 e.g.

  • #latitude readonly

    The latitude for this LOC where 2**31 is the equator in thousandths of an arc second as an unsigned 32bit integer.

  • #longitude readonly

    The longitude for this LOC where 2**31 is the prime meridian in thousandths of an arc second as an unsigned 32bit integer.

  • #ssize readonly

    The spherical size of this LOC in meters using scientific notation as 2 integers of XeY.

  • #version readonly

    Returns the version value for this LOC record which should always be 00.

  • #vprecision readonly

    The vertical precision using ssize type values in meters using scientific notation as 2 integers of XeY for precision use value/2 e.g.

::Resolv::DNS::Resource - Inherited

#ttl

Remaining Time To Live for this ::Resolv::DNS::Resource.

Instance Method Summary

Constructor Details

.new(version, ssize, hprecision, vprecision, latitude, longitude, altitude) ⇒ LOC

[ GitHub ]

  
# File 'lib/resolv.rb', line 2052

def initialize(version, ssize, hprecision, vprecision, latitude, longitude, altitude)
  @version    = version
  @ssize      = Resolv::LOC::Size.create(ssize)
  @hprecision = Resolv::LOC::Size.create(hprecision)
  @vprecision = Resolv::LOC::Size.create(vprecision)
  @latitude   = Resolv::LOC::Coord.create(latitude)
  @longitude  = Resolv::LOC::Coord.create(longitude)
  @altitude   = Resolv::LOC::Alt.create(altitude)
end

Class Method Details

.decode_rdata(msg)

This method is for internal use only.
[ GitHub ]

  
# File 'lib/resolv.rb', line 2116

def self.decode_rdata(msg) # :nodoc:
  version    = msg.get_bytes(1)
  ssize      = msg.get_bytes(1)
  hprecision = msg.get_bytes(1)
  vprecision = msg.get_bytes(1)
  latitude   = msg.get_bytes(4)
  longitude  = msg.get_bytes(4)
  altitude   = msg.get_bytes(4)
  return self.new(
    version,
    Resolv::LOC::Size.new(ssize),
    Resolv::LOC::Size.new(hprecision),
    Resolv::LOC::Size.new(vprecision),
    Resolv::LOC::Coord.new(latitude,"lat"),
    Resolv::LOC::Coord.new(longitude,"lon"),
    Resolv::LOC::Alt.new(altitude)
  )
end

Instance Attribute Details

#altitude (readonly)

The altitude of the LOC above a reference sphere whose surface sits 100km below the WGS84 spheroid in centimeters as an unsigned 32bit integer

[ GitHub ]

  
# File 'lib/resolv.rb', line 2103

attr_reader :altitude

#hprecision (readonly)

The horizontal precision using ssize type values in meters using scientific notation as 2 integers of XeY for precision use value/2 e.g. 2m = +/-1m

[ GitHub ]

  
# File 'lib/resolv.rb', line 2078

attr_reader :hprecision

#latitude (readonly)

The latitude for this LOC where 2**31 is the equator in thousandths of an arc second as an unsigned 32bit integer

[ GitHub ]

  
# File 'lib/resolv.rb', line 2091

attr_reader :latitude

#longitude (readonly)

The longitude for this LOC where 2**31 is the prime meridian in thousandths of an arc second as an unsigned 32bit integer

[ GitHub ]

  
# File 'lib/resolv.rb', line 2097

attr_reader :longitude

#ssize (readonly)

The spherical size of this LOC in meters using scientific notation as 2 integers of XeY

[ GitHub ]

  
# File 'lib/resolv.rb', line 2071

attr_reader :ssize

#version (readonly)

Returns the version value for this LOC record which should always be 00

[ GitHub ]

  
# File 'lib/resolv.rb', line 2065

attr_reader :version

#vprecision (readonly)

The vertical precision using ssize type values in meters using scientific notation as 2 integers of XeY for precision use value/2 e.g. 2m = +/-1m

[ GitHub ]

  
# File 'lib/resolv.rb', line 2085

attr_reader :vprecision

Instance Method Details

#encode_rdata(msg)

This method is for internal use only.
[ GitHub ]

  
# File 'lib/resolv.rb', line 2106

def encode_rdata(msg) # :nodoc:
  msg.put_bytes(@version)
  msg.put_bytes(@ssize.scalar)
  msg.put_bytes(@hprecision.scalar)
  msg.put_bytes(@vprecision.scalar)
  msg.put_bytes(@latitude.coordinates)
  msg.put_bytes(@longitude.coordinates)
  msg.put_bytes(@altitude.altitude)
end