Network Working Group                                      M.M. Mealling
Internet-Draft                                   Network Solutions, Inc.
Expires: January 12, 2001                                  July 14, 2000


      URI Resolution using the Dynamic Delegation Discovery System
                   draft-ietf-urn-uri-res-ddds-00.txt

Status of this Memo

   This document is an Internet-Draft and is in full conformance with
   all provisions of Section 10 of RFC2026.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF), its areas, and its working groups. Note that
   other groups may also distribute working documents as
   Internet-Drafts.

   Internet-Drafts are draft documents valid for a maximum of six
   months and may be updated, replaced, or obsoleted by other documents
   at any time. It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

     The list of current Internet-Drafts can be accessed at
     http://www.ietf.org/ietf/1id-abstracts.txt

     The list of Internet-Draft Shadow Directories can be accessed at
     http://www.ietf.org/shadow.html.


   This Internet-Draft will expire on January 12, 2001.

Copyright Notice

   Copyright (C) The Internet Society (2000). All Rights Reserved.

Abstract

   A specification for taking a URI and locating an authoritative
   server for information about that URI. The method used to locate
   that authoritative server is the Dynamic Delegation Discovery
   System.

   This document, along with [10] and [9], obsoletes RFC 2168[12] and
   updates RFC 2276[8].











Mealling                Expires January 12, 2001                [Page 1]


Internet-Draft         DDDS Based URI Resolution               July 2000


Table of Contents

   1.    Introduction . . . . . . . . . . . . . . . . . . . . . . . .  3
   2.    Terminology  . . . . . . . . . . . . . . . . . . . . . . . .  4
   3.    The Distinction between URNs and URLs  . . . . . . . . . . .  5
   4.    The URI and URN Resolution Application Specifications  . . .  6
   4.1   Application Unique String  . . . . . . . . . . . . . . . . .  6
   4.2   First Well Known Rule  . . . . . . . . . . . . . . . . . . .  6
   4.3   Flags  . . . . . . . . . . . . . . . . . . . . . . . . . . .  6
   4.4   Services Parameters  . . . . . . . . . . . . . . . . . . . .  7
   4.4.1 Services . . . . . . . . . . . . . . . . . . . . . . . . . .  7
   4.4.2 protocols  . . . . . . . . . . . . . . . . . . . . . . . . .  8
   4.5   Valid Databases  . . . . . . . . . . . . . . . . . . . . . .  8
   5.    Examples . . . . . . . . . . . . . . . . . . . . . . . . . .  9
   5.1   An example using a URN . . . . . . . . . . . . . . . . . . .  9
   5.2   CID URI Scheme Example . . . . . . . . . . . . . . . . . . . 10
   5.3   Resolving an HTTP URI Scheme . . . . . . . . . . . . . . . . 12
   6.    Notes  . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
   7.    IANA Considerations  . . . . . . . . . . . . . . . . . . . . 15
   8.    Security Considerations  . . . . . . . . . . . . . . . . . . 16
   9.    Acknowledgments  . . . . . . . . . . . . . . . . . . . . . . 17
         References . . . . . . . . . . . . . . . . . . . . . . . . . 18
         Author's Address . . . . . . . . . . . . . . . . . . . . . . 19
   A.    Pseudo Code  . . . . . . . . . . . . . . . . . . . . . . . . 20
         Full Copyright Statement . . . . . . . . . . . . . . . . . . 23


























Mealling                Expires January 12, 2001                [Page 2]


Internet-Draft         DDDS Based URI Resolution               July 2000


1. Introduction

   Uniform Resource Locators have been a significant advance in
   retrieving Internet-accessible resources. However, their  brittle
   nature over time has been recognized for several years. The Uniform
   Resource Identifier working group proposed the development of
   Uniform Resource Names[3] to serve as persistent,
   location-independent identifiers for Internet resources in order to
   overcome most of the problems with URLs. RFC 1737[1] sets forth
   requirements on URNs.

   During the lifetime of the URI-WG, a number of URN proposals were
   generated. The developers of several of those proposals met in a
   series of meetings, resulting in a compromise known as the Knoxville
   framework.  The major principle behind the Knoxville framework is
   that the resolution system must be separate from the way names are
   assigned. This is in marked contrast to most URLs, which identify
   the host to contact and the protocol to use. Readers are referred to
   [2]for background on the Knoxville framework and for additional
   information on the context and purpose of this proposal.

   Separating the way names are resolved from the way they are
   constructed provides several benefits. It allows multiple naming
   approaches and resolution approaches to compete, as it allows
   different protocols and resolvers to be used. There is just one
   problem with such a separation - how do we resolve a name when it
   can't give us directions to its resolver?

   For the short term, DNS is the obvious candidate for the resolution
   framework, since it is widely deployed and understood. However, it
   is not appropriate to use DNS to maintain information on a
   per-resource basis. First of all, DNS was never intended to handle
   that many records. Second, the limited record size is inappropriate
   for catalog information. Third, domain names are not appropriate as
   URNs.

   Therefore our approach is to use the DDDS to locate "resolvers" that
   can provide information on individual resources, potentially
   including the resource itself. To accomplish this, we "rewrite" the
   URI into a Key following the rules found in the Dynamic Delegation
   Discovery System (DDDS). This document describes URI Resolution as
   an application of the DDDS and specifies the use of at least one
   Database based on DNS.

   This document, along with [10] and [9], obsoletes RFC 2168[12] and
   updates RFC 2276[8].





Mealling                Expires January 12, 2001                [Page 3]


Internet-Draft         DDDS Based URI Resolution               July 2000


2. Terminology

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED",  "MAY", and "OPTIONAL" in
   this document are to be interpreted as described in RFC 2119.

   All capitalized terms are taken from the vocabulary found in the
   DDDS algorithm specification found in [9].











































Mealling                Expires January 12, 2001                [Page 4]


Internet-Draft         DDDS Based URI Resolution               July 2000


3. The Distinction between URNs and URLs

   From the point of view of this system, there is no theoretical
   difference between resolving URIs in the general case and URNs in
   the specific case. Operationally however, there is a difference that
   stems from URI resolution possibly not becoming of widespread use.
   If URN resolution is collapsed into generic URI resolution, URNs may
   suffer by the lack of adoption of URI resolution.

   The solution is to allow for shortcutting for URN resolution. In the
   following specification generic URI resolution starts by inserting
   rules for known URI schemes into the 'uri.arpa' registry. For the
   'URN:' URI scheme, one of the rules found in 'uri.arpa' would be for
   the 'urn' URI scheme. This rule would simply delegate to the
   'urn.arpa' zone for additional NAPTRs based on the URN namespace.
   Essentially, the URI Resolution Rewrite Rule for 'URN:' is the URN
   Resolution Application's First Well Known Rule.

   Therefore, this document specifies two DDDS Applications. One is for
   URI Resolution and the other is for URN Resolution. Both are
   technically identical but by separating the two URN Resolution can
   still proceed without the dependency.





























Mealling                Expires January 12, 2001                [Page 5]


Internet-Draft         DDDS Based URI Resolution               July 2000


4. The URI and URN Resolution Application Specifications

4.1 Application Unique String

   The Application Unique String is the Uniform Resource Identifier or
   Uniform Resource Name for which an authoritative server is being
   located. This URI or URN MUST be canonicalized and hex encoded
   according to the "absolute-uri" production found in the Collected
   ABNF from RFC 2396[13].

4.2 First Well Known Rule

   In the URI case, the first known key is created by taking the URI
   scheme. In the URN case, the first known key is the Namespace
   Identifier. For example, the URI 'http://www.foo.com/' would have a
   'http' as its Key.  The URN 'urn:foo:foospace' would have 'foo' as
   its first Key.

4.3 Flags

   At this time only four flags, "S", "A", "U", and "P", are defined.
   The "S", "A" and "U" flags are for a terminal lookup. This means
   that the Rule is the last one and that the flag determines what the
   next stage should be.  The "S" flag means that the output of this
   Rule is a domain-name for which one or more SRV[4] records exist.
   See Section 5 for additional information on how URI and URN
   Resolution use the SRV record type. "A" means that the output of the
   Rule is a domain-name and should be used to lookup A records for
   that domain. The "U" flag means that the output of the Rule is a
   URL[13].

   The "P" flag says that the remainder of the DDDS Algorithm is
   ignored and that the rest of the process is application specific and
   outside the scope of this document. An application can use the
   Protocol part found in the Services field to identify which
   Application specific set of rules that should be followed next. The
   record that contains the 'P' flag is the last record that is
   interpreted by the rules in this document.

   The remaining alphabetic flags are reserved for future versions of
   this specification. The numeric flags may be used for local
   experimentation. The S, A, U and P flags are all mutually exclusive,
   and resolution libraries MAY signal an error if more than one is
   given. (Experimental code and code for assisting in the creation of
   Rewrite Rules would be more likely to signal such an error than a
   client such as a browser). It is anticipated that multiple flags
   will be allowed in the future, so implementers MUST NOT assume that
   the flags field can only contain 0 or 1 characters. Finally, if a
   client encounters a record with an unknown flag, it MUST ignore it
   and move to the next Rule. This test takes precedence over any
   ordering since flags can control the interpretation placed on


Mealling                Expires January 12, 2001                [Page 6]


Internet-Draft         DDDS Based URI Resolution               July 2000


   fields. A novel flag might change the interpretation of the regexp
   and/or replacement fields such that it is impossible to determine if
   a record matched a given target.

   The "S", "A", and "U"  flags are called 'terminal' flags since they
   halt the looping rewrite algorithm. If those flags are not present,
   clients may assume that another Rule exists at the Key produced by
   the current Rewrite Rule.


4.4 Services Parameters

   Service Parameters for this Application take the form of a string of
   characters that follow this ABNF:


                    service_field = [ [protocol] *("+" rs)]
                    protocol      = ALPHA *31ALPHANUM
                    rs            = ALPHA *31ALPHANUM
                    ; The protocol and rs fields are limited to 32
                    ; characters and must start with an alphabetic.

   In other words, an optional protocol specification followed by 0 or
   more resolution services. Each resolution service is indicated by an
   initial '+' character.

   The empty string is also valid. This will typically be seen at the
   beginning of a series of Rules, when it is impossible to know what
   services and protocols will be offered at the end of a particular
   delegation path.

4.4.1 Services

   The service identifiers that make up the 'rs' production are generic
   for both URI and URN resolution since the input value types itself
   based on the URI scheme. The list of valid services are defined in
   [6].

   Examples of some of these services are:

   I2L: given a URI return one URL that identifies a location where the
      original URI can be found

   I2Ls: given a URI return one or more URLs that identify multiple
      locations where the original URI can be found

   I2R: given a URI return one instance of the resource identified by
      that URI.

   I2Rs: given a URI return one or more instances of the resources
      identified by that URI.


Mealling                Expires January 12, 2001                [Page 7]


Internet-Draft         DDDS Based URI Resolution               July 2000


   I2C: given a URI return one instance of a description of that
      resource.

   I2N: given a URI return one URN that names the resource (Caution:
      equality with respect to URNs is non-trivial. See [1]for examples
      of why.)

4.4.2 protocols

   The protocol identifiers that are valid for the 'protocol'
   production are defined by the protocol specifications themselves. At
   present the THTTP[5] protocol is the only such specification. Simply
   specifying any protocol in the services field is insufficient since
   there are additional semantics surrounding URI resolution that are
   not defined within the protocols.

   For example, if Z39.50 were to be specified as a valid protocol it
   would have to define how it would encode requests for specific
   services, how the URI is encoded, and what information is returned.

4.5 Valid Databases

   At present only one DDDS Database is specified for this Application.
   "A DDDS Database Using The Domain Name System"[10] specifies a DDDS
   Database that uses the NAPTR DNS resource record to contain the
   rewrite rules. The Keys for this database are encoded as
   domain-names.

   The output of the First Well Known Rule for the URI Resolution
   Application is the URI's scheme. In order to convert this to a
   unique key in this Database the string 'uri.arpa.' is appended to
   the end. This domain-name is used to request NAPTR records which
   produces new keys in the form of domain-names.

   The output of the First Well Known Rule of the URN Resolution
   Application is the URN's namespace id. In order to convert this to a
   unique key in this Database the string 'urn.arpa.' is appended to
   the end. This domain-name is used to request NAPTR records which
   produces new keys in the form of domain-names.

   DNS servers MAY interpret Flag values and use that information to
   include appropriate SRV and A records in the Additional Information
   portion of the DNS packet. Clients are encouraged to check for
   additional information but are not required to do so.







Mealling                Expires January 12, 2001                [Page 8]


Internet-Draft         DDDS Based URI Resolution               July 2000


5. Examples

5.1 An example using a URN

   Consider a URN that uses the hypothetical DUNS namespace. DUNS
   numbers are identifiers for approximately 30 million registered
   businesses around the world, assigned and maintained by Dunn and
   Bradstreet. The URN might look like:


                         urn:duns:002372413:annual-report-1997


   The first step in the resolution process is to find out about the
   DUNS namespace. The namespace identifier[3], "duns", is extracted
   from the URN and prepended to 'urn.arpa', producing 'duns.urn.arpa'.
   The DNS is queried for NAPTR records for this domain which produces
   the following results:


      duns.urn.arpa.
      ;;      order pref flags service          regexp        replacement
      IN NAPTR 100  10  "s" "dunslink+I2L+I2C"  ""  dunslink.udp.dandb.com.
      IN NAPTR 100  20  "s" "rcds+I2C"          ""  rcds.udp.dandb.com.
      IN NAPTR 100  30  "s" "thttp+I2L+I2C+I2R" ""  thttp.tcp.dandb.com.


   The order field contains equal values, indicating that no order has
   to be followed. The preference field indicates that the provider
   would like clients to use the special 'dunslink' protocol, followed
   by the RCDS protocol, and that THTTP is offered as a last resort.
   All the records specify the "s" flag which means that the record is
   terminal and that the next step is to retrieve an SRV record from
   DNS for the given domain-name.

   The service fields say that if we speak dunslink, we will be able to
   issue either the I2L or I2C requests to obtain a URL or ask some
   complicated questions about the resource. The Resource Cataloging
   and Distribution Service  (RCDS)[7] could be used to get some
   metadata for the resource, while THTTP could be used to get a URL
   for the current location of the resource.

   Assuming our client does not know the dunslink protocol but does
   know the RCDS protocol, our next action is to lookup SRV RRs for
   rcds.udp.dandb.com, which will tell us hosts that can provide the
   necessary resolution service. That lookup might return:





Mealling                Expires January 12, 2001                [Page 9]


Internet-Draft         DDDS Based URI Resolution               July 2000


         ;;                          Pref Weight Port Target
         rcds.udp.dandb.com IN SRV 0    0    1000 defduns.dandb.com.
                            IN SRV 0    0    1000 dbmirror.com.au.
                            IN SRV 0    0    1000 ukmirror.com.uk.


    telling us three hosts that could actually do the resolution, and
   giving us the port we should use to talk to their RCDS server.  (The
   reader is referred to the SRV specification[4] for the
   interpretation of the fields above).

   There is opportunity for significant optimization here. We can
   return the SRV records as additional information for terminal NAPTRs
   (and the A records as additional information for those SRVs). While
   this recursive provision of additional information is not explicitly
   blessed in the DNS specifications, it is not forbidden, and BIND
   does take advantage of it. This is a significant optimization. In
   conjunction with a long TTL for *.urn.arpa records, the average
   number of probes to DNS for resolving DUNS URNs would approach one.
   Therefore, DNS server implementors SHOULD provide additional
   information with NAPTR responses. The additional information will be
   either SRV or A records.  If SRV records are available, their A
   records should be provided as recursive additional information.

   Note that the example NAPTR records above are intended to represent
   the reply the client will see. They are not quite identical to what
   the domain administrator would put into the zone files.

   Also note that there could have been an additional first step where
   the URN was resolved as a generic URI by looking up urn.uri.arpa.
   The resulting rule would have specified that the NID be extracted
   from the URN and 'urn.arpa' appended to it resulting in the new key
   'duns.urn.arpa' which is the first step from above.

5.2 CID URI Scheme Example

   Consider a URI scheme based on MIME Content-Ids. The URI might look
   like this:


                       cid:199606121851.1@mordred.gatech.edu


    (Note that this example is chosen for pedagogical purposes, and
   does not conform to the CID URL scheme.)

   The first step in the resolution process is to find out about the
   CID scheme. The schem is extracted from the URI, prepended to
   'uri.arpa', and the NAPTR for 'cid.uri.arpa' looked up in the DNS.


Mealling                Expires January 12, 2001               [Page 10]


Internet-Draft         DDDS Based URI Resolution               July 2000


   It might return records of the form:


       cid.uri.arpa.
        ;;       order pref flags service        regexp           replacement
         IN NAPTR 100   10   ""  ""  "!cid:.+@([^\.]+\.)(.*)$!\2!i"    .


   We have only one NAPTR response, so ordering the responses is not a
   problem.  The replacement field is empty, so we check the regexp
   field and use the pattern provided there. We apply that regexp to
   the entire URI to see if it matches, which it does.  The \2 part of
   the substitution expression returns the string "gatech.edu". Since
   the flags field does not contain "s" or "a", the lookup is not
   terminal and our next probe to DNS is for more NAPTR records at the
   domain-name 'gatech.edu'.

   Note that the rule does not extract the full domain name from the
   CID, instead it assumes the CID comes from a host and extracts its
   domain.  While all hosts, such as 'mordred', could have their very
   own NAPTR, maintaining those records for all the machines at a site
   that large would be an intolerable burden. Wildcards are not
   appropriate here since they only return results when there is no
   exactly matching names already in the system.

   The record returned from the query on "gatech.edu" might look like:


    gatech.edu.
    ;;       order pref flags service    regexp  replacement
    IN NAPTR 100 50 "s" "z3950+I2L+I2C"  ""    z3950.tcp.gatech.edu.
    IN NAPTR 100 50 "s" "rcds+I2C"       ""    rcds.udp.gatech.edu.
    IN NAPTR 100 50 "s" "thttp+I2L+I2C+I2R" "" thttp.tcp.gatech.edu.


   Continuing with our example, we note that the values of the order
   and preference fields are equal in all records, so the client is
   free to pick any record. The flags field tells us that these are the
   last NAPTR patterns we should see, and after the rewrite (a simple
   replacement in this case) we should look up SRV records to get
   information on the hosts that can provide the necessary service.

   Assuming we prefer the Z39.50 protocol, our lookup might return:








Mealling                Expires January 12, 2001               [Page 11]


Internet-Draft         DDDS Based URI Resolution               July 2000


         ;;                        Pref Weight   Port Target
         z3950.tcp.gatech.edu IN SRV 0    0      1000 z3950.gatech.edu.
                                IN SRV 0    0      1000 z3950.cc.gatech.edu.
                                IN SRV 0    0      1000 z3950.uga.edu.


    telling us three hosts that could actually do the resolution, and
   giving us the port we should use to talk to their Z39.50 server.

5.3 Resolving an HTTP URI Scheme

   Even if URN systems were in place now, there would still be a
   tremendous number of URLs.  It should be possible to develop a URI
   resolution system that can also provide location independence for
   those URLs.

   Assume we have the URL for a very popular piece of software that the
   publisher wishes to mirror at multiple sites around the world:


              http://www.foo.com/software/latest-beta.exe


   We extract the prefix, "http", and lookup NAPTR records for
   'http.uri.arpa'. This might return a record of the form:


         http.uri.arpa. IN NAPTR
         ;;  order   pref flags service      regexp             replacement
              100     90   ""      ""   "!http://([^/:]+)!\1!i"       .


   This expression returns everything after the first double slash and
   before the next slash or colon. (We use the '!' character to delimit
   the parts of the substitution expression. Otherwise we would have to
   use backslashes to escape the forward slashes, and would have a
   regexp in the zone file that looked like this:
   "/http:\\/\\/([^\\/:]+)/\\1/i").

   Applying this pattern to the URL extracts "www.foo.com". Looking up
   NAPTR records for that might return:


         www.foo.com.
         ;;       order pref flags   service  regexp     replacement
          IN NAPTR 100  100  "s"   "thttp+L2R"   ""    thttp._tcp.foo.com.
          IN NAPTR 100  100  "s"   "ftp+L2R"    ""     ftp._tcp.foo.com.




Mealling                Expires January 12, 2001               [Page 12]


Internet-Draft         DDDS Based URI Resolution               July 2000


   Looking up SRV records for thttp.tcp.foo.com would return
   information on the hosts that foo.com has designated to be its
   mirror sites. The client can then pick one for the user.
















































Mealling                Expires January 12, 2001               [Page 13]


Internet-Draft         DDDS Based URI Resolution               July 2000


6. Notes

   o  Registration procedures for the 'urn.arpa' and 'uri.arpa' DNS
      zones are specified in "Assignment Procedures  for URI Resolution
      using DNS"[11].

   o  If a record at a particular order matches the URI, but the client
      doesn't know the specified protocol and service, the client
      SHOULD continue to examine records that have the same order. The
      client MUST NOT consider records with a higher value of order.
      This is necessary to make delegation of portions of the namespace
      work.  The order field is what lets site administrators say "all
      requests for URIs matching pattern x go to server 1, all others
      go to server 2".  A match is defined as:

      1.  The NAPTR provides a replacement domain name

      2.  or the regular expression matches the URI

   o  When multiple RRs have the same "order", the client should use
      the value of the preference field to select the next NAPTR to
      consider. However, because of preferred protocols or services,
      estimates of network distance and bandwidth, etc. clients may use
      different criteria to sort the records.

   o  If the lookup after a rewrite fails, clients are strongly
      encouraged to report a failure, rather than backing up to pursue
      other rewrite paths.

   o  When a namespace is to be delegated among a set of resolvers,
      regexps must be used. Each regexp appears in a separate NAPTR RR.
      Administrators should do as little delegation as possible,
      because of limitations on the size of DNS responses.

   o  Note that SRV RRs impose additional requirements on clients.
















Mealling                Expires January 12, 2001               [Page 14]


Internet-Draft         DDDS Based URI Resolution               July 2000


7. IANA Considerations

   The use of the "urn.arpa" and "uri.arpa" zones requires registration
   policies and procedures to be followed and for the operation of
   those DNS zones to be maintained. These policies and procedures are
   spelled out in a "Assignment Procedures for the URI Resolution using
   DNS"[11]. The operation of those zones imposes operational and
   administrative responsibilities on the IANA.

   The registration methods used for specifying values for the Services
   (both protocols and services) and Flags fields that are specific to
   URI resolution is for a specification to be published as an RFC and
   approved by the IESG.

   The registration policies for URLs and URNs are also specified
   elsewhere and thus those impacts on the IANA are spelled out there.



































Mealling                Expires January 12, 2001               [Page 15]


Internet-Draft         DDDS Based URI Resolution               July 2000


8. Security Considerations

   The use of "urn.arpa" and "uri.arpa" as the registry for namespaces
   is subject to denial of service attacks, as well as other DNS
   spoofing attacks. The interactions with DNSSEC are currently being
   studied. It is expected that NAPTR records will be signed with SIG
   records once the DNSSEC work is deployed.

   The rewrite rules make identifiers from other namespaces subject to
   the same attacks as normal domain names. Since they have not been
   easily resolvable before, this may or may not be considered a
   problem.

   Regular expressions should be checked for sanity, not blindly passed
   to something like PERL.

   This document has discussed a way of locating a resolver, but has
   not discussed any detail of how the communication with the resolver
   takes place. There are significant security considerations attached
   to the communication with a resolver. Those considerations are
   outside the scope of this document, and must be addressed by the
   specifications for particular resolver communication protocols.





























Mealling                Expires January 12, 2001               [Page 16]


Internet-Draft         DDDS Based URI Resolution               July 2000


9. Acknowledgments

   The editors would like to thank Keith Moore for all his
   consultations during the development of this draft. We would also
   like to thank Paul Vixie for his assistance in debugging our
   implementation, and his answers on our questions. Finally, we would
   like to acknowledge our enormous intellectual debt to the
   participants in the Knoxville series of meetings, as well as to the
   participants in the URI and URN working groups.

   Specific recognition is given to Ron Daniel who was co-author on the
   original versions of these documents. His early implementations and
   clarity of thinking was invaluable in clearing up many of the
   potential boundary cases.





































Mealling                Expires January 12, 2001               [Page 17]


Internet-Draft         DDDS Based URI Resolution               July 2000


References

   [1]  Sollins, K. and L. Masinter, "Functional Requirements for
        Uniform Resource Names", RFC 1737, December 1994.

   [2]  Arms, B., "The URN Implementors, Uniform Resource Names: A
        Progress Report", D-Lib Magazine, February 1996.

   [3]  Moats, R., "URN Syntax", RFC 2141, May 1997.

   [4]  Gulbrandsen, A., Vixie, P. and L. Esibov, "A DNS RR for
        specifying the location of services (DNS SRV)", RFC 2782,
        February 2000.

   [5]  Danie1, R., "A Trivial Convention for using HTTP in URN
        Resolution", RFC 2169, June 1997.

   [6]  Mealling, M., "URI Resolution Services Necessary for URN
        Resolution", RFC 2483, January 1999.

   [7]  Moore, K., Browne, S., Cox, J. and J. Gettler, "Resource
        Cataloging and Distribution System", Technical Report
        CS-97-346, December 1996.

   [8]  Sollins, K., "Architectural Principles of Uniform Resource Name
        Resolution", RFC 2276, January 1998.

   [9]  Mealling, M.M., "Dynamic Delegation Discovery System (DDDS)", ,
        May 2000.

   [10]  Mealling, M.M., "A DDDS Database Using The Domain Name
         System", Internet-Draft
         draft-ietf-urn-dns-ddds-database-00.txt, May 2000.

   [11]  Mealling, M., "Assignment Procedures for DDDS Rules in
         URI.ARPA and URN.ARPA", Internet-Draft
         draft-ietf-uri.arpa-procedures-03.txt, February 2000.

   [12]  Danie1, R. and M. Mealling, "Resolution of Uniform Resource
         Identifiers using the Domain Name System", RFC 2168, June 1997.

   [13]  Berners-Lee, T., Fielding, R.T. and L. Masinter, "Uniform
         Resource Identifiers (URI): Generic Syntax", RFC 2396, August
         1998.







Mealling                Expires January 12, 2001               [Page 18]


Internet-Draft         DDDS Based URI Resolution               July 2000


Author's Address

   Michael Mealling
   Network Solutions, Inc.
   505 Huntmar Park Drive
   Herndon, VA  22070
   US

   Phone: +1 770 935 5492
   EMail: michaelm@netsol.com
   URI:   http://www.netsol.com








































Mealling                Expires January 12, 2001               [Page 19]


Internet-Draft         DDDS Based URI Resolution               July 2000


Appendix A. Pseudo Code

   For the edification of implementers, pseudocode for a client routine
   using NAPTRs is given below. This code is provided merely as a
   convenience, it does not have any weight as a standard way to
   process NAPTR records. Also, as is the case with pseudocode, it has
   never been executed and may contain logical errors. You have been
   warned.



          //
          // findResolver(URN)
          // Given a URN, find a host that can resolve it.
          //
          findResolver(string URN) {
            // prepend prefix to urn.arpa
            sprintf(key, "%s.urn.arpa", extractNS(URN));
            do {
              rewrite_flag = false;
              terminal = false;
              if (key has been seen) {
                quit with a loop detected error
              }
              add key to list of "seens"
              records = lookup(type=NAPTR, key); // get all NAPTR RRs for 'key'

              discard any records with an unknown value in the "flags" field.
              sort NAPTR records by "order" field and "preference" field
                  (with "order" being more significant than "preference").
              n_naptrs = number of NAPTR records in response.
              curr_order = records[0].order;
              max_order = records[n_naptrs-1].order;

              // Process current batch of NAPTRs according to "order" field.
              for (j=0; j < n_naptrs && records[j].order <= max_order; j++) {
                if (unknown_flag) // skip this record and go to next one
                   continue;
                newkey = rewrite(URN, naptr[j].replacement, naptr[j].regexp);
                if (!newkey) // Skip to next record if the rewrite didn't
                   match continue;
                // We did do a rewrite, shrink max_order to current value
                // so that delegation works properly
                max_order = naptr[j].order;
                // Will we know what to do with the protocol and services
                // specified in the NAPTR? If not, try next record.
                if(!isKnownProto(naptr[j].services)) {
                  continue;
                }


Mealling                Expires January 12, 2001               [Page 20]


Internet-Draft         DDDS Based URI Resolution               July 2000


                if(!isKnownService(naptr[j].services)) {
                  continue;
                }

                // At this point we have a successful rewrite and we will
                // know how to speak the protocol and request a known
                // resolution service. Before we do the next lookup, check
                // some optimization possibilities.
                if (strcasecmp(flags, "S")
                 || strcasecmp(flags, "P"))
                 || strcasecmp(flags, "A")) {
                   terminal = true;
                   services = naptr[j].services;
                   addnl = any SRV and/or A records returned as additional
                           info for naptr[j].
                }
                key = newkey;
                rewriteflag = true;
                break;
              }
            } while (rewriteflag && !terminal);

            // Did we not find our way to a resolver?
            if (!rewrite_flag) {
               report an error
               return NULL;
            }

            // Leave rest to another protocol?
            if (strcasecmp(flags, "P")) {
               return key as host to talk to;
            }

            // If not, keep plugging
            if (!addnl) { // No SRVs came in as additional info, look them up
              srvs = lookup(type=SRV, key);
            }

            sort SRV records by preference, weight, ...
            foreach (SRV record) { // in order of preference
              try contacting srv[j].target using the protocol and one of the
                  resolution service requests from the "services" field of the
                  last NAPTR record.
              if (successful)
                return (target, protocol, service);
                // Actually we would probably return a result, but this
                // code was supposed to just tell us a good host to talk to.
            }
            die with an "unable to find a host" error;


Mealling                Expires January 12, 2001               [Page 21]


Internet-Draft         DDDS Based URI Resolution               July 2000


          }


















































Mealling                Expires January 12, 2001               [Page 22]


Internet-Draft         DDDS Based URI Resolution               July 2000


Full Copyright Statement

   Copyright (C) The Internet Society (2000). All Rights Reserved.

   This document and translations of it may be copied and furnished to
   others, and derivative works that comment on or otherwise explain it
   or assist in its implmentation may be prepared, copied, published
   and distributed, in whole or in part, without restriction of any
   kind, provided that the above copyright notice and this paragraph
   are included on all such copies and derivative works. However, this
   document itself may not be modified in any way, such as by removing
   the copyright notice or references to the Internet Society or other
   Internet organizations, except as needed for the purpose of
   developing Internet standards in which case the procedures for
   copyrights defined in the Internet Standards process must be
   followed, or as required to translate it into languages other than
   English.

   The limited permissions granted above are perpetual and will not be
   revoked by the Internet Society or its successors or assigns.

   This document and the information contained herein is provided on an
   "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
   TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
   BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
   HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

Acknowledgement

   Funding for the RFC editor function is currently provided by the
   Internet Society.



















Mealling                Expires January 12, 2001               [Page 23]