DwmDns-0.1.0
Dwm::Dns::RRDataLOC Class Reference

Encapsulates LOC resource record data. More...

#include <DwmDnsRRDataLOC.hh>

Inheritance diagram for Dwm::Dns::RRDataLOC:
Collaboration diagram for Dwm::Dns::RRDataLOC:

Public Member Functions

 RRDataLOC ()
 Constructor.
 
 RRDataLOC (uint8_t version, uint8_t size, uint8_t horizontalPrecision, uint8_t verticalPrecision, uint32_t iatitude, uint32_t longitude, uint32_t altitude)
 
bool operator== (const RRDataLOC &loc) const
 
uint8_t Version () const
 Returns the version field. More...
 
uint8_t Version (uint8_t version)
 Sets and returns the version field. More...
 
uint8_t Size () const
 Returns the size field. More...
 
uint8_t Size (uint8_t size)
 Sets and returns the size field. More...
 
uint8_t HorizontalPrecision () const
 Returns the horizontal precision field. More...
 
uint8_t HorizontalPrecision (uint8_t horizontalPrecision)
 Sets and returns the horizontal precision field. More...
 
uint8_t VerticalPrecision () const
 Returns the vertical precision field. More...
 
uint8_t VerticalPrecision (uint8_t verticalPrecision)
 Sets and returns the vertical precision field. More...
 
uint32_t Latitude () const
 Returns the latitude field. More...
 
uint32_t Latitude (uint32_t latitude)
 Sets and returns the latitude field. More...
 
uint32_t Longitude () const
 Returns the longitude field. More...
 
uint32_t Longitude (uint32_t longitude)
 Sets and returns the longitude field. More...
 
uint32_t Altitude () const
 Returns the altitude field. More...
 
uint32_t Altitude (uint32_t altitude)
 Sets and returns the altitude field. More...
 
uint8_t * Encode (uint8_t *pkt, uint8_t *ptr, uint16_t pktlen, LabelPositions &lps) const
 Encodes the LOC resource record data into buffer @ pkt of length pktlen, starting at ptr. More...
 
const uint8_t * Decode (const uint8_t *pkt, const uint8_t *ptr, uint16_t pktlen, uint16_t rdlen)
 Decodes the LOC resource record data from buffer pkt of length pktlen, starting at ptr. More...
 

Static Public Attributes

static const uint16_t k_rrtype = 29
 

Friends

std::ostream & operator<< (std::ostream &os, const RRDataLOC &loc)
 Print the LOC resource record data to an ostream in human readable form. More...
 

Detailed Description

Encapsulates LOC resource record data.

Member Function Documentation

◆ Altitude() [1/2]

uint32_t Dwm::Dns::RRDataLOC::Altitude ( ) const

Returns the altitude field.

From RFC1876:

The altitude of the center of the sphere described by the SIZE field, expressed as a 32-bit integer, most significant octet first (network standard byte order), in centimeters, from a base of 100,000m below the [WGS 84] reference spheroid used by GPS (semimajor axis a=6378137.0, reciprocal flattening rf=298.257223563). Altitude above (or below) sea level may be used as an approximation of altitude relative to the the [WGS 84] spheroid, though due to the Earth's surface not being a perfect spheroid, there will be differences. (For example, the geoid (which sea level approximates) for the continental US ranges from 10 meters to 50 meters below the [WGS 84] spheroid. Adjustments to ALTITUDE and/or VERT PRE will be necessary in most cases. The Defense Mapping Agency publishes geoid height values relative to the [WGS 84] ellipsoid.

◆ Altitude() [2/2]

uint32_t Dwm::Dns::RRDataLOC::Altitude ( uint32_t  altitude)

Sets and returns the altitude field.

From RFC1876:

The altitude of the center of the sphere described by the SIZE field, expressed as a 32-bit integer, most significant octet first (network standard byte order), in centimeters, from a base of 100,000m below the [WGS 84] reference spheroid used by GPS (semimajor axis a=6378137.0, reciprocal flattening rf=298.257223563). Altitude above (or below) sea level may be used as an approximation of altitude relative to the the [WGS 84] spheroid, though due to the Earth's surface not being a perfect spheroid, there will be differences. (For example, the geoid (which sea level approximates) for the continental US ranges from 10 meters to 50 meters below the [WGS 84] spheroid. Adjustments to ALTITUDE and/or VERT PRE will be necessary in most cases. The Defense Mapping Agency publishes geoid height values relative to the [WGS 84] ellipsoid.

◆ Decode()

const uint8_t* Dwm::Dns::RRDataLOC::Decode ( const uint8_t *  pkt,
const uint8_t *  ptr,
uint16_t  pktlen,
uint16_t  rdlen 
)
virtual

Decodes the LOC resource record data from buffer pkt of length pktlen, starting at ptr.

Returns the address immediately following the encoded LOC resource record data in pkt on success. Throws std::out_of_range if pkt was too short to contain an encoded LOC resource record data.

Implements Dwm::Dns::RRData.

◆ Encode()

uint8_t* Dwm::Dns::RRDataLOC::Encode ( uint8_t *  pkt,
uint8_t *  ptr,
uint16_t  pktlen,
LabelPositions lps 
) const
virtual

Encodes the LOC resource record data into buffer @ pkt of length pktlen, starting at ptr.

Returns the address immediately following the encoded LOC resource record data in pkt on success. Throws std::out_of_range if pkt is too short to contain the encoded LOC resource record data.

Implements Dwm::Dns::RRData.

◆ HorizontalPrecision() [1/2]

uint8_t Dwm::Dns::RRDataLOC::HorizontalPrecision ( ) const

Returns the horizontal precision field.

From RFC1876: The horizontal precision of the data, in centimeters, expressed using the same representation as SIZE. This is the diameter of the horizontal "circle of error", rather than a "plus or minus" value. (This was chosen to match the interpretation of SIZE; to get a "plus or minus" value, divide by 2.)

◆ HorizontalPrecision() [2/2]

uint8_t Dwm::Dns::RRDataLOC::HorizontalPrecision ( uint8_t  horizontalPrecision)

Sets and returns the horizontal precision field.

From RFC1876: The horizontal precision of the data, in centimeters, expressed using the same representation as SIZE. This is the diameter of the horizontal "circle of error", rather than a "plus or minus" value. (This was chosen to match the interpretation of SIZE; to get a "plus or minus" value, divide by 2.)

◆ Latitude() [1/2]

uint32_t Dwm::Dns::RRDataLOC::Latitude ( ) const

Returns the latitude field.

From RFC1876:

The latitude of the center of the sphere described by the SIZE field, expressed as a 32-bit integer, most significant octet first (network standard byte order), in thousandths of a second of arc. 2^31 represents the equator; numbers above that are north latitude.

◆ Latitude() [2/2]

uint32_t Dwm::Dns::RRDataLOC::Latitude ( uint32_t  latitude)

Sets and returns the latitude field.

From RFC1876:

The latitude of the center of the sphere described by the SIZE field, expressed as a 32-bit integer, most significant octet first (network standard byte order), in thousandths of a second of arc. 2^31 represents the equator; numbers above that are north latitude.

◆ Longitude() [1/2]

uint32_t Dwm::Dns::RRDataLOC::Longitude ( ) const

Returns the longitude field.

From RFC1876:

The longitude of the center of the sphere described by the SIZE field, expressed as a 32-bit integer, most significant octet first (network standard byte order), in thousandths of a second of arc, rounded away from the prime meridian. 2^31 represents the prime meridian; numbers above that are east longitude.

◆ Longitude() [2/2]

uint32_t Dwm::Dns::RRDataLOC::Longitude ( uint32_t  longitude)

Sets and returns the longitude field.

From RFC1876:

The longitude of the center of the sphere described by the SIZE field, expressed as a 32-bit integer, most significant octet first (network standard byte order), in thousandths of a second of arc, rounded away from the prime meridian. 2^31 represents the prime meridian; numbers above that are east longitude.

◆ Size() [1/2]

uint8_t Dwm::Dns::RRDataLOC::Size ( ) const

Returns the size field.

From RFC1876:

The diameter of a sphere enclosing the described entity, in centimeters, expressed as a pair of four-bit unsigned integers, each ranging from zero to nine, with the most significant four bits representing the base and the second number representing the power of ten by which to multiply the base. This allows sizes from 0e0 (<1cm) to 9e9 (90,000km) to be expressed. This representation was chosen such that the hexadecimal representation can be read by eye; 0x15 = 1e5. Four-bit values greater than 9 are undefined, as are values with a base of zero and a non-zero exponent.

Since 20000000m (represented by the value 0x29) is greater than the equatorial diameter of the WGS 84 ellipsoid (12756274m), it is therefore suitable for use as a "worldwide" size.

◆ Size() [2/2]

uint8_t Dwm::Dns::RRDataLOC::Size ( uint8_t  size)

Sets and returns the size field.

From RFC1876:

The diameter of a sphere enclosing the described entity, in centimeters, expressed as a pair of four-bit unsigned integers, each ranging from zero to nine, with the most significant four bits representing the base and the second number representing the power of ten by which to multiply the base. This allows sizes from 0e0 (<1cm) to 9e9 (90,000km) to be expressed. This representation was chosen such that the hexadecimal representation can be read by eye; 0x15 = 1e5. Four-bit values greater than 9 are undefined, as are values with a base of zero and a non-zero exponent.

Since 20000000m (represented by the value 0x29) is greater than the equatorial diameter of the WGS 84 ellipsoid (12756274m), it is therefore suitable for use as a "worldwide" size.

◆ Version() [1/2]

uint8_t Dwm::Dns::RRDataLOC::Version ( ) const

Returns the version field.

From RFC1876:

Version number of the representation. This must be zero. Implementations are required to check this field and make no assumptions about the format of unrecognized versions.

◆ Version() [2/2]

uint8_t Dwm::Dns::RRDataLOC::Version ( uint8_t  version)

Sets and returns the version field.

From RFC1876:

Version number of the representation. This must be zero. Implementations are required to check this field and make no assumptions about the format of unrecognized versions.

◆ VerticalPrecision() [1/2]

uint8_t Dwm::Dns::RRDataLOC::VerticalPrecision ( ) const

Returns the vertical precision field.

From RFC1876: The vertical precision of the data, in centimeters, expressed using the sane representation as for SIZE. This is the total potential vertical error, rather than a "plus or minus" value. (This was chosen to match the interpretation of SIZE; to get a "plus or minus" value, divide by 2.) Note that if altitude above or below sea level is used as an approximation for altitude relative to the [WGS 84] ellipsoid, the precision value should be adjusted.

◆ VerticalPrecision() [2/2]

uint8_t Dwm::Dns::RRDataLOC::VerticalPrecision ( uint8_t  verticalPrecision)

Sets and returns the vertical precision field.

From RFC1876:

The vertical precision of the data, in centimeters, expressed using the sane representation as for SIZE. This is the total potential vertical error, rather than a "plus or minus" value. (This was chosen to match the interpretation of SIZE; to get a "plus or minus" value, divide by 2.) Note that if altitude above or below sea level is used as an approximation for altitude relative to the [WGS 84] ellipsoid, the precision value should be adjusted.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const RRDataLOC loc 
)
friend

Print the LOC resource record data to an ostream in human readable form.


The documentation for this class was generated from the following file: