7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyNetwork Working Group C. Davis
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyRequest for Comments: 1876 Kapor Enterprises
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyUpdates: 1034, 1035 P. Vixie
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyCategory: Experimental Vixie Enterprises
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley T. Goodwin
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley FORE Systems
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley I. Dickinson
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley University of Warwick
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley January 1996
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley A Means for Expressing Location Information in the Domain Name System
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyStatus of this Memo
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley This memo defines an Experimental Protocol for the Internet
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley community. This memo does not specify an Internet standard of any
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley kind. Discussion and suggestions for improvement are requested.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Distribution of this memo is unlimited.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley1. Abstract
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley This memo defines a new DNS RR type for experimental purposes. This
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley RFC describes a mechanism to allow the DNS to carry location
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley information about hosts, networks, and subnets. Such information for
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley a small subset of hosts is currently contained in the flat-file UUCP
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley maps. However, just as the DNS replaced the use of HOSTS.TXT to
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley carry host and network address information, it is possible to replace
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley the UUCP maps as carriers of location information.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley This RFC defines the format of a new Resource Record (RR) for the
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Domain Name System (DNS), and reserves a corresponding DNS type
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley mnemonic (LOC) and numerical code (29).
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley This RFC assumes that the reader is familiar with the DNS [RFC 1034,
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley RFC 1035]. The data shown in our examples is for pedagogical use and
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley does not necessarily reflect the real Internet.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyDavis, et al Experimental [Page 1]
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyRFC 1876 Location Information in the DNS January 1996
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley2. RDATA Format
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley MSB LSB
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley 0| VERSION | SIZE |
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley 2| HORIZ PRE | VERT PRE |
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley 4| LATITUDE |
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley 6| LATITUDE |
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley 8| LONGITUDE |
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley 10| LONGITUDE |
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley 12| ALTITUDE |
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley 14| ALTITUDE |
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley (octet)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halleywhere:
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyVERSION Version number of the representation. This must be zero.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Implementations are required to check this field and make
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley no assumptions about the format of unrecognized versions.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleySIZE The diameter of a sphere enclosing the described entity, in
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley centimeters, expressed as a pair of four-bit unsigned
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley integers, each ranging from zero to nine, with the most
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley significant four bits representing the base and the second
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley number representing the power of ten by which to multiply
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley the base. This allows sizes from 0e0 (<1cm) to 9e9
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley (90,000km) to be expressed. This representation was chosen
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley such that the hexadecimal representation can be read by
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley eye; 0x15 = 1e5. Four-bit values greater than 9 are
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley undefined, as are values with a base of zero and a non-zero
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley exponent.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Since 20000000m (represented by the value 0x29) is greater
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley than the equatorial diameter of the WGS 84 ellipsoid
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley (12756274m), it is therefore suitable for use as a
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley "worldwide" size.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyHORIZ PRE The horizontal precision of the data, in centimeters,
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley expressed using the same representation as SIZE. This is
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley the diameter of the horizontal "circle of error", rather
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyDavis, et al Experimental [Page 2]
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyRFC 1876 Location Information in the DNS January 1996
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley than a "plus or minus" value. (This was chosen to match
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley the interpretation of SIZE; to get a "plus or minus" value,
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley divide by 2.)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyVERT PRE The vertical precision of the data, in centimeters,
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley expressed using the sane representation as for SIZE. This
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley is the total potential vertical error, rather than a "plus
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley or minus" value. (This was chosen to match the
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley interpretation of SIZE; to get a "plus or minus" value,
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley divide by 2.) Note that if altitude above or below sea
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley level is used as an approximation for altitude relative to
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley the [WGS 84] ellipsoid, the precision value should be
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley adjusted.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyLATITUDE The latitude of the center of the sphere described by the
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley SIZE field, expressed as a 32-bit integer, most significant
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley octet first (network standard byte order), in thousandths
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley of a second of arc. 2^31 represents the equator; numbers
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley above that are north latitude.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyLONGITUDE The longitude of the center of the sphere described by the
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley SIZE field, expressed as a 32-bit integer, most significant
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley octet first (network standard byte order), in thousandths
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley of a second of arc, rounded away from the prime meridian.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley 2^31 represents the prime meridian; numbers above that are
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley east longitude.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyALTITUDE The altitude of the center of the sphere described by the
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley SIZE field, expressed as a 32-bit integer, most significant
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley octet first (network standard byte order), in centimeters,
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley from a base of 100,000m below the [WGS 84] reference
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley spheroid used by GPS (semimajor axis a=6378137.0,
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley reciprocal flattening rf=298.257223563). Altitude above
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley (or below) sea level may be used as an approximation of
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley altitude relative to the the [WGS 84] spheroid, though due
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley to the Earth's surface not being a perfect spheroid, there
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley will be differences. (For example, the geoid (which sea
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley level approximates) for the continental US ranges from 10
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley meters to 50 meters below the [WGS 84] spheroid.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Adjustments to ALTITUDE and/or VERT PRE will be necessary
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley in most cases. The Defense Mapping Agency publishes geoid
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley height values relative to the [WGS 84] ellipsoid.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyDavis, et al Experimental [Page 3]
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyRFC 1876 Location Information in the DNS January 1996
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley3. Master File Format
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley The LOC record is expressed in a master file in the following format:
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley <owner> <TTL> <class> LOC ( d1 [m1 [s1]] {"N"|"S"} d2 [m2 [s2]]
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley {"E"|"W"} alt["m"] [siz["m"] [hp["m"]
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley [vp["m"]]]] )
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley (The parentheses are used for multi-line data as specified in [RFC
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley 1035] section 5.1.)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley where:
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley d1: [0 .. 90] (degrees latitude)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley d2: [0 .. 180] (degrees longitude)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley m1, m2: [0 .. 59] (minutes latitude/longitude)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley s1, s2: [0 .. 59.999] (seconds latitude/longitude)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley alt: [-100000.00 .. 42849672.95] BY .01 (altitude in meters)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley siz, hp, vp: [0 .. 90000000.00] (size/precision in meters)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley If omitted, minutes and seconds default to zero, size defaults to 1m,
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley horizontal precision defaults to 10000m, and vertical precision
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley defaults to 10m. These defaults are chosen to represent typical
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley ZIP/postal code area sizes, since it is often easy to find
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley approximate geographical location by ZIP/postal code.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley4. Example Data
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley;;;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley;;; note that these data would not all appear in one zone file
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley;;;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley;; network LOC RR derived from ZIP data. note use of precision defaults
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halleycambridge-net.kei.com. LOC 42 21 54 N 71 06 18 W -24m 30m
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley;; higher-precision host LOC RR. note use of vertical precision default
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halleyloiosh.kei.com. LOC 42 21 43.952 N 71 5 6.344 W
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley -24m 1m 200m
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halleypipex.net. LOC 52 14 05 N 00 08 50 E 10m
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halleycurtin.edu.au. LOC 32 7 19 S 116 2 25 E 10m
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halleyrwy04L.logan-airport.boston. LOC 42 21 28.764 N 71 00 51.617 W
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley -44m 2000m
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyDavis, et al Experimental [Page 4]
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyRFC 1876 Location Information in the DNS January 1996
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley5. Application use of the LOC RR
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley5.1 Suggested Uses
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Some uses for the LOC RR have already been suggested, including the
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley USENET backbone flow maps, a "visual traceroute" application showing
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley the geographical path of an IP packet, and network management
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley applications that could use LOC RRs to generate a map of hosts and
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley routers being managed.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley5.2 Search Algorithms
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley This section specifies how to use the DNS to translate domain names
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley and/or IP addresses into location information.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley If an application wishes to have a "fallback" behavior, displaying a
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley less precise or larger area when a host does not have an associated
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley LOC RR, it MAY support use of the algorithm in section 5.2.3, as
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley noted in sections 5.2.1 and 5.2.2. If fallback is desired, this
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley behaviour is the RECOMMENDED default, but in some cases it may need
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley to be modified based on the specific requirements of the application
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley involved.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley This search algorithm is designed to allow network administrators to
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley specify the location of a network or subnet without requiring LOC RR
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley data for each individual host. For example, a computer lab with 24
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley workstations, all of which are on the same subnet and in basically
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley the same location, would only need a LOC RR for the subnet.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley (However, if the file server's location has been more precisely
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley measured, a separate LOC RR for it can be placed in the DNS.)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley5.2.1 Searching by Name
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley If the application is beginning with a name, rather than an IP
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley address (as the USENET backbone flow maps do), it MUST check for a
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley LOC RR associated with that name. (CNAME records should be followed
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley as for any other RR type.)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley If there is no LOC RR for that name, all A records (if any)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley associated with the name MAY be checked for network (or subnet) LOC
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley RRs using the "Searching by Network or Subnet" algorithm (5.2.3). If
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley multiple A records exist and have associated network or subnet LOC
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley RRs, the application may choose to use any, some, or all of the LOC
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley RRs found, possibly in combination. It is suggested that multi-homed
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley hosts have LOC RRs for their name in the DNS to avoid any ambiguity
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley in these cases.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyDavis, et al Experimental [Page 5]
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyRFC 1876 Location Information in the DNS January 1996
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Note that domain names that do not have associated A records must
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley have a LOC RR associated with their name in order for location
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley information to be accessible.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley5.2.2 Searching by Address
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley If the application is beginning with an IP address (as a "visual
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley traceroute" application might be) it MUST first map the address to a
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley name using the IN-ADDR.ARPA namespace (see [RFC 1034], section
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley 5.2.1), then check for a LOC RR associated with that name.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley If there is no LOC RR for the name, the address MAY be checked for
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley network (or subnet) LOC RRs using the "Searching by Network or
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Subnet" algorithm (5.2.3).
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley5.2.3 Searching by Network or Subnet
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Even if a host's name does not have any associated LOC RRs, the
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley network(s) or subnet(s) it is on may. If the application wishes to
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley search for such less specific data, the following algorithm SHOULD be
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley followed to find a network or subnet LOC RR associated with the IP
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley address. This algorithm is adapted slightly from that specified in
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley [RFC 1101], sections 4.3 and 4.4.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Since subnet LOC RRs are (if present) more specific than network LOC
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley RRs, it is best to use them if available. In order to do so, we
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley build a stack of network and subnet names found while performing the
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley [RFC 1101] search, then work our way down the stack until a LOC RR is
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley found.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley 1. create a host-zero address using the network portion of the IP
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley address (one, two, or three bytes for class A, B, or C networks,
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley respectively). For example, for the host 128.9.2.17, on the class
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley B network 128.9, this would result in the address "128.9.0.0".
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley 2. Reverse the octets, suffix IN-ADDR.ARPA, and query for PTR and A
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley records. Retrieve:
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley 0.0.9.128.IN-ADDR.ARPA. PTR isi-net.isi.edu.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley A 255.255.255.0
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Push the name "isi-net.isi.edu" onto the stack of names to be
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley searched for LOC RRs later.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyDavis, et al Experimental [Page 6]
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyRFC 1876 Location Information in the DNS January 1996
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley 3. Since an A RR was found, repeat using mask from RR
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley (255.255.255.0), constructing a query for 0.2.9.128.IN-ADDR.ARPA.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Retrieve:
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley 0.2.9.128.IN-ADDR.ARPA. PTR div2-subnet.isi.edu.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley A 255.255.255.240
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Push the name "div2-subnet.isi.edu" onto the stack of names to be
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley searched for LOC RRs later.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley 4. Since another A RR was found, repeat using mask 255.255.255.240
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley (x'FFFFFFF0'), constructing a query for 16.2.9.128.IN-ADDR.ARPA.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Retrieve:
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley 16.2.9.128.IN-ADDR.ARPA. PTR inc-subsubnet.isi.edu.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Push the name "inc-subsubnet.isi.edu" onto the stack of names to
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley be searched for LOC RRs later.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley 5. Since no A RR is present at 16.2.9.128.IN-ADDR.ARPA., there are no
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley more subnet levels to search. We now pop the top name from the
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley stack and check for an associated LOC RR. Repeat until a LOC RR
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley is found.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley In this case, assume that inc-subsubnet.isi.edu does not have an
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley associated LOC RR, but that div2-subnet.isi.edu does. We will
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley then use div2-subnet.isi.edu's LOC RR as an approximation of this
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley host's location. (Note that even if isi-net.isi.edu has a LOC RR,
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley it will not be used if a subnet also has a LOC RR.)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley5.3 Applicability to non-IN Classes and non-IP Addresses
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley The LOC record is defined for all RR classes, and may be used with
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley non-IN classes such as HS and CH. The semantics of such use are not
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley defined by this memo.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley The search algorithm in section 5.2.3 may be adapted to other
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley addressing schemes by extending [RFC 1101]'s encoding of network
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley names to cover those schemes. Such extensions are not defined by
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley this memo.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyDavis, et al Experimental [Page 7]
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyRFC 1876 Location Information in the DNS January 1996
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley6. References
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley [RFC 1034] Mockapetris, P., "Domain Names - Concepts and Facilities",
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley STD 13, RFC 1034, USC/Information Sciences Institute,
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley November 1987.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley [RFC 1035] Mockapetris, P., "Domain Names - Implementation and
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Specification", STD 13, RFC 1035, USC/Information Sciences
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Institute, November 1987.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley [RFC 1101] Mockapetris, P., "DNS Encoding of Network Names and Other
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Types", RFC 1101, USC/Information Sciences Institute,
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley April 1989.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley [WGS 84] United States Department of Defense; DoD WGS-1984 - Its
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Definition and Relationships with Local Geodetic Systems;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Washington, D.C.; 1985; Report AD-A188 815 DMA; 6127; 7-R-
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley 138-R; CV, KV;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley7. Security Considerations
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley High-precision LOC RR information could be used to plan a penetration
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley of physical security, leading to potential denial-of-machine attacks.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley To avoid any appearance of suggesting this method to potential
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley attackers, we declined the opportunity to name this RR "ICBM".
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley8. Authors' Addresses
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley The authors as a group can be reached as <loc@pipex.net>.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Christopher Davis
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Kapor Enterprises, Inc.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley 238 Main Street, Suite 400
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Cambridge, MA 02142
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Phone: +1 617 576 4532
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley EMail: ckd@kei.com
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Paul Vixie
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Vixie Enterprises
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Star Route Box 159A
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Woodside, CA 94062
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Phone: +1 415 747 0204
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley EMail: paul@vix.com
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyDavis, et al Experimental [Page 8]
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyRFC 1876 Location Information in the DNS January 1996
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Tim Goodwin
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Public IP Exchange Ltd (PIPEX)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley 216 The Science Park
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Cambridge CB4 4WA
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley UK
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Phone: +44 1223 250250
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley EMail: tim@pipex.net
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Ian Dickinson
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley FORE Systems
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley 2475 The Crescent
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Solihull Parkway
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Birmingham Business Park
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley B37 7YE
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley UK
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley Phone: +44 121 717 4444
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley EMail: idickins@fore.co.uk
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyDavis, et al Experimental [Page 9]
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyRFC 1876 Location Information in the DNS January 1996
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyAppendix A: Sample Conversion Routines
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley/*
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley * routines to convert between on-the-wire RR format and zone file
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley * format. Does not contain conversion to/from decimal degrees;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley * divide or multiply by 60*60*1000 for that.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley */
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halleystatic unsigned int poweroften[10] = {1, 10, 100, 1000, 10000, 100000,
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley 1000000,10000000,100000000,1000000000};
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley/* takes an XeY precision/size value, returns a string representation.*/
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halleystatic const char *
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halleyprecsize_ntoa(prec)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley u_int8_t prec;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley{
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley static char retbuf[sizeof("90000000.00")];
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley unsigned long val;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley int mantissa, exponent;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley mantissa = (int)((prec >> 4) & 0x0f) % 10;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley exponent = (int)((prec >> 0) & 0x0f) % 10;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley val = mantissa * poweroften[exponent];
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley (void) sprintf(retbuf,"%d.%.2d", val/100, val%100);
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley return (retbuf);
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley}
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley/* converts ascii size/precision X * 10**Y(cm) to 0xXY. moves pointer.*/
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halleystatic u_int8_t
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halleyprecsize_aton(strptr)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley char **strptr;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley{
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley unsigned int mval = 0, cmval = 0;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley u_int8_t retval = 0;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley register char *cp;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley register int exponent;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley register int mantissa;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley cp = *strptr;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley while (isdigit(*cp))
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley mval = mval * 10 + (*cp++ - '0');
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley if (*cp == '.') { /* centimeters */
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley cp++;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley if (isdigit(*cp)) {
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyDavis, et al Experimental [Page 10]
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyRFC 1876 Location Information in the DNS January 1996
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley cmval = (*cp++ - '0') * 10;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley if (isdigit(*cp)) {
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley cmval += (*cp++ - '0');
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley }
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley }
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley }
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley cmval = (mval * 100) + cmval;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley for (exponent = 0; exponent < 9; exponent++)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley if (cmval < poweroften[exponent+1])
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley break;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley mantissa = cmval / poweroften[exponent];
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley if (mantissa > 9)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley mantissa = 9;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley retval = (mantissa << 4) | exponent;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley *strptr = cp;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley return (retval);
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley}
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley/* converts ascii lat/lon to unsigned encoded 32-bit number.
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley * moves pointer. */
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halleystatic u_int32_t
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halleylatlon2ul(latlonstrptr,which)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley char **latlonstrptr;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley int *which;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley{
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley register char *cp;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley u_int32_t retval;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley int deg = 0, min = 0, secs = 0, secsfrac = 0;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley cp = *latlonstrptr;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley while (isdigit(*cp))
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley deg = deg * 10 + (*cp++ - '0');
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley while (isspace(*cp))
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley cp++;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley if (!(isdigit(*cp)))
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley goto fndhemi;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley while (isdigit(*cp))
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley min = min * 10 + (*cp++ - '0');
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyDavis, et al Experimental [Page 11]
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyRFC 1876 Location Information in the DNS January 1996
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley while (isspace(*cp))
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley cp++;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley if (!(isdigit(*cp)))
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley goto fndhemi;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley while (isdigit(*cp))
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley secs = secs * 10 + (*cp++ - '0');
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley if (*cp == '.') { /* decimal seconds */
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley cp++;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley if (isdigit(*cp)) {
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley secsfrac = (*cp++ - '0') * 100;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley if (isdigit(*cp)) {
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley secsfrac += (*cp++ - '0') * 10;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley if (isdigit(*cp)) {
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley secsfrac += (*cp++ - '0');
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley }
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley }
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley }
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley }
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley while (!isspace(*cp)) /* if any trailing garbage */
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley cp++;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley while (isspace(*cp))
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley cp++;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley fndhemi:
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley switch (*cp) {
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley case 'N': case 'n':
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley case 'E': case 'e':
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley retval = ((unsigned)1<<31)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley + (((((deg * 60) + min) * 60) + secs) * 1000)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley + secsfrac;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley break;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley case 'S': case 's':
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley case 'W': case 'w':
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley retval = ((unsigned)1<<31)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley - (((((deg * 60) + min) * 60) + secs) * 1000)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley - secsfrac;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley break;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley default:
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley retval = 0; /* invalid value -- indicates error */
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley break;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley }
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley switch (*cp) {
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyDavis, et al Experimental [Page 12]
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyRFC 1876 Location Information in the DNS January 1996
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley case 'N': case 'n':
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley case 'S': case 's':
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley *which = 1; /* latitude */
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley break;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley case 'E': case 'e':
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley case 'W': case 'w':
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley *which = 2; /* longitude */
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley break;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley default:
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley *which = 0; /* error */
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley break;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley }
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley cp++; /* skip the hemisphere */
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley while (!isspace(*cp)) /* if any trailing garbage */
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley cp++;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley while (isspace(*cp)) /* move to next field */
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley cp++;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley *latlonstrptr = cp;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley return (retval);
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley}
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley/* converts a zone file representation in a string to an RDATA
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley * on-the-wire representation. */
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halleyu_int32_t
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halleyloc_aton(ascii, binary)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley const char *ascii;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley u_char *binary;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley{
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley const char *cp, *maxcp;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley u_char *bcp;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley u_int32_t latit = 0, longit = 0, alt = 0;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley u_int32_t lltemp1 = 0, lltemp2 = 0;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley int altmeters = 0, altfrac = 0, altsign = 1;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley u_int8_t hp = 0x16; /* default = 1e6 cm = 10000.00m = 10km */
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley u_int8_t vp = 0x13; /* default = 1e3 cm = 10.00m */
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley u_int8_t siz = 0x12; /* default = 1e2 cm = 1.00m */
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley int which1 = 0, which2 = 0;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley cp = ascii;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley maxcp = cp + strlen(ascii);
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley lltemp1 = latlon2ul(&cp, &which1);
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyDavis, et al Experimental [Page 13]
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyRFC 1876 Location Information in the DNS January 1996
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley lltemp2 = latlon2ul(&cp, &which2);
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley switch (which1 + which2) {
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley case 3: /* 1 + 2, the only valid combination */
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley if ((which1 == 1) && (which2 == 2)) { /* normal case */
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley latit = lltemp1;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley longit = lltemp2;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley } else if ((which1 == 2) && (which2 == 1)) {/*reversed*/
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley longit = lltemp1;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley latit = lltemp2;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley } else { /* some kind of brokenness */
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley return 0;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley }
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley break;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley default: /* we didn't get one of each */
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley return 0;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley }
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley /* altitude */
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley if (*cp == '-') {
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley altsign = -1;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley cp++;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley }
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley if (*cp == '+')
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley cp++;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley while (isdigit(*cp))
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley altmeters = altmeters * 10 + (*cp++ - '0');
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley if (*cp == '.') { /* decimal meters */
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley cp++;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley if (isdigit(*cp)) {
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley altfrac = (*cp++ - '0') * 10;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley if (isdigit(*cp)) {
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley altfrac += (*cp++ - '0');
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley }
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley }
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley }
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley alt = (10000000 + (altsign * (altmeters * 100 + altfrac)));
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley while (!isspace(*cp) && (cp < maxcp))
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley /* if trailing garbage or m */
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley cp++;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley while (isspace(*cp) && (cp < maxcp))
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley cp++;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyDavis, et al Experimental [Page 14]
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyRFC 1876 Location Information in the DNS January 1996
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley if (cp >= maxcp)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley goto defaults;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley siz = precsize_aton(&cp);
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley while (!isspace(*cp) && (cp < maxcp))/*if trailing garbage or m*/
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley cp++;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley while (isspace(*cp) && (cp < maxcp))
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley cp++;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley if (cp >= maxcp)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley goto defaults;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley hp = precsize_aton(&cp);
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley while (!isspace(*cp) && (cp < maxcp))/*if trailing garbage or m*/
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley cp++;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley while (isspace(*cp) && (cp < maxcp))
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley cp++;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley if (cp >= maxcp)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley goto defaults;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley vp = precsize_aton(&cp);
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley defaults:
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley bcp = binary;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley *bcp++ = (u_int8_t) 0; /* version byte */
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley *bcp++ = siz;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley *bcp++ = hp;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley *bcp++ = vp;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley PUTLONG(latit,bcp);
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley PUTLONG(longit,bcp);
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley PUTLONG(alt,bcp);
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley return (16); /* size of RR in octets */
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley}
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley/* takes an on-the-wire LOC RR and prints it in zone file
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley * (human readable) format. */
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halleychar *
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halleyloc_ntoa(binary,ascii)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley const u_char *binary;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley char *ascii;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley{
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyDavis, et al Experimental [Page 15]
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyRFC 1876 Location Information in the DNS January 1996
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley static char tmpbuf[255*3];
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley register char *cp;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley register const u_char *rcp;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley int latdeg, latmin, latsec, latsecfrac;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley int longdeg, longmin, longsec, longsecfrac;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley char northsouth, eastwest;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley int altmeters, altfrac, altsign;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley const int referencealt = 100000 * 100;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley int32_t latval, longval, altval;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley u_int32_t templ;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley u_int8_t sizeval, hpval, vpval, versionval;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley char *sizestr, *hpstr, *vpstr;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley rcp = binary;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley if (ascii)
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley cp = ascii;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley else {
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley cp = tmpbuf;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley }
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley versionval = *rcp++;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley if (versionval) {
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley sprintf(cp,"; error: unknown LOC RR version");
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley return (cp);
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley }
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley sizeval = *rcp++;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley hpval = *rcp++;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley vpval = *rcp++;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley GETLONG(templ,rcp);
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley latval = (templ - ((unsigned)1<<31));
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley GETLONG(templ,rcp);
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley longval = (templ - ((unsigned)1<<31));
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley GETLONG(templ,rcp);
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley if (templ < referencealt) { /* below WGS 84 spheroid */
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley altval = referencealt - templ;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley altsign = -1;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley } else {
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyDavis, et al Experimental [Page 16]
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyRFC 1876 Location Information in the DNS January 1996
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley altval = templ - referencealt;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley altsign = 1;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley }
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley if (latval < 0) {
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley northsouth = 'S';
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley latval = -latval;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley }
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley else
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley northsouth = 'N';
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley latsecfrac = latval % 1000;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley latval = latval / 1000;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley latsec = latval % 60;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley latval = latval / 60;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley latmin = latval % 60;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley latval = latval / 60;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley latdeg = latval;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley if (longval < 0) {
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley eastwest = 'W';
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley longval = -longval;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley }
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley else
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley eastwest = 'E';
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley longsecfrac = longval % 1000;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley longval = longval / 1000;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley longsec = longval % 60;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley longval = longval / 60;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley longmin = longval % 60;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley longval = longval / 60;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley longdeg = longval;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley altfrac = altval % 100;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley altmeters = (altval / 100) * altsign;
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley sizestr = savestr(precsize_ntoa(sizeval));
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley hpstr = savestr(precsize_ntoa(hpval));
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley vpstr = savestr(precsize_ntoa(vpval));
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley sprintf(cp,
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley "%d %.2d %.2d.%.3d %c %d %.2d %.2d.%.3d %c %d.%.2dm
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley %sm %sm %sm",
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley latdeg, latmin, latsec, latsecfrac, northsouth,
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley longdeg, longmin, longsec, longsecfrac, eastwest,
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley altmeters, altfrac, sizestr, hpstr, vpstr);
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyDavis, et al Experimental [Page 17]
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyRFC 1876 Location Information in the DNS January 1996
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley free(sizestr);
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley free(hpstr);
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley free(vpstr);
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley return (cp);
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley}
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob HalleyDavis, et al Experimental [Page 18]
7e6c9a9a733f7a57ace98e4692573f42a2cad0edBob Halley