home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1997 December / Internet_Info_CD-ROM_Walnut_Creek_December_1997.iso / drafts / draft_ietf_u_z / draft-ietf-urn-naptr-03.txt < prev    next >
Text File  |  1997-03-10  |  42KB  |  909 lines

  1.  
  2.  
  3. INTERNET DRAFT                                                  Ron Daniel
  4. draft-ietf-urn-naptr-03.txt                 Los Alamos National Laboratory
  5.                                                           Michael Mealling
  6.                                                    Network Solutions, Inc.
  7.                                                              27 Feb., 1997
  8.  
  9.  
  10.                 Resolution of Uniform Resource Identifiers
  11.                        using the Domain Name System
  12.  
  13.  
  14. Status of this Memo
  15. ===================
  16.  
  17.     This document is an Internet-Draft.  Internet-Drafts are working
  18.     documents of the Internet Engineering Task Force (IETF), its
  19.     areas, and its working groups.  Note that other groups may also
  20.     distribute working documents as Internet-Drafts.
  21.   
  22.     Internet-Drafts are draft documents valid for a maximum of six
  23.     months and may be updated, replaced, or obsoleted by other
  24.     documents at any time.  It is inappropriate to use Internet-
  25.     Drafts as reference material or to cite them other than as
  26.     ``work in progress.''
  27.   
  28.     To learn the current status of any Internet-Draft, please check
  29.     the ``1id-abstracts.txt'' listing contained in the Internet-
  30.     Drafts Shadow Directories on ftp.is.co.za (Africa),
  31.     nic.nordu.net (Europe), munnari.oz.au (Pacific Rim),
  32.     ds.internic.net (US East Coast), or ftp.isi.edu (US West Coast).
  33.  
  34.     This draft expires 27 August., 1997.
  35.   
  36.   
  37. Abstract:
  38. =========
  39.  
  40. Uniform Resource Locators (URLs) are the foundation of the World Wide
  41. Web, and are a vital Internet technology. However, they have proven to
  42. be brittle in practice. The basic problem is that URLs typically
  43. identify a particular path to a file on a particular host. There is no
  44. graceful way of changing the path or host once the URL has been
  45. assigned. Neither is there a graceful way of replicating the resource
  46. located by the URL to achieve better network utilization and/or fault
  47. tolerance. Uniform Resource Names (URNs) have been hypothesized as a
  48. adjunct to URLs that would overcome such problems. URNs and URLs are
  49. both instances of a broader class of identifiers known as Uniform
  50. Resource Identifiers (URIs).
  51.  
  52. This document describes a new DNS Resource Record, NAPTR (Naming
  53. Authority PoinTeR), that provides rules for mapping parts of URIs to
  54. domain names.  By changing the mapping rules, we can change the host
  55. that is contacted to resolve a URI. This will allow a more graceful
  56. handling of URLs over long time periods, and forms the foundation for a
  57. new proposal for Uniform Resource Names.
  58.  
  59. In addition to locating resolvers, the NAPTR provides for other naming
  60. systems to be grandfathered into the URN world, provides independence
  61. between the name assignment system and the resolution protocol system,
  62. and allows multiple services (Name to Location, Name to Description,
  63. Name to Resource, ...) to be offered.  In conjunction with the SRV RR,
  64. the NAPTR record allows those services to be replicated for the purposes
  65. of fault tolerance and load balancing.
  66.  
  67.  
  68. Introduction:
  69. =============
  70.  
  71. Uniform Resource Locators have been a significant advance in retrieving
  72. Internet-accessible resources. However, their  brittle nature over time
  73. has been recognized for several years. The Uniform Resource Identifier
  74. working group proposed the development of Uniform Resource Names to serve
  75. as persistent, location-independent identifiers for Internet resources
  76. in order to overcome most of the problems with URLs. RFC-1737 [1] sets
  77. forth requirements on URNs.
  78.  
  79. During the lifetime of the URI-WG, a number of URN proposals were
  80. generated. The developers of several of those proposals met in a series
  81. of meetings, resulting in a compromise known as the Knoxville framework.
  82. The major principle behind the Knoxville framework is that the resolution
  83. system must be separate from the way names are assigned. This is in
  84. marked contrast to most URLs, which identify the host to contact and
  85. the protocol to use. Readers are referred to [2] for background on the
  86. Knoxville framework and for additional information on the context and
  87. purpose of this proposal.
  88.  
  89. Separating the way names are resolved from the way they are constructed
  90. provides several benefits. It allows multiple naming approaches and
  91. resolution approaches to compete, as it allows different protocols and
  92. resolvers to be used. There is just one problem with such a separation -
  93. how do we resolve a name when it can't give us directions to its
  94. resolver?
  95.  
  96. For the short term, DNS is the obvious candidate for the resolution
  97. framework, since it is widely deployed and understood. However, it is
  98. not appropriate to use DNS to maintain information on a per-resource
  99. basis. First of all, DNS was never intended to handle that many
  100. records. Second, the limited record size is inappropriate for catalog
  101. information. Third, domain names are not appropriate as URNs.
  102.  
  103. Therefore our approach is to use DNS to locate "resolvers" that can
  104. provide information on individual resources, potentially including the
  105. resource itself. To accomplish this, we "rewrite" the URI into a domain
  106. name following the rules provided in NAPTR records. Rewrite rules
  107. provide considerable power, which is important when trying to meet the
  108. goals listed above. However, collections of rules can become difficult
  109. to understand. To lessen this problem, the NAPTR rules are *always*
  110. applied to the original URI, *never* to the output of previous rules.
  111.  
  112. Locating a resolver through the rewrite procedure may take multiple
  113. steps, but the beginning is always the same. The start of the URI
  114. is scanned to extract its colon-delimited prefix. (For URNs, the
  115. prefix is always "urn:" and we extract the following colon-delimited
  116. namespace identifier. [3]). NAPTR resolution begins by taking the
  117. extracted string, appending the well-known suffix ".urn.net", and
  118. querying the DNS for NAPTR records at that domain name.  Based on the
  119. results of this query, zero or more additional DNS queries may be
  120. needed to locate resolvers for the URI. The details of the conversation
  121. between the client and the resolver thus located are outside the bounds
  122. of this draft. Three brief examples of this procedure are given in the
  123. next section.
  124.  
  125. The NAPTR RR provides the level of indirection needed to keep the
  126. naming system independent of the resolution system, its protocols, and
  127. services.  Coupled with the new SRV resource record proposal[4] there
  128. is also the potential for replicating the resolver on multiple hosts,
  129. overcoming some of the most significant problems of URLs. This is an
  130. important and subtle point. Not only do the NAPTR and SRV records allow
  131. us to replicate the resource, we can replicate the resolvers that know
  132. about the replicated resource. Preventing a single point of failure at
  133. the resolver level is a significant benefit. Separating the resolution
  134. procedure from the way names are constructed has additional benefits.
  135. Different resolution procedures can be used over time, and resolution
  136. procedures that are determined to be useful can be extended to deal
  137. with additional namespaces.
  138.  
  139. Caveats
  140. =======
  141.  
  142. The NAPTR proposal is the first resolution procedure to be considered
  143. by the URN-WG. There are several concerns about the proposal which have
  144. motivated the group to recommend it for publication as an Experimental
  145. rather than a standards-track RFC.
  146.  
  147. First, URN resolution is new to the IETF and we wish to gain
  148. operational experience before recommending any procedure for the
  149. standards track. Second, the NAPTR proposal is based on DNS and
  150. consequently inherits concerns about security and administration. The
  151. recent advancement of the DNSSEC and secure update drafts to Proposed
  152. Standard reduce these concerns, but we wish to experiment with those
  153. new capabilities in the context of URN administration.  A third area of
  154. concern is the potential for a noticeable impact on the DNS.  We
  155. believe that the proposal makes appropriate use of caching and
  156. additional information, but it is best to go slow where the potential
  157. for impact on a core system like the DNS is concerned. Fourth, the
  158. rewrite rules in the NAPTR proposal are based on regular expressions.
  159. Since regular expressions are difficult for humans to construct
  160. correctly, concerns exist about the usability and maintainability of
  161. the rules. This is especially true where international character sets
  162. are concerned. Finally, the URN-WG is developing a requirements document
  163. for URN Resolution Services[15], but that document is not complete. That
  164. document needs to precede any resolution service proposals on the standards
  165. track.
  166.  
  167. Terminology
  168. ===========
  169.  
  170. "Must" or "Shall" - Software that does not behave in the manner that this
  171.            document says it must is not conformant to this document.
  172. "Should" - Software that does not follow the behavior that this document
  173.            says it should may still be conformant, but is probably broken
  174.            in some fundamental way.
  175. "May" -    Implementations may or may not provide the described behavior,
  176.            while still remaining conformant to this document.
  177.  
  178.  
  179. Brief overview and examples of the NAPTR RR:
  180. ============================================
  181.  
  182. A detailed description of the NAPTR RR will be given later, but to give
  183. a flavor for the proposal we first give a simple description of the
  184. record and three examples of its use.
  185.  
  186. The key fields in the NAPTR RR are order, preference, service, flags,
  187. regexp, and replacement:
  188.  
  189. * The order field specifies the order in which records MUST be processed
  190.   when multiple NAPTR records are returned in response to a single query.
  191.   A naming authority may have delegated a portion of its namespace to
  192.   another agency. Evaluating the NAPTR records in the correct order is
  193.   necessary for delegation to work properly.
  194.  
  195. * The preference field specifies the order in which records SHOULD be
  196.   processed when multiple NAPTR records have the same value of "order".
  197.   This field lets a service provider specify the order in which resolvers
  198.   are contacted, so that more capable machines are contacted in preference
  199.   to less capable ones.
  200.  
  201. * The service field specifies the resolution protocol and resolution
  202.   service(s) that will be available if the rewrite specified by the
  203.   regexp or replacement fields is applied. Resolution protocols are
  204.   the protocols used to talk with a resolver. They will be specified in
  205.   other documents, such as [5]. Resolution services are operations such
  206.   as N2R (URN to Resource), N2L (URN to URL), N2C (URN to URC), etc.
  207.   These will be discussed in the URN Resolution Services document[6], and
  208.   their behavior in a particular resolution protocol will be given in
  209.   the specification for that protocol (see [5] for a concrete example).
  210.  
  211. * The flags field contains modifiers that affect what happens in the
  212.   next DNS lookup, typically for optimizing the process. Flags may also
  213.   affect the interpretation of the other fields in the record, therefore,
  214.   clients MUST skip NAPTR records which contain an unknown flag value.
  215.  
  216. * The regexp field is one of two fields used for the rewrite rules, and
  217.   is the core concept of the NAPTR record. The regexp field is a String
  218.   containing a sed-like substitution expression. (The actual grammar
  219.   for the substitution expressions is given later in this draft). The
  220.   substitution expression is applied to the original URN to determine
  221.   the next domain name to be queried. The regexp field should be used
  222.   when the domain name to be generated is conditional on information in
  223.   the URI. If the next domain name is always known, which is
  224.   anticipated to be a common occurrence, the replacement field should
  225.   be used instead.
  226.  
  227. * The replacement field is the other field that may be used for the
  228.   rewrite rule. It is an optimization of the rewrite process for the
  229.   case where the next domain name is fixed instead of being conditional
  230.   on the content of the URI. The replacement field is a domain name
  231.   (subject to compression if a DNS sender knows that a given recipient
  232.   is able to decompress names in this RR type's RDATA field). If the
  233.   rewrite is more complex than a simple substitution of a domain name,
  234.   the replacement field should be set to . and the regexp field used.
  235.  
  236. Note that the client applies all the substitutions and performs all
  237. lookups, they are not performed in the DNS servers. Note also that it
  238. is the belief of the developers of this document that regexps should
  239. rarely be used. The replacement field seems adequate for the vast
  240. majority of situations. Regexps are only necessary when portions of a
  241. namespace are to be delegated to different resolvers. Finally, note
  242. that the regexp and replacement fields are, at present, mutually
  243. exclusive. However, developers of client software should be aware that
  244. a new flag might be defined which requires values in both fields.
  245.  
  246.  
  247. Example 1
  248. ---------
  249.  
  250. Consider a URN that uses the hypothetical DUNS namespace. DUNS numbers
  251. are identifiers for approximately 30 million registered businesses
  252. around the world, assigned and maintained by Dunn and Bradstreet. The
  253. URN might look like:
  254.  
  255.                  urn:duns:002372413:annual-report-1997
  256.  
  257. The first step in the resolution process is to find out about the DUNS
  258. namespace. The namespace identifier, "duns", is extracted from the URN,
  259. prepended to urn.net, and the NAPTRs for duns.urn.net looked up. It
  260. might return records of the form:
  261.  
  262. duns.urn.net
  263. ;;      order pref flags service          regexp        replacement
  264.  IN NAPTR 100  10  "s"  "dunslink+N2L+N2C"  ""   dunslink.udp.isi.dandb.com
  265.  IN NAPTR 100  20  "s"  "rcds+N2C"          ""   rcds.udp.isi.dandb.com
  266.  IN NAPTR 100  30  "s"  "http+N2L+N2C+N2R"  ""   http.tcp.isi.dandb.com
  267.  
  268. The order field contains equal values, indicating that no name
  269. delegation order has to be followed. The preference field indicates
  270. that the provider would like clients to use the special dunslink
  271. protocol, followed by the RCDS protocol, and that HTTP is offered as a
  272. last resort. All the records specify the "s" flag, which will be
  273. explained momentarily.  The service fields say that if we speak
  274. dunslink, we will be able to issue either the N2L or N2C requests to
  275. obtain a URL or a URC (description) of the resource. The Resource
  276. Cataloging and Distribution Service (RCDS)[7] could be used to get a
  277. URC for the resource, while HTTP could be used to get a URL, URC, or
  278. the resource itself.  All the records supply the next domain name to
  279. query, none of them need to be rewritten with the aid of regular
  280. expressions.
  281.  
  282. The general case might require multiple NAPTR rewrites to locate a
  283. resolver, but eventually we will come to the "terminal NAPTR". Once we
  284. have the terminal NAPTR, our next probe into the DNS will be for a SRV
  285. or A record instead of another NAPTR. Rather than probing for a
  286. non-existent NAPTR record to terminate the loop, the flags field is
  287. used to indicate a terminal lookup. If it has a value of "s", the next
  288. lookup should be for SRV RRs, "a" denotes that A records should sought.
  289. A "p" flag is also provided to indicate that the next action is
  290. Protocol-specific, but that looking up another NAPTR will not be part
  291. of it.
  292.  
  293. Since our example RR specified the "s" flag, it was terminal. Assuming
  294. our client does not know the dunslink protocol, our next action is to
  295. lookup SRV RRs for rcds.udp.isi.dandb.com, which will tell us hosts that
  296. can provide the necessary resolution service. That lookup might return:
  297.  
  298.  ;;                          Pref Weight Port Target
  299.  rcds.udp.isi.dandb.com IN SRV 0    0    1000 defduns.isi.dandb.com
  300.                         IN SRV 0    0    1000 dbmirror.com.au
  301.                         IN SRV 0    0    1000 ukmirror.com.uk
  302.  
  303. telling us three hosts that could actually do the resolution, and
  304. giving us the port we should use to talk to their RCDS server.
  305. (The reader is referred to the SRV proposal [4] for the interpretation
  306. of the fields above).
  307.  
  308. There is opportunity for significant optimization here. We can return
  309. the SRV records as additional information for terminal NAPTRs (and the
  310. A records as additional information for those SRVs). While this
  311. recursive provision of additional information is not explicitly blessed
  312. in the DNS specifications, it is not forbidden, and BIND does take
  313. advantage of it [8]. This is a significant optimization. In conjunction
  314. with a long TTL for *.urn.net records, the average number of probes to
  315. DNS for resolving DUNS URNs would approach one. Therefore, DNS server
  316. implementors SHOULD provide additional information with NAPTR
  317. responses. The additional information will be either SRV or A records.
  318. If SRV records are available, their A records should be provided as
  319. recursive additional information.
  320.  
  321. Note that the example NAPTR records above are intended to represent the
  322. reply the client will see. They are not quite identical to what the
  323. domain administrator would put into the zone files. For one thing, the
  324. administrator should supply the trailing '.' character on any FQDNs.
  325.  
  326.  
  327. Example 2 
  328. ---------
  329.  
  330. Consider a URN namespace based on MIME Content-Ids. The URN might look
  331. like this:
  332.   
  333.         urn:cid:199606121851.1@mordred.gatech.edu
  334.  
  335. (Note that this example is chosen for pedagogical purposes, and does
  336. not conform to the recently-approved CID URL scheme.)
  337.  
  338. The first step in the resolution process is to find out about the CID
  339. namespace. The namespace identifier, cid, is extracted from the URN,
  340. prepended to urn.net, and the NAPTR for cid.urn.net looked up. It might
  341. return records of the form:
  342.  
  343.  cid.urn.net
  344.   ;;       order pref flags service        regexp           replacement
  345.    IN NAPTR 100   10   ""     ""  "/urn:cid:.+@([^\.]+\.)(*)$/\2/i"    .
  346.  
  347. We have only one NAPTR response, so ordering the responses is not
  348. a problem.  The replacement field is empty, so we check the regexp
  349. field and use the pattern provided there. We apply that regexp to the
  350. entire URN to see if it matches, which it does.  The \2 part of the
  351. substitution expression returns the string "gatech.edu". Since
  352. the flags field does not contain "s" or "a", the lookup is not terminal
  353. and our next probe to DNS is for more NAPTR records: lookup(query=NAPTR,
  354. "gatech.edu").
  355.  
  356. Note that the rule does not extract the full domain name from the CID,
  357. instead it assumes the CID comes from a host and extracts its domain.
  358. While all hosts, such as mordred, could have their very own NAPTR,
  359. maintaining those records for all the machines at a site as large as
  360. Georgia Tech would be an intolerable burden. Wildcards are not appropriate
  361. here since they only return results when there is no exactly matching
  362. names already in the system. 
  363.  
  364. The record returned from the query on "gatech.edu" might look like:
  365.  
  366. gatech.edu IN NAPTR
  367. ;;       order pref flags service           regexp  replacement
  368.   IN NAPTR 100  50  "s"  "z3950+N2L+N2C"     ""    z3950.tcp.gatech.edu
  369.   IN NAPTR 100  50  "s"  "rcds+N2C"          ""    rcds.udp.gatech.edu
  370.   IN NAPTR 100  50  "s"  "http+N2L+N2C+N2R"  ""    http.tcp.gatech.edu
  371.  
  372. Continuing with our example, we note that the values of the order and
  373. preference fields are equal in all records, so the client is free to
  374. pick any record. The flags field tells us that these are the last NAPTR
  375. patterns we should see, and after the rewrite (a simple replacement in
  376. this case) we should look up SRV records to get information on the
  377. hosts that can provide the necessary service.
  378.  
  379. Assuming we prefer the Z39.50 protocol, our lookup might return:
  380.  
  381. ;;                        Pref Weight   Port Target
  382. z3950.tcp.gatech.edu IN SRV 0    0      1000 z3950.gatech.edu
  383.                      IN SRV 0    0      1000 z3950.cc.gatech.edu
  384.                      IN SRV 0    0      1000 z3950.uga.edu
  385.  
  386. telling us three hosts that could actually do the resolution, and
  387. giving us the port we should use to talk to their Z39.50 server.
  388.  
  389. Recall that the regular expression used \2 to extract a domain name
  390. from the CID, and \. for matching the literal '.' characters seperating
  391. the domain name components. Since '\' is the escape character, literal
  392. occurances of a backslash must be escaped by another backslash. For the
  393. case of the cid.urn.net record above, the regular expression entered
  394. into the zone file should be "/urn:cid:.+@([^\\.]+\\.)(*)$/\\2/i".
  395. When the client code actually receives the record, the pattern will
  396. have been converted to "/urn:cid:.+@([^\.]+\.)(*)$/\2/i".
  397.  
  398. Example 3
  399. ---------
  400.  
  401. Even if URN systems were in place now, there would still be a
  402. tremendous number of URLs.  It should be possible to develop a URN
  403. resolution system that can also provide location independence for those
  404. URLs.  This is related to the requirement in [1] to be able to
  405. grandfather in names from other naming systems, such as ISO Formal
  406. Public Identifiers, Library of Congress Call Numbers, ISBNs, ISSNs,
  407. etc.
  408.  
  409. The NAPTR RR could also be used for URLs that have already been assigned.
  410. Assume we have the URL for a very popular piece of software that the
  411. publisher wishes to mirror at multiple sites around the world:
  412.  
  413.      http://www.foo.com/software/latest-beta.exe
  414.  
  415. We extract the prefix, "http", and lookup NAPTR records for
  416. http.urn.net. This might return a record of the form
  417.  
  418. http.urn.net IN NAPTR
  419. ;;  order   pref flags service      regexp             replacement
  420.      100     90   ""      ""   "!http://([^/:]+)!\1!i"       .
  421.  
  422.  
  423. This expression returns everything after the first double slash and
  424. before the next slash or colon. (We use the '!' character to delimit the
  425. parts of the substitution expression. Otherwise we would have to use
  426. backslashes to escape the forward slashes, and would have a regexp in
  427. the zone file that looked like "/http:\\/\\/([^\\/:]+)/\\1/i".).
  428.  
  429. Applying this pattern to the URL extracts "www.foo.com". Looking up NAPTR
  430. records for that might return:
  431.  
  432. www.foo.com
  433. ;;       order pref flags   service  regexp     replacement
  434.  IN NAPTR 100  100  "s"   "http+L2R"   ""    http.tcp.foo.com
  435.  IN NAPTR 100  100  "s"   "ftp+L2R"    ""    ftp.tcp.foo.com
  436.  
  437. Looking up SRV records for http.tcp.foo.com would return information
  438. on the hosts that foo.com has designated to be its mirror sites. The
  439. client can then pick one for the user. 
  440.  
  441.  
  442. NAPTR RR Format
  443. ===============
  444.  
  445. The format of the NAPTR RR is given below. The DNS type code for
  446. NAPTR is 35.
  447.  
  448.     Domain TTL Class Order Preference Flags Service Regexp Replacement 
  449.  
  450. where:
  451.  
  452. Domain
  453.        The domain name this resource record refers to.
  454. TTL
  455.        Standard DNS Time To Live field
  456. Class
  457.        Standard DNS meaning
  458. Order
  459.        A 16-bit integer specifying the order in which the NAPTR records
  460.        MUST be processed to ensure correct delegation of portions
  461.        of the namespace over time. Low numbers are processed before
  462.        high numbers, and once a NAPTR is found that "matches" a URN,
  463.        the client MUST NOT consider any NAPTRs with a higher value
  464.        for order.
  465.  
  466. Preference
  467.        A 16-bit integer which specifies the order in which NAPTR records
  468.        with equal "order" values SHOULD be processed, low numbers
  469.        being processed before high numbers.  This is similar to the
  470.        preference field in an MX record, and is used so domain
  471.        administrators can direct clients towards more capable hosts
  472.        or lighter weight protocols. 
  473.  
  474. Flags
  475.        A String giving flags to control aspects of the rewriting and
  476.        interpretation of the fields in the record. Flags are single
  477.        characters from the set [A-Z0-9]. The case of the alphabetic
  478.        characters is not significant.
  479.  
  480.        At this time only three flags, "S", "A", and "P", are defined.
  481.        "S" means that the next lookup should be for SRV records instead
  482.        of NAPTR records. "A" means that the next lookup should be for A
  483.        records. The "P" flag says that the remainder of the resolution
  484.        shall be carried out in a Protocol-specific fashion, and we
  485.        should not do any more DNS queries.
  486.  
  487.        The remaining alphabetic flags are reserved. The numeric flags
  488.        may be used for local experimentation. The S, A, and P flags are
  489.        all mutually exclusive, and resolution libraries MAY signal an
  490.        error if more than one is given. (Experimental code and code for
  491.        assisting in the creation of NAPTRs would be more likely to
  492.        signal such an error than a client such as a browser). We
  493.        anticipate that multiple flags will be allowed in the future, so
  494.        implementers MUST NOT assume that the flags field can only
  495.        contain 0 or 1 characters. Finally, if a client encounters a
  496.        record with an unknown flag, it MUST ignore it and move to the
  497.        next record. This test takes precedence even over the "order"
  498.        field. Since flags can control the interpretation placed on
  499.        fields, a novel flag might change the interpretation of the
  500.        regexp and/or replacement fields such that it is impossible to
  501.        determine if a record matched a URN.
  502.  
  503. Service 
  504.        Specifies the resolution service(s) available down this rewrite
  505.        path. It may also specify the particular protocol that is used
  506.        to talk with a resolver. A protocol MUST be specified if the
  507.        flags field states that the NAPTR is terminal. If a protocol is
  508.        specified, but the flags field does not state that the NAPTR is
  509.        terminal, the next lookup MUST be for a NAPTR. The client MAY
  510.        choose not to perform the next lookup if the protocol is
  511.        unknown, but that behavior MUST NOT be relied upon.
  512.  
  513.        The service field may take any of the values below (using the
  514.        Augmented BNF of RFC 822[9]):
  515.  
  516.            service_field = [ [protocol] *("+" rs)]
  517.            protocol      = ALPHA *31ALPHANUM
  518.            rs            = ALPHA *31ALPHANUM
  519.         // The protocol and rs fields are limited to 32
  520.         // characters and must start with an alphabetic.
  521.         // The current set of "known" strings are:
  522.         // protocol      = "rcds" / "thttp" / "hdl" / "rwhois" / "z3950"
  523.         // rs            = "N2L" / "N2Ls" / "N2R" / "N2Rs" / "N2C"
  524.         //               / "N2Ns" / "L2R" / "L2Ns" / "L2Ls" / "L2C"
  525.  
  526.        i.e. an optional protocol specification followed by 0 or more
  527.        resolution services. Each resolution service is indicated by
  528.        an initial '+' character.
  529.  
  530.        Note that the empty string is also a valid service field. This
  531.        will typically be seen at the top levels of a namespace, when it
  532.        is impossible to know what services and protocols will be offered
  533.        by a particular publisher within that name space.
  534.  
  535.        At this time the known protocols are rcds[7], hdl[10] (binary,
  536.        UDP-based protocols),  thttp[5] (a textual, TCP-based protocol),
  537.        rwhois[11] (textual, UDP or TCP based), and Z39.50[12] (binary,
  538.        TCP-based). More will be allowed later.  The names of the
  539.        protocols must be formed from the characters [a-Z0-9]. Case of
  540.        the characters is not significant.
  541.  
  542.        The service requests currently allowed will be described in more
  543.        detail in [6], but in brief they are:
  544.              N2L  - Given a URN, return a URL
  545.              N2Ls - Given a URN, return a set of URLs
  546.              N2R  - Given a URN, return an instance of the resource.
  547.              N2Rs - Given a URN, return multiple instances of the resouce,
  548.                     typically encoded using multipart/alternative.
  549.              N2C  - Given a URN, return a collection of meta-information
  550.                     on the named resource. The format of this response is
  551.                     the subject of another document.
  552.              N2Ns - Given a URN, return all URNs that are also identifers
  553.                     for the resource.
  554.              L2R  - Given a URL, return the resource.
  555.              L2Ns - Given a URL, return all the URNs that are identifiers
  556.                     for the resource.
  557.              L2Ls - Given a URL, return all the URLs for instances of
  558.                     of the same resource.
  559.              L2C  - Given a URL, return a description of the resource.
  560.  
  561.        The actual format of the service request and response will be
  562.        determined by the resolution protocol, and is the subject for
  563.        other documents (e.g. [5]). Protocols need not offer all
  564.        services. The labels for service requests shall be formed from
  565.        the set of characters [A-Z0-9]. The case of the alphabetic
  566.        characters is not significant.
  567.  
  568. Regexp
  569.        A STRING containing a substitution expression that is applied to
  570.        the original URI in order to construct the next domain name to
  571.        lookup. The grammar of the substitution expression is given in
  572.        the next section.
  573.  
  574. Replacement
  575.        The next NAME to query for NAPTR, SRV, or A records depending on
  576.        the value of the flags field. As mentioned above, this may be
  577.        compressed.
  578.  
  579.  
  580.  
  581. Substitution Expression Grammar:
  582. ================================
  583.  
  584. The content of the regexp field is a substitution expression. True sed(1)
  585. substitution expressions are not appropriate for use in this application for a
  586. variety of reasons, therefore the contents of the regexp field MUST follow the
  587. grammar below:
  588.  
  589.   subst_expr   = delim-char  ere  delim-char  repl  delim-char  *flags
  590.   delim-char   = "/" / "!" / ... (Any non-digit or non-flag character other
  591.                  than backslash '\'. All occurances of a delim_char in a
  592.                  subst_expr must be the same character.)
  593.   ere          = POSIX Extended Regular Expression (see [13], section 2.8.4)
  594.   repl         = dns_str /  backref / repl dns_str  / repl backref
  595.   dns_str      = domain name (see RFC-1123 [14]).
  596.   backref      = "\" 1POS_DIGIT
  597.   flags        = "i" 
  598.   DNS_CHAR     = "_" / "0" / "1" / ... / "9" / "a" / ... / "z"
  599.   POS_DIGIT    = "1" / "2" / ... / "9"  ; 0 is not an allowed backref value
  600.  
  601. The result of applying the substitution expression to the original URI shall
  602. be a legal domain name. Since it is possible for the regexp field to be
  603. improperly specified, such that a non-conforming domain name can be
  604. constructed, client software SHOULD verify that the result is a legal
  605. domain name before making queries on it. 
  606.  
  607. Backref expressions in the repl portion of the substitution expression
  608. are replaced by the (possibly empty) string of characters enclosed by '('
  609. and ')' in the ERE portion of the substitution expression. N is a single
  610. digit from 1 through 9, inclusive. It specifies the N'th backref expression,
  611. the one that begins with the N'th '(' and continues to the matching ')'.
  612. For example, the ERE
  613.                    (A(B(C)DE)(F)G)
  614. has backref expressions:
  615.                     \1  = ABCDEFG
  616.                     \2  = BCDE
  617.                     \3  = C
  618.                     \4  = F
  619.                 \5..\9  = error - no matching subexpression
  620.                  
  621. The "i" flag indicates that the ERE matching SHALL be performed in a
  622. case-insensitive fashion. Furthermore, any backref replacements MAY be
  623. normalized to lower case when the "i" flag is given.
  624.  
  625. The first character in the substitution expression shall be used as the
  626. character that delimits the components of the substitution expression.
  627. There must be exactly three non-escaped occurrences of the delimiter
  628. character in a substitution expression. Since escaped occurrences of
  629. the delimiter character will be interpreted as occurrences of that
  630. character, digits MUST NOT be used as delimiters. Backrefs would be
  631. confused with literal digits were this allowed. Similarly, if flags are
  632. specified in the substitution expression, the delimiter character must not
  633. also be a flag character. 
  634.  
  635.  
  636. Advice to domain administrators:
  637. ================================
  638.  
  639. Beware of regular expressions. Not only are they a pain to get
  640. correct on their own, but there is the previously mentioned interaction
  641. with DNS. Any backslashes in a regexp must be entered twice in a zone
  642. file in order to appear once in a query response. More seriously, the
  643. need for double backslashes has probably not been tested by all
  644. implementors of DNS servers. We anticipate that urn.net will be the
  645. heaviest user of regexps. Only when delegating portions of namespaces
  646. should the typical domain administrator need to use regexps.
  647.  
  648. On a related note, beware of interactions with the shell when manipulating
  649. regexps from the command line. Since '\' is a common escape character in
  650. shells, there is a good chance that when you think you are saying "\\" you
  651. are actually saying "\".  Similar caveats apply to characters such as
  652. '*', '(', etc.
  653.  
  654. The "a" flag allows the next lookup to be for A records rather than
  655. SRV records. Since there is no place for a port specification in the
  656. NAPTR record, when the "A" flag is used the specified protocol must
  657. be running on its default port. 
  658.  
  659. The URN-WG is discussing the use of international characters in URNs.
  660. Regular expressions for strings in international character sets are likely
  661. to be essentially impossible to read or write by hand.
  662.  
  663.  
  664. Usage
  665. =====
  666.  
  667. For the edification of implementers, pseudocode for a client routine
  668. using NAPTRs is given below. This code is provided merely as a
  669. convience, it does not have any weight as a standard way to process
  670. NAPTR records. Also, as is the case with pseudocode, it has never been
  671. executed and may contain logical errors. You have been warned.
  672.  
  673.     //
  674.     // findResolver(URN)
  675.     // Given a URN, find a host that can resolve it.
  676.     // 
  677.     findResolver(string URN) {
  678.       // prepend prefix to urn.net
  679.       sprintf(key, "%s.urn.net", extractNS(URN));
  680.       do {
  681.         rewrite_flag = false;
  682.         terminal = false;
  683.     if (key has been seen) {
  684.       quit with a loop detected error
  685.     }
  686.     add key to list of "seens"
  687.     records = lookup(type=NAPTR, key); // get all NAPTR RRs for 'key'
  688.  
  689.         discard any records with an unknown value in the "flags" field.
  690.         sort NAPTR records by "order" field and "preference" field
  691.             (with "order" being more significant than "preference").
  692.         n_naptrs = number of NAPTR records in response.
  693.         curr_order = records[0].order;
  694.         max_order = records[n_naptrs-1].order;
  695.         
  696.         // Process current batch of NAPTRs according to "order" field.
  697.         for (j=0; j < n_naptrs && records[j].order <= max_order; j++) {
  698.           if (unknown_flag) // skip this record and go to next one
  699.              continue; 
  700.           newkey = rewrite(URN, naptr[j].replacement, naptr[j].regexp);
  701.           if (!newkey) // Skip to next record if the rewrite didn't match
  702.              continue;  
  703.           // We did do a rewrite, shrink max_order to current value
  704.           // so that delegation works properly
  705.           max_order = naptr[j].order;
  706.           // Will we know what to do with the protocol and services
  707.           // specified in the NAPTR? If not, try next record.
  708.           if(!isKnownProto(naptr[j].services)) {
  709.             continue;
  710.           }
  711.           if(!isKnownService(naptr[j].services)) {
  712.             continue;
  713.           }
  714.  
  715.           // At this point we have a successful rewrite and we will know
  716.           // how to speak the protocol and request a known resolution
  717.           // service. Before we do the next lookup, check some
  718.           // optimization possibilities.
  719.           
  720.           if (strcasecmp(flags, "S")
  721.            || strcasecmp(flags, "P"))
  722.            || strcasecmp(flags, "A")) {
  723.              terminal = true;
  724.              services = naptr[j].services;
  725.              addnl = any SRV and/or A records returned as additional info
  726.                      for naptr[j].
  727.           }
  728.           key = newkey;
  729.           rewriteflag = true;
  730.           break;
  731.         }
  732.       } while (rewriteflag && !terminal);
  733.  
  734.       // Did we not find our way to a resolver?
  735.       if (!rewrite_flag) {
  736.          report an error
  737.          return NULL;
  738.       }
  739.  
  740.  
  741.       // Leave rest to another protocol?
  742.       if (strcasecmp(flags, "P")) {
  743.          return key as host to talk to;
  744.       }
  745.  
  746.       // If not, keep plugging
  747.       if (!addnl) { // No SRVs came in as additional info, look them up
  748.         srvs = lookup(type=SRV, key);
  749.       }  
  750.  
  751.       sort SRV records by preference, weight, ...
  752.       foreach (SRV record) { // in order of preference
  753.         try contacting srv[j].target using the protocol and one of the
  754.             resolution service requests from the "services" field of the
  755.             last NAPTR record.
  756.         if (successful)
  757.           return (target, protocol, service);
  758.           // Actually we would probably return a result, but this
  759.           // code was supposed to just tell us a good host to talk to.
  760.       }
  761.       die with an "unable to find a host" error;
  762.     }
  763.  
  764.  
  765. Notes:
  766. ======
  767.   -  A client MUST process multiple NAPTR records in the order specified by
  768.      the "order" field, it MUST NOT simply use the first record that provides
  769.      a known protocol and service combination.
  770.   -  If a record at a particular order matches the URI, but the client
  771.      doesn't know the specified protocol and service, the client SHOULD
  772.      continue to examine records that have the same order. The client
  773.      MUST NOT consider records with a higher value of order. This is
  774.      necessary to make delegation of portions of the namespace work.
  775.      The order field is what lets site administrators say "all requests for
  776.      URIs matching pattern x go to server 1, all others go to server 2".
  777.      (A match is defined as:
  778.         1)  The NAPTR provides a replacement domain name
  779.         or
  780.         2) The regular expression matches the URN
  781.      )
  782.   -  When multiple RRs have the same "order", the client should use
  783.      the value of the preference field to select the next NAPTR to
  784.      consider. However, because of preferred protocols or services,
  785.      estimates of network distance and bandwidth, etc. clients
  786.      may use different criteria to sort the records.
  787.   -  If the lookup after a rewrite fails, clients are strongly encouraged
  788.      to report a failure, rather than backing up to pursue other rewrite
  789.      paths.
  790.   -  When a namespace is to be delegated among a set of resolvers, regexps
  791.      must be used. Each regexp appears in a separate NAPTR RR. Administrators
  792.      should do as little delegation as possible, because of limitations on
  793.      the size of DNS responses.
  794.   -  Note that SRV RRs impose additional requirements on clients.
  795.  
  796.  
  797. Acknowledgments:
  798. =================
  799.  
  800. The editors would like to thank Keith Moore for all his consultations
  801. during the development of this draft. We would also like to thank Paul
  802. Vixie for his assistance in debugging our implementation, and his answers
  803. on our questions. Finally, we would like to acknowledge our enormous
  804. intellectual debt to the participants in the Knoxville series of meetings,
  805. as well as to the participants in the URI and URN working groups.
  806.  
  807.  
  808. References:
  809. ===========
  810.  
  811. [1]  RFC-1737, "Functional Requirements for Uniform Resource Names", Karen
  812.      Sollins and Larry Masinter, Dec. 1994.
  813.  
  814. [2]  The URN Implementors, Uniform Resource Names: A Progress Report,
  815.      http://www.dlib.org/dlib/february96/02arms.html, D-Lib Magazine,
  816.      February 1996.
  817.  
  818. [3]  Ryan Moats, "URN Syntax", draft-ietf-urn-syntax-02.txt, Feb. 1997.
  819.  
  820. [4]  RFC 2052, "A DNS RR for specifying the location of services (DNS SRV)",
  821.      A. Gulbrandsen and P. Vixie, October 1996.
  822.  
  823. [5]  RFC-xxxx, "A Trivial Convention for using HTTP in URN Resolution",
  824.      Ron Daniel Jr., currently available as draft-ietf-urn-http-conv-01.txt,
  825.      Feb. 1997.
  826.  
  827. [6]  RFC-xxxx, "URN Resolution Services", ???, draft-ietf-urn-???
  828.      (This document is on the URN-WG's list of documents to prepare, but
  829.      has not yet been written. It will get its start from the treatment of
  830.      resolution services in [4]).
  831.  
  832. [7]  Keith Moore, Shirley Browne, Jason Cox, and Jonathan Gettler,
  833.      Resource Cataloging and Distribution System, Technical Report CS-97-346,
  834.      University of Tennessee, Knoxville, December 1996
  835.  
  836. [8]  Paul Vixie, personal communication.
  837.  
  838. [9]  RFC-822, "Standard for the Format of ARPA Internet Text Messages",
  839.      Dave H. Crocker, August 1982.  
  840.  
  841. [10] Charles Orth, Bill Arms; Handle Resolution Protocol Specification,
  842.      http://www.handle.net/docs/client_spec.html
  843.  
  844. [11] RFC-1714, "Referral Whois Protocol (RWhois)", S. Williamson and
  845.      M. Kosters, November 1994.
  846.  
  847. [12] Information Retrieval (Z39.50): Application Service Definition and
  848.      Protocol Specification, ANSI/NISO Z39.50-1995, July 1995.
  849.  
  850. [13] IEEE Standard for Information Technology - Portable Operating System
  851.      Interface (POSIX) - Part 2: Shell and Utilities (Vol. 1); IEEE Std
  852.      1003.2-1992; The Institute of Electrical and Electronics Engineers;
  853.      New York; 1993. ISBN:1-55937-255-9
  854.  
  855. [14] RFC-1123, "Requirements for Internet Hosts - Application and Support"
  856.      R. Braden, Oct. 1989.
  857.  
  858. [15] RFC-xxxx, "Requirements and a Framework for URN Resolution Systems",
  859.      Karen Sollins, draft-ietf-urn-req-frame-00.txt, November 1996.
  860.  
  861.  
  862.  
  863. Security Considerations
  864. =======================
  865.   The use of "urn.net" as the registry for URN namespaces is subject to
  866.   denial of service attacks, as well as other DNS spoofing attacks. The
  867.   interactions with DNSSEC are currently being studied. It is expected
  868.   that NAPTR records will be signed with SIG records once the DNSSEC
  869.   work is deployed. 
  870.  
  871.   The rewrite rules make identifiers from other namespaces subject to
  872.   the same attacks as normal domain names. Since they have not been
  873.   easily resolvable before, this may or may not be considered a problem.
  874.  
  875.   Regular expressions should be checked for sanity, not blindly passed
  876.   to something like PERL. 
  877.  
  878. Author Contact Information:
  879. ===========================
  880.  
  881. Ron Daniel
  882. Los Alamos National Laboratory
  883. MS B287
  884. Los Alamos, NM, USA, 87545
  885. voice:  +1 505 665 0597
  886. fax:    +1 505 665 4939
  887. email:  rdaniel@lanl.gov
  888.  
  889.  
  890. Michael Mealling
  891. Network Solutions
  892. 505 Huntmar Park Drive
  893. Herndon, VA  22070
  894. voice: (703) 742-0400
  895. fax: (703) 742-9552
  896. email: michaelm@internic.net
  897. URL: http://www.netsol.com/
  898.  
  899.  
  900.  
  901.  
  902.     This draft expires 05 Sept., 1997.
  903.  
  904. Ron Daniel Jr.                   email: rdaniel@acl.lanl.gov
  905. Advanced Computing Lab, MS B287  voice: (505) 665-0597
  906. Los Alamos National Laboratory     fax: (505) 665-4939
  907. Los Alamos, NM, USA 87545         http://www.acl.lanl.gov/~rdaniel/
  908. Want to buy: "The Five Laws of Library Science" by S.R. Ranganathan
  909.