discovery-api/Overview.html
author Rich Tibbett <richt@opera.com>
Mon, 07 Oct 2013 14:07:57 +1100
changeset 480 f3ea6558ffe1
parent 453 07345c55f11f
child 483 140b6c8d4c18
permissions -rw-r--r--
Add CORS as the primary network service opt-in mechanism for the NSD API specification
     1 <!DOCTYPE html>
     2 <html lang="en"
     3       dir="ltr"
     4       typeof="bibo:Document"
     5       about=""
     6       property="dcterms:language"
     7       content="en">
     8   <head>
     9     <title>
    10       Network Service Discovery
    11     </title>
    12     <meta http-equiv="Content-Type"
    13           content="text/html; charset=utf-8">
    14     <style>
    15 /* Custom ReSpec CSS (by Rich Tibbett) */
    16 
    17      /* Add better spacing to sections */
    18      section, .section { margin-bottom: 2em; }
    19 
    20      /* Add addition spacing to <ol> and <ul> for rule definition */
    21      ol.rule li, ul.rule li { padding:0.6em; }
    22 
    23      pre.widl { border: solid thin; background: #EEEEEE; color: black; padding: 0.5em 1em; position: relative; }
    24      pre.widl :link, pre.widl :visited { color: #000; background: transparent; }
    25      pre.widl:before { content: "IDL"; font: bold small sans-serif; padding: 0.5em; background: white; position: absolute; top: 0; margin: -1px 0 0 -4em; width: 1.5em; border: thin solid; border-radius: 0 0 0 0.5em }
    26 
    27      div.example { border: solid thin black; background: #FFFFF0; color: black; padding: 0.5em 1em; position: relative; margin: 1em 0 1em 4.6em; width: auto; }
    28      div.example:before { content: "EXAMPLE"; font: bold small sans-serif; padding: 0.5em; background: white; color: black; position: absolute; top: 0; margin: -1px 0 0 -7.6em; width: 5em; border: thin solid black; border-radius: 0 0 0 0.5em }
    29 
    30      dl.domintro { color: green; margin: 2em 0 2em 2em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
    31      hr + dl.domintro, div.impl + dl.domintro { margin-top: 2.5em; margin-bottom: 1.5em; }
    32      dl.domintro dt, dl.domintro dt * { color: black; text-decoration: none; }
    33      dl.domintro dd { margin: 0.5em 0 1em 2em; padding: 0; }
    34      dl.domintro dd p { margin: 0.5em 0; }
    35      dl.domintro code {font-size: inherit; font-style: italic; }
    36      dl.domintro:before { display: table; margin: -1em -0.5em 0.5em auto; width: auto; content: 'This box is non-normative. Implementation requirements are given below this box.'; color: red; border: solid 2px; background: white; padding: 0 0.25em; font-size:0.8em; }
    37 
    38      table { border-collapse:collapse; border-style:hidden hidden none hidden }
    39      table thead { border-bottom:solid }
    40      table tbody th:first-child { border-left:solid }
    41      table td, table th { border-left:solid; border-right:solid; border-bottom:solid thin; vertical-align:top; padding:0.2em }
    42     </style>
    43     <style>
    44 /*****************************************************************
    45     * ReSpec 3 CSS
    46     * Robin Berjon - http://berjon.com/
    47     *****************************************************************/
    48 
    49     /* --- INLINES --- */
    50     em.rfc2119 {
    51     text-transform:     lowercase;
    52     font-variant:       small-caps;
    53     font-style:         normal;
    54     color:              #900;
    55     }
    56 
    57     h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym,
    58     h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr {
    59     border: none;
    60     }
    61 
    62     dfn {
    63     font-weight:    bold;
    64     }
    65 
    66     a.internalDFN {
    67     color:  inherit;
    68     border-bottom:  1px solid #99c;
    69     text-decoration:    none;
    70     }
    71 
    72     a.externalDFN {
    73     color:  inherit;
    74     border-bottom:  1px dotted #ccc;
    75     text-decoration:    none;
    76     }
    77 
    78     a.bibref {
    79     text-decoration:    none;
    80     }
    81 
    82     cite .bibref {
    83     font-style: normal;
    84     }
    85 
    86     code {
    87     color:  #ff4500;
    88     }
    89 
    90     /* --- TOC --- */
    91     .toc a, .tof a {
    92     text-decoration:    none;
    93     }
    94 
    95     a .secno, a .figno {
    96     color:  #000;
    97     }
    98 
    99     ul.tof, ol.tof {
   100     list-style: none outside none;
   101     }
   102 
   103     .caption {
   104     margin-top: 0.5em;
   105     font-style:   italic;
   106     }
   107 
   108     /* --- TABLE --- */
   109     table.simple {
   110     border-spacing: 0;
   111     border-collapse:    collapse;
   112     border-bottom:  3px solid #005a9c;
   113     }
   114 
   115     .simple th {
   116     background: #005a9c;
   117     color:  #fff;
   118     padding:    3px 5px;
   119     text-align: left;
   120     }
   121 
   122     .simple th[scope="row"] {
   123     background: inherit;
   124     color:  inherit;
   125     border-top: 1px solid #ddd;
   126     }
   127 
   128     .simple td {
   129     padding:    3px 10px;
   130     border-top: 1px solid #ddd;
   131     }
   132 
   133     .simple tr:nth-child(even) {
   134     background: #f0f6ff;
   135     }
   136 
   137     /* --- DL --- */
   138     .section dd > p:first-child {
   139     margin-top: 0;
   140     }
   141 
   142     .section dd > p:last-child {
   143     margin-bottom: 0;
   144     }
   145 
   146     .section dd {
   147     margin-bottom:  1em;
   148     }
   149 
   150     .section dl.attrs dd, .section dl.eldef dd {
   151     margin-bottom:  0;
   152     }
   153     </style>
   154     <style>
   155 /* --- ISSUES/NOTES --- */
   156     div.issue-title, div.note-title {
   157     padding-right:  1em;
   158     min-width: 7.5em;
   159     color: #b9ab2d;
   160     }
   161     div.issue-title { color: #e05252; }
   162     div.note-title { color: #2b2; }
   163     div.issue-title span, div.note-title span {
   164     text-transform: uppercase;
   165     }
   166     div.note, div.issue {
   167     margin-top: 1em;
   168     margin-bottom: 1em;
   169     }
   170     .note > p:first-child, .issue > p:first-child { margin-top: 0 }
   171     .issue, .note {
   172     padding: .5em;
   173     border-left-width: .5em;
   174     border-left-style: solid;
   175     }
   176     div.issue, div.note {
   177     padding: 1em 1.2em 0.5em;
   178     margin: 1em 0;
   179     position: relative;
   180     clear: both;
   181     }
   182     span.note, span.issue { padding: .1em .5em .15em; }
   183 
   184     .issue {
   185     border-color: #e05252;
   186     background: #fbe9e9;
   187     }
   188     .note {
   189     border-color: #52e052;
   190     background: #e9fbe9;
   191     }
   192 
   193 
   194     </style>
   195     <style>
   196 /* HIGHLIGHTS */
   197     code.prettyprint {
   198     color:  inherit;
   199     }
   200 
   201     /* this from google-code-prettify */
   202     .pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
   203     </style>
   204     <link rel="stylesheet"
   205           href="https://www.w3.org/StyleSheets/TR/W3C-ED">
   206   </head>
   207   <body class="h-entry"
   208         style=""
   209         role="document"
   210         id="respecDocument">
   211     <div class="head"
   212          role="contentinfo"
   213          id="respecHeader">
   214       <p>
   215         <a href="http://www.w3.org/"><img width="72"
   216              height="48"
   217              src="https://www.w3.org/Icons/w3c_home"
   218              alt="W3C"></a>
   219       </p>
   220       <h1 class="title p-name"
   221           id="title"
   222           property="dcterms:title">
   223         Network Service Discovery
   224       </h1>
   225       <h2 property="dcterms:issued"
   226           datatype="xsd:dateTime"
   227           content="2013-10-06T16:06:07.000Z"
   228           id="w3c-editor-s-draft-07-october-2013">
   229         <abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft <time class="dt-published"
   230             datetime="2013-10-07">07 October 2013</time>
   231       </h2>
   232       <dl>
   233         <dt>
   234           This version:
   235         </dt>
   236         <dd>
   237           <a class="u-url"
   238               href=
   239               "http://dvcs.w3.org/hg/dap/raw-file/tip/discovery-api/Overview.html">http://dvcs.w3.org/hg/dap/raw-file/tip/discovery-api/Overview.html</a>
   240         </dd>
   241         <dt>
   242           Latest published version:
   243         </dt>
   244         <dd>
   245           <a href="http://www.w3.org/TR/discovery-api/">http://www.w3.org/TR/discovery-api/</a>
   246         </dd>
   247         <dt>
   248           Latest editor's draft:
   249         </dt>
   250         <dd>
   251           <a href=
   252           "http://dvcs.w3.org/hg/dap/raw-file/tip/discovery-api/Overview.html">http://dvcs.w3.org/hg/dap/raw-file/tip/discovery-api/Overview.html</a>
   253         </dd>
   254         <dt>
   255           Editor:
   256         </dt>
   257         <dd class="p-author h-card vcard"
   258             rel="bibo:editor"
   259             inlist="">
   260           <span typeof="foaf:Person"><span property="foaf:name"
   261                 class="p-name fn">Rich Tibbett</span>, <a rel="foaf:workplaceHomepage"
   262              class="p-org org h-org h-card"
   263              href="http://opera.com/">Opera Software ASA</a></span>
   264         </dd>
   265       </dl>
   266       <p class="copyright">
   267         <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2013 <a href=
   268         "http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href=
   269         "http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href=
   270         "http://www.ercim.eu/"><abbr title=
   271         "European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href=
   272         "http://www.keio.ac.jp/">Keio</a>, <a href="http://ev.buaa.edu.cn/">Beihang</a>), All Rights Reserved.
   273         <abbr title="World Wide Web Consortium">W3C</abbr> <a href=
   274         "http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href=
   275         "http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href=
   276         "http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.
   277       </p>
   278       <hr>
   279     </div>
   280     <section id="abstract"
   281              class="introductory"
   282              property="dcterms:abstract"
   283              datatype=""
   284              typeof="bibo:Chapter"
   285              resource="#abstract"
   286              rel="bibo:chapter">
   287       <h2 aria-level="1"
   288           role="heading"
   289           id="h2_abstract">
   290         Abstract
   291       </h2>
   292       <p>
   293         This specification defines a mechanism for an HTML document to discover and subsequently communicate with
   294         <abbr title="Hypertext Transfer Protocol">HTTP</abbr>-based services advertised via common discovery protocols
   295         within the current network.
   296       </p>
   297     </section>
   298     <section id="sotd"
   299              class="introductory"
   300              typeof="bibo:Chapter"
   301              resource="#sotd"
   302              rel="bibo:chapter">
   303       <h2 aria-level="1"
   304           role="heading"
   305           id="h2_sotd">
   306         Status of This Document
   307       </h2>
   308       <p>
   309         <em>This section describes the status of this document at the time of its publication. Other documents may
   310         supersede this document. A list of current <abbr title="World Wide Web Consortium">W3C</abbr> publications and
   311         the latest revision of this technical report can be found in the <a href="http://www.w3.org/TR/"><abbr title=
   312         "World Wide Web Consortium">W3C</abbr> technical reports index</a> at http://www.w3.org/TR/.</em>
   313       </p>
   314       <p>
   315         This document represents the early consensus of the group on the scope and features of the proposed
   316         <abbr title="Application Programming Interface">API</abbr>.
   317       </p>
   318       <p>
   319         This document was published by the <a href="http://www.w3.org/2009/dap/">Device APIs Working Group</a> as an
   320         Editor's Draft. If you wish to make comments regarding this document, please send them to <a href=
   321         "mailto:public-device-apis@w3.org">public-device-apis@w3.org</a> (<a href=
   322         "mailto:public-device-apis-request@w3.org?subject=subscribe">subscribe</a>, <a href=
   323         "http://lists.w3.org/Archives/Public/public-device-apis/">archives</a>). All comments are welcome.
   324       </p>
   325       <p>
   326         Publication as an Editor's Draft does not imply endorsement by the <abbr title=
   327         "World Wide Web Consortium">W3C</abbr> Membership. This is a draft document and may be updated, replaced or
   328         obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in
   329         progress.
   330       </p>
   331       <p>
   332         This document was produced by a group operating under the <a id="sotd_patent"
   333            about=""
   334            rel="w3p:patentRules"
   335            href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 <abbr title=
   336            "World Wide Web Consortium">W3C</abbr> Patent Policy</a>. <abbr title="World Wide Web Consortium">W3C</abbr>
   337            maintains a <a href="http://www.w3.org/2004/01/pp-impl/43696/status"
   338            rel="disclosure">public list of any patent disclosures</a> made in connection with the deliverables of the
   339            group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge
   340            of a patent which the individual believes contains <a href=
   341            "http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose
   342            the information in accordance with <a href=
   343            "http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the <abbr title=
   344            "World Wide Web Consortium">W3C</abbr> Patent Policy</a>.
   345       </p>
   346     </section>
   347     <section id="toc">
   348       <h2 class="introductory"
   349           aria-level="1"
   350           role="heading"
   351           id="h2_toc">
   352         Table of Contents
   353       </h2>
   354       <ul class="toc"
   355           role="directory"
   356           id="respecContents">
   357         <li class="tocline">
   358           <a href="#introduction"
   359               class="tocxref"><span class="secno">1.</span> Introduction</a>
   360         </li>
   361         <li class="tocline">
   362           <a href="#conformance"
   363               class="tocxref"><span class="secno">2.</span> Conformance</a>
   364           <ul class="toc">
   365             <li class="tocline">
   366               <a href="#dependencies"
   367                   class="tocxref"><span class="secno">2.1</span> Dependencies</a>
   368             </li>
   369           </ul>
   370         </li>
   371         <li class="tocline">
   372           <a href="#terminology"
   373               class="tocxref"><span class="secno">3.</span> Terminology</a>
   374         </li>
   375         <li class="tocline">
   376           <a href="#security-and-privacy-considerations"
   377               class="tocxref"><span class="secno">4.</span> Security and privacy considerations</a>
   378           <ul class="toc">
   379             <li class="tocline">
   380               <a href="#security-considerations-for-api-implementations"
   381                   class="tocxref"><span class="secno">4.1</span> Security considerations for <abbr title=
   382                   "Application Programming Interface">API</abbr> implementations</a>
   383             </li>
   384             <li class="tocline">
   385               <a href="#privacy-considerations-for-api-implementations"
   386                   class="tocxref"><span class="secno">4.2</span> Privacy considerations for <abbr title=
   387                   "Application Programming Interface">API</abbr> implementations</a>
   388             </li>
   389             <li class="tocline">
   390               <a href="#additional-api-implementation-considerations"
   391                   class="tocxref"><span class="secno">4.3</span> Additional <abbr title=
   392                   "Application Programming Interface">API</abbr> implementation considerations</a>
   393             </li>
   394           </ul>
   395         </li>
   396         <li class="tocline">
   397           <a href="#requesting-networked-services"
   398               class="tocxref"><span class="secno">5.</span> Requesting networked services</a>
   399           <ul class="toc">
   400             <li class="tocline">
   401               <a href="#methods"
   402                   class="tocxref"><span class="secno">5.1</span> Methods</a>
   403             </li>
   404             <li class="tocline">
   405               <a href="#error-handling"
   406                   class="tocxref"><span class="secno">5.2</span> Error Handling</a>
   407             </li>
   408           </ul>
   409         </li>
   410         <li class="tocline">
   411           <a href="#obtaining-networked-services"
   412               class="tocxref"><span class="secno">6.</span> Obtaining networked services</a>
   413           <ul class="toc">
   414             <li class="tocline">
   415               <a href="#attributes"
   416                   class="tocxref"><span class="secno">6.1</span> Attributes</a>
   417             </li>
   418             <li class="tocline">
   419               <a href="#methods-1"
   420                   class="tocxref"><span class="secno">6.2</span> Methods</a>
   421             </li>
   422             <li class="tocline">
   423               <a href="#events"
   424                   class="tocxref"><span class="secno">6.3</span> Events</a>
   425             </li>
   426           </ul>
   427         </li>
   428         <li class="tocline">
   429           <a href="#communicating-with-a-networked-service"
   430               class="tocxref"><span class="secno">7.</span> Communicating with a networked service</a>
   431           <ul class="toc">
   432             <li class="tocline">
   433               <a href="#attributes-1"
   434                   class="tocxref"><span class="secno">7.1</span> Attributes</a>
   435             </li>
   436             <li class="tocline">
   437               <a href="#states"
   438                   class="tocxref"><span class="secno">7.2</span> States</a>
   439             </li>
   440             <li class="tocline">
   441               <a href="#events-1"
   442                   class="tocxref"><span class="secno">7.3</span> Events</a>
   443             </li>
   444           </ul>
   445         </li>
   446         <li class="tocline">
   447           <a href="#service-discovery"
   448               class="tocxref"><span class="secno">8.</span> Service Discovery</a>
   449           <ul class="toc">
   450             <li class="tocline">
   451               <a href="#zeroconf-mdns-dns-sd"
   452                   class="tocxref"><span class="secno">8.1</span> Zeroconf (<abbr title="Multicast DNS">mDNS</abbr> +
   453                   <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr>)</a>
   454             </li>
   455             <li class="tocline">
   456               <a href="#simple-service-discovery-protocol-ssdp"
   457                   class="tocxref"><span class="secno">8.2</span> Simple Service Discovery Protocol (<abbr title=
   458                   "Simple Service Discovery Protocol">SSDP</abbr>)</a>
   459             </li>
   460             <li class="tocline">
   461               <a href="#discovery-and-launch-protocol-dial"
   462                   class="tocxref"><span class="secno">8.3</span> Discovery and Launch Protocol (<abbr title=
   463                   "Discovery and Launch Protocol">DIAL</abbr>)</a>
   464             </li>
   465             <li class="tocline">
   466               <a href="#network-topology-monitoring"
   467                   class="tocxref"><span class="secno">8.4</span> Network Topology Monitoring</a>
   468             </li>
   469           </ul>
   470         </li>
   471         <li class="tocline">
   472           <a href="#events-summary"
   473               class="tocxref"><span class="secno">9.</span> Events Summary</a>
   474         </li>
   475         <li class="tocline">
   476           <a href="#garbage-collection"
   477               class="tocxref"><span class="secno">10.</span> Garbage collection</a>
   478         </li>
   479         <li class="tocline">
   480           <a href="#use-cases-and-requirements"
   481               class="tocxref"><span class="secno">11.</span> Use Cases and Requirements</a>
   482         </li>
   483         <li class="tocline">
   484           <a href="#examples"
   485               class="tocxref"><span class="secno">A.</span> Examples</a>
   486         </li>
   487         <li class="tocline">
   488           <a href="#acknowledgements"
   489               class="tocxref"><span class="secno">B.</span> Acknowledgements</a>
   490         </li>
   491         <li class="tocline">
   492           <a href="#references"
   493               class="tocxref"><span class="secno">C.</span> References</a>
   494           <ul class="toc">
   495             <li class="tocline">
   496               <a href="#normative-references"
   497                   class="tocxref"><span class="secno">C.1</span> Normative references</a>
   498             </li>
   499             <li class="tocline">
   500               <a href="#informative-references"
   501                   class="tocxref"><span class="secno">C.2</span> Informative references</a>
   502             </li>
   503           </ul>
   504         </li>
   505       </ul>
   506     </section>
   507     <section class="informative"
   508              id="introduction">
   509       <h2 aria-level="1"
   510           role="heading"
   511           id="h2_introduction">
   512         <span class="secno">1.</span> Introduction
   513       </h2>
   514       <p>
   515         <em>This section is non-normative.</em>
   516       </p>
   517       <p>
   518         This specification defines the <a href="#navigatornetworkservice"><code>NavigatorNetworkService</code></a>
   519         interface to enable Web pages to connect and communicate with Local-networked Services provided over
   520         <abbr title="Hypertext Transfer Protocol">HTTP</abbr>. This enables access to services and content provided by
   521         home network devices, including the discovery and playback of content available to those devices, both from
   522         services such as traditional broadcast media and internet based services as well as local services. Initial
   523         design goals and requirements provided by the <a href="http://www.w3.org/2011/webtv/"><abbr title=
   524         "World Wide Web Consortium">W3C</abbr> Web &amp; TV interest group</a> are documented in [<cite><a class=
   525         "bibref"
   526            href="#bib-hnreq">hnreq</a></cite>].
   527       </p>
   528       <p>
   529         Using this <abbr title="Application Programming Interface">API</abbr> consists of requesting a well-known
   530         service type, known by developers and advertised by Local-networked Devices. User authorization, where the user
   531         connects the web page to discovered services, is expected before the web page is able to interact with any
   532         Local-networked Services.
   533       </p>
   534       <p>
   535         A web page creates a request to obtain connectivity to services running in the network by specifying a
   536         well-known discovery service type that it wishes to interact with.
   537       </p>
   538       <p>
   539         The user agent, having captured all advertised services on the network from the <a href=
   540         "#dfn-service-discovery-mechanisms"
   541            class="internalDFN">service discovery mechanisms</a> included in this recommendation, attempts to match the
   542            requested service type to a discovered service according to the processing described herein. Only
   543            Local-networked Services that pass a <a href="#dfn-cors-preflight-check"
   544            class="internalDFN">CORS preflight check</a> should be made available to web pages by a user agent. A user
   545            agent may provide a way for users to white-list non-CORS enabled Local-networked Services but implementation
   546            of such a feature is left to the discretion of the implementer.
   547       </p>
   548       <p>
   549         If a service connectivity request is successful then the Web page is provided with a promise-based success
   550         callback with the all necessary information to communicate with the authorized Local-networked Service. If the
   551         request fails then the Web page will receive a promise-based error callback containing an error string
   552         describing the cause of Local-networked Service connectivity failure.
   553       </p>
   554       <p>
   555         Once connected to a Local-networked Service the Web page can send requests and receive responses to the
   556         Local-networked Service via the messaging format and appropriate channel inferred from the service type
   557         authorized via the provided <abbr title="Application Programming Interface">API</abbr>. The Web page, once
   558         connected, can also receive service-pushed events, in the messaging format supported by the Local-networked
   559         Device, if such event subscription functionality is provided by the connected Local-networked Service.
   560       </p>
   561       <p>
   562         Services available within the local network can connect and disconnect at different times during the execution
   563         of a web page. The user agent can inform a web page when the state of networked services matching any of the
   564         requested valid service types change. Web pages can use this information to enable in-page experiences for
   565         communicating the state of networked services with the ability to change the particular service or set of
   566         services the page is connected to (by re-invoking the <a href=
   567         "#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> method defined herein).
   568       </p>
   569       <div class="example">
   570         <p>
   571           Example of requesting a <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr>
   572           advertised service:
   573         </p>
   574         <hr>
   575         <pre class="highlight prettyprint">
   576 <span class="kwd">function</span><span class="pln"> showServices</span><span class="pun">(</span><span class=
   577 "pln"> services </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
   578   </span><span class="com">// Show a list of all the services provided to the web page</span><span class="pln">
   579   </span><span class="kwd">for</span><span class="pun">(</span><span class="kwd">var</span><span class=
   580 "pln"> i </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class=
   581 "pun">,</span><span class="pln"> l </span><span class="pun">=</span><span class="pln"> services</span><span class=
   582 "pun">.</span><span class="pln">length</span><span class="pun">;</span><span class="pln"> i </span><span class=
   583 "pun">&lt;</span><span class="pln"> l</span><span class="pun">;</span><span class="pln"> i</span><span class=
   584 "pun">++)</span><span class="pln"> console</span><span class="pun">.</span><span class="pln">log</span><span class=
   585 "pun">(</span><span class="pln"> services</span><span class="pun">[</span><span class="pln">i</span><span class=
   586 "pun">].</span><span class="pln">name </span><span class="pun">);</span><span class="pln">
   587 </span><span class="pun">}</span><span class="pln">
   588 
   589 navigator</span><span class="pun">.</span><span class="pln">getNetworkServices</span><span class=
   590 "pun">(</span><span class="str">'zeroconf:_boxee-jsonrpc._tcp'</span><span class="pun">).</span><span class=
   591 "kwd">then</span><span class="pun">(</span><span class="pln">showServices</span><span class="pun">);</span>
   592 </pre>
   593       </div>
   594       <div class="example">
   595         <p>
   596           Example of requesting a UPnP advertised service, also handling error conditions:
   597         </p>
   598         <hr>
   599         <pre class="highlight prettyprint">
   600 <span class="kwd">function</span><span class="pln"> showServices</span><span class="pun">(</span><span class=
   601 "pln"> services </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
   602   </span><span class="com">// Show a list of all the services provided to the web page</span><span class="pln">
   603   </span><span class="kwd">for</span><span class="pun">(</span><span class="kwd">var</span><span class=
   604 "pln"> i </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class=
   605 "pun">,</span><span class="pln"> l </span><span class="pun">=</span><span class="pln"> services</span><span class=
   606 "pun">.</span><span class="pln">length</span><span class="pun">;</span><span class="pln"> i </span><span class=
   607 "pun">&lt;</span><span class="pln"> l</span><span class="pun">;</span><span class="pln"> i</span><span class=
   608 "pun">++)</span><span class="pln"> console</span><span class="pun">.</span><span class="pln">log</span><span class=
   609 "pun">(</span><span class="pln"> services</span><span class="pun">[</span><span class="pln">i</span><span class=
   610 "pun">].</span><span class="pln">name </span><span class="pun">);</span><span class="pln">
   611 </span><span class="pun">}</span><span class="pln">
   612 
   613 </span><span class="kwd">function</span><span class="pln"> error</span><span class="pun">(</span><span class=
   614 "pln"> e </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
   615   console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class=
   616 "pln"> </span><span class="str">"Error occurred: "</span><span class="pln"> </span><span class=
   617 "pun">+</span><span class="pln"> e</span><span class="pun">.</span><span class="pln">name </span><span class=
   618 "pun">);</span><span class="pln">
   619 </span><span class="pun">}</span><span class="pln">
   620 
   621 navigator</span><span class="pun">.</span><span class="pln">getNetworkServices</span><span class=
   622 "pun">(</span><span class="str">'upnp:urn:schemas-upnp-org:service:ContentDirectory:1'</span><span class=
   623 "pun">).</span><span class="kwd">then</span><span class="pun">(</span><span class="pln">showServices</span><span class=
   624 "pun">,</span><span class="pln"> error</span><span class="pun">);</span>
   625 </pre>
   626       </div>
   627       <div class="example">
   628         <p>
   629           Example of requesting either a <abbr title="Domain Name System">DNS</abbr>-<abbr title=
   630           "Service Discovery">SD</abbr> or UPnP advertised service:
   631         </p>
   632         <hr>
   633         <pre class="highlight prettyprint">
   634 <span class="kwd">function</span><span class="pln"> showServices</span><span class="pun">(</span><span class=
   635 "pln"> services </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
   636   </span><span class=
   637 "com">// Show a list of all the services provided to the web page (+ service type)</span><span class="pln">
   638   </span><span class="kwd">for</span><span class="pun">(</span><span class="kwd">var</span><span class=
   639 "pln"> i </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class=
   640 "pun">,</span><span class="pln"> l </span><span class="pun">=</span><span class="pln"> services</span><span class=
   641 "pun">.</span><span class="pln">length</span><span class="pun">;</span><span class="pln"> i </span><span class=
   642 "pun">&lt;</span><span class="pln"> l</span><span class="pun">;</span><span class="pln"> i</span><span class=
   643 "pun">++)</span><span class="pln">
   644      console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class=
   645 "pln"> services</span><span class="pun">[</span><span class="pln">i</span><span class="pun">].</span><span class=
   646 "pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">'('</span><span class=
   647 "pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class=
   648 "pln">i</span><span class="pun">].</span><span class="pln">type </span><span class="pun">+</span><span class=
   649 "pln"> </span><span class="str">')'</span><span class="pln"> </span><span class="pun">);</span><span class="pln">
   650 </span><span class="pun">}</span><span class="pln">
   651 
   652 navigator</span><span class="pun">.</span><span class="pln">getNetworkServices</span><span class=
   653 "pun">([</span><span class="pln">
   654   </span><span class="str">'zeroconf:_boxee-jsonrpc._tcp'</span><span class="pun">,</span><span class="pln">
   655   </span><span class="str">'upnp:urn:schemas-upnp-org:service:ContentDirectory:1'</span><span class="pln">
   656 </span><span class="pun">]).</span><span class="kwd">then</span><span class="pun">(</span><span class=
   657 "pln">showServices</span><span class="pun">);</span>
   658 </pre>
   659       </div>
   660       <p>
   661         For more detailed examples, including examples of communicating with obtained networked services, see the
   662         <a href="#examples">Examples</a> section.
   663       </p>
   664     </section>
   665     <section id="conformance"
   666              typeof="bibo:Chapter"
   667              resource="#conformance"
   668              rel="bibo:chapter">
   669       <h2 aria-level="1"
   670           role="heading"
   671           id="h2_conformance">
   672         <span class="secno">2.</span> Conformance
   673       </h2>
   674       <p>
   675         As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this
   676         specification are non-normative. Everything else in this specification is normative.
   677       </p>
   678       <p>
   679         The key words <em class="rfc2119"
   680            title="MUST">MUST</em>, <em class="rfc2119"
   681            title="MUST NOT">MUST NOT</em>, <em class="rfc2119"
   682            title="REQUIRED">REQUIRED</em>, <em class="rfc2119"
   683            title="SHOULD">SHOULD</em>, <em class="rfc2119"
   684            title="SHOULD NOT">SHOULD NOT</em>, <em class="rfc2119"
   685            title="RECOMMENDED">RECOMMENDED</em>, <em class="rfc2119"
   686            title="MAY">MAY</em>, and <em class="rfc2119"
   687            title="OPTIONAL">OPTIONAL</em> in this specification are to be interpreted as described in [<cite><a class=
   688            "bibref"
   689            href="#bib-RFC2119">RFC2119</a></cite>].
   690       </p>
   691       <p>
   692         Requirements phrased in the imperative as part of algorithms (such as "strip any leading space characters" or
   693         "return false and abort these steps") are to be interpreted with the meaning of the key word ("must", "should",
   694         "may", etc) used in introducing the algorithm.
   695       </p>
   696       <p>
   697         Some conformance requirements are phrased as requirements on attributes, methods or objects. Such requirements
   698         are to be interpreted as requirements on user agents.
   699       </p>
   700       <p>
   701         Conformance requirements phrased as algorithms or specific steps <em class="rfc2119"
   702            title="MAY">MAY</em> be implemented in any manner, so long as the end result is equivalent. (In particular,
   703            the algorithms defined in this specification are intended to be easy to follow, and not intended to be
   704            performant.)
   705       </p>
   706       <p>
   707         The only conformance class defined by this specification is a <dfn id="dfn-user-agent">user agent</dfn>.
   708       </p>
   709       <p>
   710         User agents <em class="rfc2119"
   711            title="MAY">MAY</em> impose implementation-specific limits on otherwise unconstrained inputs, e.g. to
   712            prevent denial of service attacks, to guard against running out of memory, or to work around
   713            platform-specific limitations.
   714       </p>
   715       <p>
   716         When support for a feature is disabled (e.g. as an emergency measure to mitigate a security problem, or to aid
   717         in development, or for performance reasons), user agents <em class="rfc2119"
   718            title="MUST">MUST</em> act as if they had no support for the feature whatsoever, and as if the feature was
   719            not mentioned in this specification. For example, if a particular feature is accessed via an attribute in a
   720            Web IDL interface, the attribute itself would be omitted from the objects that implement that interface -
   721            leaving the attribute on the object but making it return null or throw an exception is insufficient.
   722       </p>
   723       <section id="dependencies">
   724         <h3 aria-level="2"
   725             role="heading"
   726             id="h3_dependencies">
   727           <span class="secno">2.1</span> Dependencies
   728         </h3>This specification relies on several other underlying specifications.
   729         <dl>
   730           <dt>
   731             HTML
   732           </dt>
   733           <dd>
   734             Many fundamental concepts from HTML are used by this specification. [<cite><a class="bibref"
   735                href="#bib-HTML5">HTML5</a></cite>]
   736           </dd>
   737           <dt>
   738             WebIDL
   739           </dt>
   740           <dd>
   741             The IDL blocks in this specification use the semantics of the WebIDL specification. [<cite><a class=
   742             "bibref"
   743                href="#bib-WEBIDL">WEBIDL</a></cite>]
   744           </dd>
   745         </dl>
   746       </section>
   747     </section>
   748     <section id="terminology">
   749       <h2 aria-level="1"
   750           role="heading"
   751           id="h2_terminology">
   752         <span class="secno">3.</span> Terminology
   753       </h2>
   754       <p>
   755         The construction "a <code>Foo</code> object", where <code>Foo</code> is actually an interface, is sometimes
   756         used instead of the more accurate "an object implementing the interface <code>Foo</code>".
   757       </p>
   758       <p>
   759         The term DOM is used to refer to the <abbr title="Application Programming Interface">API</abbr> set made
   760         available to scripts in Web applications, and does not necessarily imply the existence of an actual
   761         <code>Document</code> object or of any other <code>Node</code> objects as defined in the DOM Core
   762         specifications. [<cite><a class="bibref"
   763            href="#bib-DOM4">DOM4</a></cite>]
   764       </p>
   765       <p>
   766         An IDL attribute is said to be <em>getting</em> when its value is being retrieved (e.g. by author script), and
   767         is said to be <em>setting</em> when a new value is assigned to it.
   768       </p>
   769       <p>
   770         A <dfn id="dfn-valid-service-type">valid service type</dfn> is any of the following:
   771       </p>
   772       <ul>
   773         <li>a string that begins with <code>upnp:</code> or <code>zeroconf:</code> followed by one or more characters
   774         in the ranges U+0021, U+0023 to U+0027, U+002A to U+002B, U+002D to U+002E, U+0030 to U+0039, U+0041 to U+005A,
   775         U+005E to U+007E.
   776         </li>
   777         <li>a string that begins with <code>dial:</code> followed by an integer version.
   778         </li>
   779       </ul>
   780       <p>
   781         A <a href="#dfn-valid-service-type"
   782            class="internalDFN">valid service type</a> provided in the <code>type</code> attribute of the <a href=
   783            "#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> method will be matched against the
   784            services currently contained in the <a href="#dfn-list-of-available-service-records"
   785            class="internalDFN">list of available service records</a> according to the algorithms defined in this
   786            specification.
   787       </p>
   788       <p>
   789         A <dfn id="dfn-user-agent-generated-callback-url">user-agent generated callback url</dfn> is a Local-network
   790         accessible URL endpoint that a <a href="#dfn-user-agent"
   791            class="internalDFN">user agent</a> generates and maintains for receiving <abbr title=
   792            "Hypertext Transfer Protocol">HTTP</abbr> NOTIFY requests from UPnP Event sources. It is only required when
   793            the user agent implements UPnP Service Discovery as defined in this specification.
   794       </p>
   795       <p>
   796         In this specification we use the following terms to describe the processes required for Local-networked
   797         Services management:
   798       </p>
   799       <ul>
   800         <li>A <dfn id="dfn-new-service">new service</dfn> is a Local-networked Service that has not previously been
   801         discovered or registered in the <a href="#dfn-list-of-available-service-records"
   802               class="internalDFN">list of available service records</a>.
   803         </li>
   804         <li>An <dfn id="dfn-existing-service">existing service</dfn> is a Local-networked Service that has previously
   805         been discovered and is registered in the <a href="#dfn-list-of-available-service-records"
   806               class="internalDFN">list of available service records</a>.
   807         </li>
   808         <li>A <dfn id="dfn-current-service">current service</dfn> is a Local-networked Service, represented by a
   809         <a href="#networkservice"><code>NetworkService</code></a> object, that is currently being shared with a web
   810         page via a <a href="#networkservices"><code>NetworkServices</code></a> object registered in the <a href=
   811         "#dfn-list-of-active-service-managers"
   812               class="internalDFN">list of active service managers</a>.
   813         </li>
   814       </ul>
   815       <p>
   816         A <dfn id="dfn-network-services-whitelist">network services whitelist</dfn> is a list of zero or more <a href=
   817         "#dfn-valid-service-type"
   818            class="internalDFN">valid service type</a> tokens that, when matched to a service type discovered in the
   819            local network, enables that service to be shared with a web page even if that Local-networked Service does
   820            not itself allow Cross-Origin Resource Sharing [<cite><a class="bibref"
   821            href="#bib-CORS">CORS</a></cite>]. A <a href="#dfn-user-agent"
   822            class="internalDFN">user agent</a> <em class="rfc2119"
   823            title="MUST">MUST</em> simulate CORS support for all service interaction in this case. Implementation of
   824            this feature is at implementer's discretion. When a <a href="#dfn-user-agent"
   825            class="internalDFN">user agent</a> does not implement a <a href="#dfn-network-services-whitelist"
   826            class="internalDFN">network services whitelist</a> then it is to treat this as always being an empty list.
   827       </p>
   828     </section>
   829     <section id="security-and-privacy-considerations">
   830       <h2 aria-level="1"
   831           role="heading"
   832           id="h2_security-and-privacy-considerations">
   833         <span class="secno">4.</span> Security and privacy considerations
   834       </h2>
   835       <p>
   836         The <abbr title="Application Programming Interface">API</abbr> defined in this specification can be used to
   837         find and connect to devices and services within a user's current network. This discloses information related to
   838         a user's network: devices available on their network and the publicly-accessible services ("networked
   839         services") currently running and available on those devices. The distribution of this information could
   840         potentially compromise the user's privacy. A conforming implementation of this specification <em class=
   841         "rfc2119"
   842            title="MUST">MUST</em> provide a mechanism that protects the user's privacy. This mechanism <em class=
   843            "rfc2119"
   844            title="MUST">MUST</em> ensure that no networked service information is retrievable without the user's
   845            express permission.
   846       </p>
   847       <section id="security-considerations-for-api-implementations">
   848         <h3 aria-level="2"
   849             role="heading"
   850             id="h3_security-considerations-for-api-implementations">
   851           <span class="secno">4.1</span> Security considerations for <abbr title=
   852           "Application Programming Interface">API</abbr> implementations
   853         </h3>
   854         <p>
   855           A <a href="#dfn-user-agent"
   856              class="internalDFN">user agent</a> <em class="rfc2119"
   857              title="MUST">MUST</em> allow web pages to connect only with Local-networked Services that have passed a
   858              <a href="#dfn-cors-preflight-check"
   859              class="internalDFN">CORS preflight check</a> indicating they support Cross-Origin Resource Sharing
   860              [<cite><a class="bibref"
   861              href="#bib-CORS">CORS</a></cite>] during the <a href="#dfn-service-discovery-mechanisms"
   862              class="internalDFN">service discovery mechanisms</a> provided in this specification. In this way, a
   863              <a href="#dfn-user-agent"
   864              class="internalDFN">user agent</a> <em class="rfc2119"
   865              title="MUST NOT">MUST NOT</em> allow web pages to access other arbitrary networked services on the current
   866              local network.
   867         </p>
   868         <p>
   869           A <a href="#dfn-user-agent"
   870              class="internalDFN">user agent</a> <em class="rfc2119"
   871              title="MAY">MAY</em> provide a way for users to enable access to non-CORS enabled Local-networked Services
   872              from web pages (i.e. operate a <a href="#dfn-network-services-whitelist"
   873              class="internalDFN">network services whitelist</a>). Implementation of such a <a href=
   874              "#dfn-network-services-whitelist"
   875              class="internalDFN">network services whitelist</a>, if any, is left to an implementer's discretion. Such a
   876              whitelist may be configurable by each user at runtime or may be managed by the implementation itself on
   877              behalf of its users. In the case that a <a href="#dfn-user-agent"
   878              class="internalDFN">user agent</a> provides a <a href="#dfn-network-services-whitelist"
   879              class="internalDFN">network services whitelist</a>, it <em class="rfc2119"
   880              title="MUST">MUST</em> act as if all URLs for the Local-networked Service corresponding to any previously
   881              whitelisted service type had Cross-Origin Resource Sharing [<cite><a class="bibref"
   882              href="#bib-CORS">CORS</a></cite>] enabled indefinitely.
   883         </p>
   884       </section>
   885       <section id="privacy-considerations-for-api-implementations">
   886         <h3 aria-level="2"
   887             role="heading"
   888             id="h3_privacy-considerations-for-api-implementations">
   889           <span class="secno">4.2</span> Privacy considerations for <abbr title=
   890           "Application Programming Interface">API</abbr> implementations
   891         </h3>
   892         <p>
   893           A <a href="#dfn-user-agent"
   894              class="internalDFN">user agent</a> <em class="rfc2119"
   895              title="MUST NOT">MUST NOT</em> provide networked service information to web sites without the express
   896              permission of the user. A user agent <em class="rfc2119"
   897              title="MUST">MUST</em> acquire permission through a user interface, unless they have prearranged trust
   898              relationships with users, as described below. The user interface <em class="rfc2119"
   899              title="MUST">MUST</em> include the document base URL. Those permissions that are acquired through the user
   900              interface and that are preserved beyond the current browsing session (i.e. beyond the time when the
   901              browsing context is navigated to another URL) <em class="rfc2119"
   902              title="MUST">MUST</em> be revocable and a user agent <em class="rfc2119"
   903              title="MUST">MUST</em> respect revoked permissions.
   904         </p>
   905         <p>
   906           Obtaining the user's express permission to access one <abbr title=
   907           "Application Programming Interface">API</abbr> method does not imply the user has granted permission for the
   908           same web site to access any other methods that may be provided by this <abbr title=
   909           "Application Programming Interface">API</abbr>, or to access the same method with a different set of
   910           arguments, as part of the same permission context. If a user has expressed permission for an implementation
   911           to, e.g. find a set of existing networked services, the implementation <em class="rfc2119"
   912              title="MUST">MUST</em> seek the user's express permission if and when any subsequent functions are called
   913              on this <abbr title="Application Programming Interface">API</abbr>.
   914         </p>
   915         <p>
   916           A user agent <em class="rfc2119"
   917              title="MAY">MAY</em> have prearranged trust relationships that do not require such user interfaces. For
   918              example, while a web browser will present a user interface when a web site performs a networked service
   919              lookup, a different runtime may have a prearranged, delegated security relationship with the user and, as
   920              such, a suitable alternative security and privacy mechanism with which to authorise the retrieval of
   921              networked service information.
   922         </p>
   923       </section>
   924       <section class="informative"
   925                id="additional-api-implementation-considerations">
   926         <h3 aria-level="2"
   927             role="heading"
   928             id="h3_additional-api-implementation-considerations">
   929           <span class="secno">4.3</span> Additional <abbr title="Application Programming Interface">API</abbr>
   930           implementation considerations
   931         </h3>
   932         <p>
   933           <em>This section is non-normative.</em>
   934         </p>
   935         <p>
   936           Further to the requirements listed in the previous section, implementers of the Network Service Discovery
   937           <abbr title="Application Programming Interface">API</abbr> are also advised to consider the following aspects
   938           that can negatively affect the privacy of their users: in certain cases, users can inadvertently grant
   939           permission to the user agent to disclose networked services to Web sites. In other cases, the content hosted
   940           at a certain URL changes in such a way that previously granted networked service permissions no longer apply
   941           as far as the user is concerned. Or the users might simply change their minds.
   942         </p>
   943         <p>
   944           Predicting or preventing these situations is inherently difficult. Mitigation and in-depth defensive measures
   945           are an implementation responsibility and not prescribed by this specification. However, in designing these
   946           measures, implementers are advised to enable user awareness of networked service sharing, and to provide easy
   947           access to interfaces that enable revocation of permissions that web applications have for accessing networked
   948           services via this <abbr title="Application Programming Interface">API</abbr>.
   949         </p>
   950       </section>
   951     </section>
   952     <section id="requesting-networked-services">
   953       <h2 aria-level="1"
   954           role="heading"
   955           id="h2_requesting-networked-services">
   956         <span class="secno">5.</span> Requesting networked services
   957       </h2>
   958       <pre class="widl">
   959 [Supplemental, NoInterfaceObject]
   960 interface <dfn id="navigatornetworkservice">NavigatorNetworkService</dfn> {
   961   <a class="externalDFN"
   962      href="http://dom.spec.whatwg.org/#promise">Promise</a> <a href=
   963      "#dom-navigator-getnetworkservices">getNetworkServices</a>( in any type );
   964 };
   965 
   966 <a class="externalDFN"
   967      href=
   968      "http://www.whatwg.org/specs/web-apps/current-work/complete/timers.html#navigator">Navigator</a> implements <a href=
   969      "#navigatornetworkservice">NavigatorNetworkService</a>;
   970 </pre>
   971       <section id="methods">
   972         <h3 aria-level="2"
   973             role="heading"
   974             id="h3_methods">
   975           <span class="secno">5.1</span> Methods
   976         </h3>
   977         <dl class="domintro">
   978           <dt>
   979             <var title="">promise</var> = <var title="">window</var> . <code title="dom-navigator"><a href=
   980             "http://www.whatwg.org/specs/web-apps/current-work/complete/timers.html#navigator">navigator</a></code> .
   981             <code title="dom-navigator-getNetworkServices"><a href=
   982             "#dom-navigator-getnetworkservices">getNetworkServices</a></code> ( <var title="">type</var> )
   983           </dt>
   984           <dd>
   985             <p>
   986               Immediately returns a new <a href="http://dom.spec.whatwg.org/#promise"
   987                  class="externalDFN">Promise</a> object and then the user is prompted to select discovered network
   988                  services that have advertised support for the requested service type(s).
   989             </p>
   990             <p>
   991               The <var title="">type</var> argument contains one or more <a href="#dfn-valid-service-type"
   992                  class="internalDFN">valid service type</a> tokens that the web page would like to interact with.
   993             </p>
   994             <p>
   995               If the user accepts, the <var title="">promise</var> object is <a class="externalDFN"
   996                  href="http://dom.spec.whatwg.org/#concept-resolver-resolve">resolved</a>, with a <a href=
   997                  "#networkservices"><code>NetworkServices</code></a> object as its argument.
   998             </p>
   999             <p>
  1000               If the user declines, or an error occurs, the <var title="">promise</var> object is <a class=
  1001               "externalDFN"
  1002                  href="http://dom.spec.whatwg.org/#concept-resolver-reject">rejected</a>.
  1003             </p>
  1004           </dd>
  1005         </dl>
  1006         <div>
  1007           <p>
  1008             When the <dfn id="dom-navigator-getnetworkservices"
  1009                title="dom-navigator-getnetworkservices"><code>getNetworkServices(type)</code></dfn> method is called,
  1010                the <a href="#dfn-user-agent"
  1011                class="internalDFN">user agent</a> <em class="rfc2119"
  1012                title="MUST">MUST</em> run the following steps:
  1013           </p>
  1014           <ol class="rule">
  1015             <li>Let <var>Network Service Promise</var> be a new <a href="http://dom.spec.whatwg.org/#promise"
  1016                   class="externalDFN"><code>Promise</code></a> object.
  1017             </li>
  1018             <li>Let <var>Network Service Promise's Resolver</var> be the default <a href=
  1019             "http://dom.spec.whatwg.org/#concept-resolver"
  1020                   class="externalDFN">resolver</a> of <var>Network Service Promise</var>.
  1021             </li>
  1022             <li>Return <var>Network Service Promise</var>, and run the remaining steps asynchronously.
  1023             </li>
  1024             <li>Let <var>requested control types</var> be initially set to an empty array.
  1025             </li>
  1026             <li>If <var>type</var> is an array consisting of one or more <a href="#dfn-valid-service-type"
  1027                   class="internalDFN">valid service type</a> tokens, then let <var>requested control types</var> by the
  1028                   value of <var>type</var>, removing any non-<a href="#dfn-valid-service-type"
  1029                   class="internalDFN">valid service type</a> tokens from the resulting array.
  1030             </li>
  1031             <li>If <var>type</var> is a string consisting of one <a href="#dfn-valid-service-type"
  1032                   class="internalDFN">valid service type</a> token, then let <var>requested control types</var> be an
  1033                   array containing one item with a value of <var>type</var>.
  1034             </li>
  1035             <li>If <var>requested control types</var> is an array that contains at least one or more <a title=
  1036             "valid service type"
  1037                   href="#dfn-valid-service-type"
  1038                   class="internalDFN">valid service type</a> tokens then continue to the step labeled <em>process</em>
  1039                   below. Otherwise, reject <var>Network Service Promise</var> by running the <a href=
  1040                   "http://dom.spec.whatwg.org/#concept-resolver-reject"
  1041                   class="externalDFN">resolver reject algorithm</a> against the <var>Network Service Promise's
  1042                   Resolver</var>, passing in a newly constructed <a href="http://dom.spec.whatwg.org/#domerror"
  1043                   class="externalDFN"><code>DOMError</code></a> object whose <code>name</code> attribute has the string
  1044                   value "UnknownTypePrefixError" (<a href=
  1045                   "#dom-domerror-extensions-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></a>) and whose
  1046                   <code>message</code> attribute has a helpful implementation-dependent message that explains this
  1047                   error, abort any remaining steps and return.
  1048             </li>
  1049             <li>
  1050               <em>Process</em>: Let <var>services found</var> be an empty array.
  1051             </li>
  1052             <li>For each <var>available service</var> in the <a href="#dfn-list-of-available-service-records"
  1053                   class="internalDFN">list of available service records</a> run the following steps:
  1054               <ol class="rule">
  1055                 <li>For each <var>requested control type</var> in <var>requested control types</var>: If <var>available
  1056                 service</var>'s <code>type</code> attribute equals the <var>requested control type</var> then let <var>
  1057                   matched service</var> equal the value of <var>available service</var> and continue at the step
  1058                   labeled <var>attach</var> below.
  1059                 </li>
  1060                 <li>Continue at the next <var>available service</var>.
  1061                 </li>
  1062                 <li>
  1063                   <em>Attach</em>: If <var>matched service</var> is not empty then run the following steps:
  1064                   <ol class="rule">
  1065                     <li>Let <var>new service object</var> be a new <a href=
  1066                     "#networkservice"><code>NetworkService</code></a> object, mapping the parameters of <var>matched
  1067                     service</var> to this new object where possible.
  1068                     </li>
  1069                     <li>Append <var>new service object</var> to the <var>services found</var> array.
  1070                     </li>
  1071                   </ol>
  1072                 </li>
  1073               </ol>
  1074             </li>
  1075             <li>Optionally, e.g. based on a previously-established user preference, for security reasons, or due to
  1076             platform limitations, the <a href="#dfn-user-agent"
  1077                   class="internalDFN">user agent</a> <em class="rfc2119"
  1078                   title="MAY">MAY</em> reject <var>Network Service Promise</var> by running the <a href=
  1079                   "http://dom.spec.whatwg.org/#concept-resolver-reject"
  1080                   class="externalDFN">resolver reject algorithm</a> against the <var>Network Service Promise's
  1081                   Resolver</var>, passing in a newly constructed <a href="http://dom.spec.whatwg.org/#domerror"
  1082                   class="externalDFN"><code>DOMError</code></a> object whose <code>name</code> attribute has the string
  1083                   value "PermissionDeniedError" (<a href=
  1084                   "#dom-domerror-extensions-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) and whose
  1085                   <code>message</code> attribute has a helpful implementation-dependent message that explains this
  1086                   error, abort any remaining steps and return.
  1087             </li>
  1088             <li>The user agent <em class="rfc2119"
  1089                   title="MUST NOT">MUST NOT</em> provide the entry script's origin with a <a href=
  1090                   "#networkservices"><code>NetworkServices</code></a> object without prior permission given by the
  1091                   user.
  1092               <p>
  1093                 If <var>services found</var> is not an empty array then the <a href="#dfn-user-agent"
  1094                    class="internalDFN">user agent</a> <em class="rfc2119"
  1095                    title="MAY">MAY</em> choose to prompt the user in a user-agent-specific manner for permission to
  1096                    provide the <a href=
  1097                    "http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script"
  1098                    class="externalDFN">entry script</a>'s <a href=
  1099                    "http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin"
  1100                    class="externalDFN">origin</a> with a <a href="#networkservices"><code>NetworkServices</code></a>
  1101                    object representing the <a href="#dfn-user-authorized"
  1102                    class="internalDFN">user-authorized</a> subset of <var>services found</var>.
  1103               </p>
  1104               <p>
  1105                 Alternatively, the user agent <em class="rfc2119"
  1106                    title="MAY">MAY</em> wish to skip this user opt-in step and choose to fulfill <var>Network Service
  1107                    Promise</var> immediately based on a previously-established user preference, for security reasons,
  1108                    or due to platform limitations. In such an implementation, if <var>Network Service Promise</var> is
  1109                    to be fulfilled as a result of a previously-established user preference then the <a href=
  1110                    "#dfn-user-agent"
  1111                    class="internalDFN">user agent</a> <em class="rfc2119"
  1112                    title="MUST">MUST</em> continue at the next step of this algorithm.
  1113               </p>
  1114               <p>
  1115                 If permission has been granted by the user to access one or more networked services then the <a href=
  1116                 "#dfn-user-agent"
  1117                    class="internalDFN">user agent</a> <em class="rfc2119"
  1118                    title="SHOULD">SHOULD</em> include an "ongoing local-network communication" indicator.
  1119               </p>
  1120               <p>
  1121                 If permission has been denied by the user, <a href="#dfn-user-agent"
  1122                    class="internalDFN">user agent</a> or platform, then the <a href="#dfn-user-agent"
  1123                    class="internalDFN">user agent</a> <em class="rfc2119"
  1124                    title="MUST">MUST</em> reject <var>Network Service Promise</var> by running the <a href=
  1125                    "http://dom.spec.whatwg.org/#concept-resolver-reject"
  1126                    class="externalDFN">resolver reject algorithm</a> against the <var>Network Service Promise's
  1127                    Resolver</var>, passing in a newly constructed <a href="http://dom.spec.whatwg.org/#domerror"
  1128                    class="externalDFN"><code>DOMError</code></a> object whose <code>name</code> attribute has the
  1129                    string value "PermissionDeniedError" (<a href=
  1130                    "#dom-domerror-extensions-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) and whose
  1131                    <code>message</code> attribute has a helpful implementation-dependent message that explains this
  1132                    error, abort any remaining steps and return.
  1133               </p>
  1134               <p>
  1135                 If the user never responds or no previously-established user preference has been met, this algorithm
  1136                 stalls on this step.
  1137               </p>
  1138             </li>
  1139             <li>Let <var>services</var> be an empty array.
  1140             </li>
  1141             <li>If <var>services found</var> is not an empty array then set <var>services</var> to be an array of one
  1142             or more <a href="#networkservice"><code>NetworkService</code></a> objects for which the user granted
  1143             permission above - known as the current objects <dfn id="dfn-user-authorized">user-authorized</dfn>
  1144             services.
  1145             </li>
  1146             <li>For each Object <var>service</var> in <var>services</var>, if any, run the following sub-steps:
  1147               <ol class="rule">
  1148                 <li>If <var>service</var>'s <code>type</code> parameter begins with the DOMString "<code>upnp:</code>"
  1149                 and the <var>service</var>'s <code>eventsUrl</code> parameter is not empty then <a href=
  1150                 "#dfn-setup-a-upnp-events-subscription"
  1151                       class="internalDFN">setup a UPnP Events Subscription</a> for <var>service</var>.
  1152                 </li>
  1153               </ol>
  1154             </li>
  1155             <li>Let <var>services manager</var> be a new <a href="#networkservices"><code>NetworkServices</code></a>
  1156             object.
  1157             </li>
  1158             <li>Store <var>requested control types</var> against <var>services manager</var> as an internal variable.
  1159             </li>
  1160             <li>Set <var>services manager</var>'s <a href=
  1161             "#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute to the number of
  1162             items currently found in the <a href="#dfn-list-of-available-service-records"
  1163                   class="internalDFN">list of available service records</a> whose <code>type</code> property matches
  1164                   any of the tokens requested in <var>requested control types</var>.
  1165             </li>
  1166             <li>Add <var>services</var>, if any, to the <var>services manager</var> object as its collection of
  1167               <a href="#dfn-indexed-properties-1"
  1168                   class="internalDFN">indexed properties</a>. If <var>services</var> is an empty array then the
  1169                   <var>services manager</var> does not have any <var>indexed properties</var>.
  1170             </li>
  1171             <li>Set <var>services manager</var>'s <a href="#dom-networkservices-length"><code>length</code></a>
  1172             attribute to the number of items in <var>services</var>.
  1173             </li>
  1174             <li>Add <var>services manager</var> to the <a href="#dfn-list-of-active-service-managers"
  1175                   class="internalDFN">list of active service managers</a>.
  1176             </li>
  1177             <li>The <a href="#dfn-user-agent"
  1178                   class="internalDFN">user agent</a> <em class="rfc2119"
  1179                   title="MUST">MUST</em> fulfill <var>Network Service Promise</var> by running the <a href=
  1180                   "http://dom.spec.whatwg.org/#concept-resolver-fulfill"
  1181                   class="externalDFN">resolver fulfill algorithm</a> against the <var>Network Service Promise's
  1182                   Resolver</var>, passing in <var>services manager</var> as its argument.
  1183             </li>
  1184           </ol>
  1185           <p>
  1186             The <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#task-source"
  1187                class="externalDFN">task source</a> for these <a href=
  1188                "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#concept-task"
  1189                class="externalDFN">tasks</a> is the <a href=
  1190                "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#user-interaction-task-source"
  1191                class="externalDFN">user interaction task source</a>.
  1192           </p>
  1193           <p>
  1194             There is no implied persistence to networked service sharing provided to a web page. It <em class="rfc2119"
  1195                title="MUST NOT">MUST NOT</em> be possible to access a previously white-listed networked service without
  1196                user authorization in all of the following cases:
  1197           </p>
  1198           <ul>
  1199             <li>If the current script is reloaded at any point in the same or different window.
  1200             </li>
  1201             <li>if the current script reinvokes the <a href=
  1202             "#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> method at any point in its
  1203             execution.
  1204             </li>
  1205             <li>If the user navigates forward or back in their history to reload the current page.
  1206             </li>
  1207             <li>If a script is running in a different origin.
  1208             </li>
  1209           </ul>
  1210         </div>
  1211       </section>
  1212       <section id="error-handling">
  1213         <h3 aria-level="2"
  1214             role="heading"
  1215             id="h3_error-handling">
  1216           <span class="secno">5.2</span> Error Handling
  1217         </h3>
  1218         <dl class="domintro">
  1219           <dt>
  1220             <var title="">error</var> . <code title="dom-NavigatorNetworkServiceError-name"><a href=
  1221             "#dom-domerror-extensions-name">name</a></code>
  1222           </dt>
  1223           <dd>
  1224             <p>
  1225               Returns the current error's error name. At the current time, this will be "PermissionDeniedError" or
  1226               "UnknownTypePrefixError", for which the corresponding error constants <a href=
  1227               "#dom-domerror-extensions-permission_denied"><code>PERMISSION_DENIED_ERR</code></a> and <a href=
  1228               "#dom-domerror-extensions-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></a> are defined.
  1229             </p>
  1230           </dd>
  1231         </dl>
  1232         <p>
  1233           The <dfn id="dom-domerror-extensions-name"
  1234              title="dom-domerror-extensions-name"><code>name</code></dfn> attribute of a <a href=
  1235              "http://dom.spec.whatwg.org/#domerror"
  1236              class="externalDFN"><code>DOMError</code></a> object returned from this <abbr title=
  1237              "Application Programming Interface">API</abbr> <em class="ct"><em class="rfc2119"
  1238               title="MUST">MUST</em></em> return the name for the error, which will be one of the following:
  1239         </p>
  1240         <dl>
  1241           <dt>
  1242             <dfn id="dom-domerror-extensions-permission_denied"
  1243                 title="dom-domerror-extensions-permission_denied"><code>PERMISSION_DENIED_ERR</code></dfn> (DOMString
  1244                 value "PermissionDeniedError")
  1245           </dt>
  1246           <dd>
  1247             The user or user agent denied the page permission to access any services.
  1248           </dd>
  1249           <dt>
  1250             <dfn id="dom-domerror-extensions-unknown_type_prefix"
  1251                 title="dom-domerror-extensions-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></dfn>
  1252                 (DOMString value "UnknownTypePrefixError")
  1253           </dt>
  1254           <dd>
  1255             No <a href="#dfn-valid-service-type"
  1256                 class="internalDFN">valid service type</a> tokens were provided in the method invocation.
  1257           </dd>
  1258         </dl>
  1259       </section>
  1260     </section>
  1261     <section id="obtaining-networked-services">
  1262       <h2 aria-level="1"
  1263           role="heading"
  1264           id="h2_obtaining-networked-services">
  1265         <span class="secno">6.</span> Obtaining networked services
  1266       </h2>
  1267       <p>
  1268         The <a href="#networkservices"><code>NetworkServices</code></a> interface represents a collection of zero or
  1269         more <dfn id="dfn-indexed-properties">indexed properties</dfn> that are each a <a href="#dfn-user-authorized"
  1270            class="internalDFN">user-authorized</a> <a href="#networkservice"><code>NetworkService</code></a> object.
  1271       </p>
  1272       <p>
  1273         A <a href="#networkservices"><code>NetworkServices</code></a> object is the <a href=
  1274         "http://dom.spec.whatwg.org/#concept-promise-result"
  1275            class="externalDFN">promise result</a> from a call to <a href=
  1276            "#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a>.
  1277       </p>
  1278       <pre class="widl">
  1279 [NoInterfaceObject]
  1280 interface <dfn id="networkservices">NetworkServices</dfn> {
  1281   readonly attribute unsigned long    <a href="#dom-networkservices-length">length</a>;
  1282   getter <a href="#networkservice">NetworkService</a> (unsigned long index);
  1283   <a href="#networkservice">NetworkService</a>? <a href=
  1284 "#dom-networkservices-getservicebyid">getServiceById</a>(DOMString id);
  1285 
  1286   readonly attribute unsigned long    <a href="#dom-networkservices-servicesavailable">servicesAvailable</a>;
  1287 
  1288   // event handler attributes
  1289            attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler"
  1290      class="externalDFN">EventHandler</a>     <a href="#dom-networkservices-onservicefound">onservicefound</a>;
  1291            attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler"
  1292      class="externalDFN">EventHandler</a>     <a href="#dom-networkservices-onservicelost">onservicelost</a>;
  1293 
  1294 };
  1295 
  1296 <a href="#networkservices">NetworkServices</a> implements <a href=
  1297 "http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-eventtarget"
  1298      class="externalDFN">EventTarget</a>;
  1299 </pre>
  1300       <section id="attributes">
  1301         <h3 aria-level="2"
  1302             role="heading"
  1303             id="h3_attributes">
  1304           <span class="secno">6.1</span> Attributes
  1305         </h3>
  1306         <dl class="domintro">
  1307           <dt>
  1308             <code title="dom-networkservices-length"><a href="#dom-networkservices-length">length</a></code>
  1309           </dt>
  1310           <dd>
  1311             <p>
  1312               Returns the current number of <a href="#dfn-indexed-properties-1"
  1313                  class="internalDFN">indexed properties</a> in the current object's collection.
  1314             </p>
  1315           </dd>
  1316           <dt>
  1317             <code title="dom-networkservices-servicesavailable"><a href=
  1318             "#dom-networkservices-servicesavailable">servicesAvailable</a></code>
  1319           </dt>
  1320           <dd>
  1321             <p>
  1322               Returns the current number of items matching one of the app-requested <a href="#dfn-valid-service-type"
  1323                  class="internalDFN">valid service type</a> tokens in the <a href=
  1324                  "#dfn-list-of-available-service-records"
  1325                  class="internalDFN">list of available service records</a>.
  1326             </p>
  1327           </dd>
  1328         </dl>
  1329         <div>
  1330           <p>
  1331             The <dfn id="dom-networkservices-length"><code>length</code></dfn> attribute <em class="rfc2119"
  1332                title="MUST">MUST</em> return the number of <a href="#networkservice"><code>NetworkService</code></a>
  1333                objects represented by the collection.
  1334           </p>
  1335           <p>
  1336             The <dfn id="dom-networkservices-servicesavailable"><code>servicesAvailable</code></dfn> attribute
  1337             <em class="rfc2119"
  1338                title="MUST">MUST</em> return the number of services in the <a href=
  1339                "#dfn-list-of-available-service-records"
  1340                class="internalDFN">list of available service records</a> whose <code>type</code> attribute matches any
  1341                of the <a href="#dfn-valid-service-type"
  1342                class="internalDFN">valid service type</a> tokens that were initially used to create the current <a href=
  1343                "#networkservices"><code>NetworkServices</code></a> object.
  1344           </p>
  1345         </div>
  1346       </section>
  1347       <section id="methods-1">
  1348         <h3 aria-level="2"
  1349             role="heading"
  1350             id="h3_methods-1">
  1351           <span class="secno">6.2</span> Methods
  1352         </h3>
  1353         <dl class="domintro">
  1354           <dt>
  1355             <code title="networkservices-getter"><a href="#networkservices">services</a></code> [ <var title=
  1356             "">index</var> ]
  1357           </dt>
  1358           <dd>
  1359             <p>
  1360               Returns the specified <a href="#networkservice"><code>NetworkService</code></a> object.
  1361             </p>
  1362           </dd>
  1363           <dt>
  1364             <code title="networkservices-getter"><a href="#networkservices">services</a></code> . <code title=
  1365             "dom-networkservices-getservicebyid"><a href=
  1366             "#dom-networkservices-getservicebyid">getServiceById</a></code> ( <var title="">id</var> )
  1367           </dt>
  1368           <dd>
  1369             <p>
  1370               Returns the <a href="#networkservice"><code>NetworkService</code></a> object with the given identifier,
  1371               or null if no service has that identifier.
  1372             </p>
  1373           </dd>
  1374         </dl>
  1375         <p>
  1376           A <a href="#networkservices"><code>NetworkServices</code></a> object represents the current collection of
  1377           zero or more <a href="#networkservice"><code>NetworkService</code></a> objects - its <a href=
  1378           "#dfn-indexed-properties-1"
  1379              class="internalDFN">indexed properties</a>. The <a href="#dfn-indexed-properties-1"
  1380              class="internalDFN">indexed properties</a> of a <a href=
  1381              "#networkservices"><code>NetworkServices</code></a> object are <span>immutable</span> meaning that <a href=
  1382              "#dfn-indexed-properties-1"
  1383              class="internalDFN">indexed properties</a> cannot be added and <a href="#dfn-indexed-properties-1"
  1384              class="internalDFN">indexed properties</a> cannot be removed for the lifetime of a <a href=
  1385              "#networkservices"><code>NetworkServices</code></a> object.
  1386         </p>
  1387         <p>
  1388           The <a href=
  1389           "http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#supported-property-indices"
  1390              class="externalDFN">supported property indices</a> of <a href=
  1391              "#networkservices"><code>NetworkServices</code></a> objects at any instant are the numbers from zero to
  1392              the number of the <a href="#networkservice"><code>NetworkService</code></a> objects in the collection
  1393              minus one.
  1394         </p>
  1395         <div class="note">
  1396           <div class="note-title"
  1397                aria-level="3"
  1398                role="heading"
  1399                id="h_note_1">
  1400             <span>Note</span>
  1401           </div>
  1402           <p class="">
  1403             Each service in a <a href="#networkservices"><code>NetworkServices</code></a> object thus has an index; the
  1404             first has the index 0, and each subsequent service is numbered one higher than the previous one.
  1405           </p>
  1406         </div>
  1407         <p>
  1408           To <a href=
  1409           "http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#determine-the-value-of-an-indexed-property"
  1410              class="externalDFN">determine the value of an indexed property</a> for a given index <var>index</var> in a
  1411              <a href="#networkservices"><code>NetworkServices</code></a> object the user agent <em class="rfc2119"
  1412              title="MUST">MUST</em> return the <a href="#networkservice"><code>NetworkService</code></a> object that
  1413              represents the <var>index</var>th item in the collection.
  1414         </p>
  1415         <p>
  1416           The <dfn id="dom-networkservices-getservicebyid"><code>getServiceById(id)</code></dfn> method <em class=
  1417           "ct"><em class="rfc2119"
  1418               title="MUST">MUST</em></em> return the first <a href="#networkservice"><code>NetworkService</code></a>
  1419               object in the collection whose <a href="#dom-networkservice-id"><code>id</code></a> attribute is equal to
  1420               the value of the <var>id</var> argument provided. When no <a href=
  1421               "#networkservice"><code>NetworkService</code></a> objects match the given argument, the method <em class=
  1422               "rfc2119"
  1423              title="MUST">MUST</em> return null.
  1424         </p>
  1425       </section>
  1426       <section id="events">
  1427         <h3 aria-level="2"
  1428             role="heading"
  1429             id="h3_events">
  1430           <span class="secno">6.3</span> Events
  1431         </h3>
  1432         <p>
  1433           The following are the event handlers (and their corresponding event handler event types) that <em class=
  1434           "ct"><em class="rfc2119"
  1435               title="MUST">MUST</em></em> be supported, as IDL attributes, by all objects implementing the <a href=
  1436               "#networkservices"><code>NetworkServices</code></a> interface:
  1437         </p>
  1438         <table border="1">
  1439           <thead>
  1440             <tr>
  1441               <th>
  1442                 <span title="event handlers">Event handler</span>
  1443               </th>
  1444               <th>
  1445                 <span>Event handler event type</span>
  1446               </th>
  1447             </tr>
  1448           </thead>
  1449           <tbody>
  1450             <tr>
  1451               <td>
  1452                 <dfn id="dom-networkservices-onservicefound"
  1453                     title="dom-NetworkServices-onservicefound"><code>onservicefound</code></dfn>
  1454               </td>
  1455               <td>
  1456                 <a href="#event-servicefound"><code>servicefound</code></a>
  1457               </td>
  1458             </tr>
  1459             <tr>
  1460               <td>
  1461                 <dfn id="dom-networkservices-onservicelost"
  1462                     title="dom-NetworkServices-onservicelost"><code>onservicelost</code></dfn>
  1463               </td>
  1464               <td>
  1465                 <a href="#event-servicelost"><code>servicelost</code></a>
  1466               </td>
  1467             </tr>
  1468           </tbody>
  1469         </table>
  1470       </section>
  1471     </section>
  1472     <section id="communicating-with-a-networked-service">
  1473       <h2 aria-level="1"
  1474           role="heading"
  1475           id="h2_communicating-with-a-networked-service">
  1476         <span class="secno">7.</span> Communicating with a networked service
  1477       </h2>
  1478       <p>
  1479         The <a href="#networkservice"><code>NetworkService</code></a> interface is used to provide a set of connection
  1480         information for an <abbr title="Hypertext Transfer Protocol">HTTP</abbr> service endpoint and if available,
  1481         service events, running on a networked device.
  1482       </p>
  1483       <pre class="widl">
  1484 [NoInterfaceObject]
  1485 interface <dfn id="networkservice">NetworkService</dfn> {
  1486   readonly attribute DOMString        <a href="#dom-networkservice-id">id</a>;
  1487   readonly attribute DOMString        <a href="#dom-networkservice-name">name</a>;
  1488   readonly attribute DOMString        <a href="#dom-networkservice-type">type</a>;
  1489   readonly attribute DOMString        <a href="#dom-networkservice-url">url</a>;
  1490   readonly attribute DOMString        <a href="#dom-networkservice-config">config</a>;
  1491 
  1492   readonly attribute boolean          <a href="#dom-networkservice-online">online</a>;
  1493 
  1494   // event handler attributes
  1495            attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler"
  1496      class="externalDFN">EventHandler</a>     <a href="#dom-networkservice-onavailable">onavailable</a>;
  1497            attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler"
  1498      class="externalDFN">EventHandler</a>     <a href="#dom-networkservice-onunavailable">onunavailable</a>;
  1499 
  1500            attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler"
  1501      class="externalDFN">EventHandler</a>     <a href="#dom-networkservice-onnotify">onnotify</a>;
  1502 };
  1503 
  1504 <a href="#networkservice">NetworkService</a> implements <a href=
  1505 "http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-eventtarget"
  1506      class="externalDFN">EventTarget</a>;
  1507 </pre>
  1508       <section id="attributes-1">
  1509         <h3 aria-level="2"
  1510             role="heading"
  1511             id="h3_attributes-1">
  1512           <span class="secno">7.1</span> Attributes
  1513         </h3>
  1514         <dl class="domintro">
  1515           <dt>
  1516             <var title="">service</var> . <code title="dom-networkservice-id"><a href=
  1517             "#dom-networkservice-id">id</a></code>
  1518           </dt>
  1519           <dd>
  1520             <p>
  1521               A unique identifier for the given user-selected service instance.
  1522             </p>
  1523           </dd>
  1524           <dt>
  1525             <var title="">service</var> . <code title="dom-networkservice-name"><a href=
  1526             "#dom-networkservice-name">name</a></code>
  1527           </dt>
  1528           <dd>
  1529             <p>
  1530               The name of the user-selected service.
  1531             </p>
  1532           </dd>
  1533           <dt>
  1534             <var title="">service</var> . <code title="dom-networkservice-type"><a href=
  1535             "#dom-networkservice-type">type</a></code>
  1536           </dt>
  1537           <dd>
  1538             <p>
  1539               The <a href="#dfn-valid-service-type"
  1540                  class="internalDFN">valid service type</a> token value of the user-selected service.
  1541             </p>
  1542           </dd>
  1543           <dt>
  1544             <var title="">service</var> . <code title="dom-networkservice-url"><a href=
  1545             "#dom-networkservice-url">url</a></code>
  1546           </dt>
  1547           <dd>
  1548             <p>
  1549               The control URL endpoint (including any required port information) of the user-selected control service.
  1550             </p>
  1551           </dd>
  1552           <dt>
  1553             <var title="">service</var> . <code title="dom-networkservice-config"><a href=
  1554             "#dom-networkservice-config">config</a></code>
  1555           </dt>
  1556           <dd>
  1557             <p>
  1558               The configuration information associated with the service depending on the requested service type.
  1559             </p>
  1560           </dd>
  1561         </dl>
  1562         <p>
  1563           The <dfn id="dom-networkservice-id"><code>id</code></dfn> attribute is a unique identifier for the service.
  1564           The same service provided at different times or on different objects <em class="rfc2119"
  1565              title="MUST">MUST</em> have the same <a href="#dom-networkservice-id"><code>id</code></a> value.
  1566         </p>
  1567         <p>
  1568           The <dfn id="dom-networkservice-name"><code>name</code></dfn> attribute represents a human-readable title for
  1569           the service.
  1570         </p>
  1571         <p>
  1572           The <dfn id="dom-networkservice-type"><code>type</code></dfn> attribute reflects the value of the <a href=
  1573           "#dfn-valid-service-type"
  1574              class="internalDFN">valid service type</a> of the service.
  1575         </p>
  1576         <p>
  1577           The <dfn id="dom-networkservice-url"><code>url</code></dfn> attribute is an <a href=
  1578           "http://url.spec.whatwg.org/#concept-absolute-url"
  1579              class="externalDFN">absolute URL</a> pointing to the root <abbr title=
  1580              "Hypertext Transfer Protocol">HTTP</abbr> endpoint for the service. Web pages can subsequently use this
  1581              value for implicit cross-document messaging via various existing mechanisms (e.g. Web Sockets, Server-Sent
  1582              Events, Web Messaging, XMLHttpRequest).
  1583         </p>
  1584         <p>
  1585           The <dfn id="dom-networkservice-config"><code>config</code></dfn> attribute provides the raw configuration
  1586           information extracted from the given network service.
  1587         </p>
  1588       </section>
  1589       <section id="states">
  1590         <h3 aria-level="2"
  1591             role="heading"
  1592             id="h3_states">
  1593           <span class="secno">7.2</span> States
  1594         </h3>
  1595         <dl class="domintro">
  1596           <dt>
  1597             <var title="">service</var> . <code title="dom-networkservice-online"><a href=
  1598             "#dom-networkservice-online">online</a></code>
  1599           </dt>
  1600           <dd>
  1601             <p>
  1602               Returns <code>true</code> if the service is reporting that it is accessible on the local network or
  1603               <code>false</code> if the service is no longer accessible (temporarily or permanently) on the local
  1604               network.
  1605             </p>
  1606           </dd>
  1607         </dl>
  1608         <p>
  1609           The <dfn id="dom-networkservice-online"><code>online</code></dfn> attribute indicates whether the service is
  1610           either <var>online</var>, and therefore accessible on the local network, in which case this attribute will
  1611           return <code>true</code> or, <var>offline</var>, and therefore not accessible on the local network, either
  1612           temporarily or permanently, in which case this attribute will return <code>false</code>. This attribute
  1613           <em class="rfc2119"
  1614              title="MUST">MUST</em> default to <code>true</code>.
  1615         </p>
  1616       </section>
  1617       <section id="events-1">
  1618         <h3 aria-level="2"
  1619             role="heading"
  1620             id="h3_events-1">
  1621           <span class="secno">7.3</span> Events
  1622         </h3>
  1623         <p>
  1624           The following are the event handlers (and their corresponding event handler event types) that <em class=
  1625           "ct"><em class="rfc2119"
  1626               title="MUST">MUST</em></em> be supported, as IDL attributes, by all objects implementing the <a href=
  1627               "#networkservice"><code>NetworkService</code></a> interface:
  1628         </p>
  1629         <table border="1">
  1630           <thead>
  1631             <tr>
  1632               <th>
  1633                 <span title="event handlers">Event handler</span>
  1634               </th>
  1635               <th>
  1636                 <span>Event handler event type</span>
  1637               </th>
  1638             </tr>
  1639           </thead>
  1640           <tbody>
  1641             <tr>
  1642               <td>
  1643                 <dfn id="dom-networkservice-onnotify"
  1644                     title="dom-NetworkService-onnotify"><code>onnotify</code></dfn>
  1645               </td>
  1646               <td>
  1647                 <a href="#event-notify"><code>notify</code></a>
  1648               </td>
  1649             </tr>
  1650             <tr>
  1651               <td>
  1652                 <dfn id="dom-networkservice-onavailable"
  1653                     title="dom-NetworkService-onavailable"><code>onavailable</code></dfn>
  1654               </td>
  1655               <td>
  1656                 <a href="#event-available"><code>available</code></a>
  1657               </td>
  1658             </tr>
  1659             <tr>
  1660               <td>
  1661                 <dfn id="dom-networkservice-onunavailable"
  1662                     title="dom-NetworkService-onunavailable"><code>onunavailable</code></dfn>
  1663               </td>
  1664               <td>
  1665                 <a href="#event-unavailable"><code>unavailable</code></a>
  1666               </td>
  1667             </tr>
  1668           </tbody>
  1669         </table>
  1670       </section>
  1671     </section>
  1672     <section id="service-discovery">
  1673       <h2 aria-level="1"
  1674           role="heading"
  1675           id="h2_service-discovery">
  1676         <span class="secno">8.</span> Service Discovery
  1677       </h2>
  1678       <p>
  1679         A <a href="#dfn-user-agent"
  1680            class="internalDFN">user agent</a> conforming to this specification <em class="rfc2119"
  1681            title="MAY">MAY</em> implement <abbr title="Simple Service Discovery Protocol">SSDP</abbr> [<cite><a class=
  1682            "bibref"
  1683            href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>], Zeroconf [<cite><a class="bibref"
  1684            href="#bib-DNS-SD">DNS-SD</a></cite>] + [<cite><a class="bibref"
  1685            href="#bib-MDNS">MDNS</a></cite>] and/or <abbr title="Discovery and Launch Protocol">DIAL</abbr> [<a href=
  1686            "https://sites.google.com/a/dial-multiscreen.org/dial/dial-protocol-specification"><abbr title=
  1687            "Discovery and Launch Protocol">DIAL</abbr></a>] <dfn id="dfn-service-discovery-mechanisms">service
  1688            discovery mechanisms</dfn> - the requirements detailed in this section of the specification - to enable Web
  1689            pages to request and connect with <abbr title="Hypertext Transfer Protocol">HTTP</abbr> services running on
  1690            networked devices, discovered via any of these mechanisms, through this <abbr title=
  1691            "Application Programming Interface">API</abbr>. When a <a href="#dfn-user-agent"
  1692            class="internalDFN">user agent</a> implements any of these <a href="#dfn-service-discovery-mechanisms"
  1693            class="internalDFN">service discovery mechanisms</a>, then it <em class="rfc2119"
  1694            title="MUST">MUST</em> conform to the corresponding algorithms provided in this section of the
  1695            specification.
  1696       </p>
  1697       <p>
  1698         This section presents how the results of these <a href="#dfn-service-discovery-mechanisms"
  1699            class="internalDFN">service discovery mechanisms</a> will be matched to requested service types, how the
  1700            user agent stores available and active services and how their properties are applied to any resulting
  1701            <a href="#networkservice"><code>NetworkService</code></a> objects.
  1702       </p>
  1703       <p>
  1704         It is expected that user agents will perform these <a href="#dfn-service-discovery-mechanisms"
  1705            class="internalDFN">service discovery mechanisms</a> asynchronously and periodically update the <a href=
  1706            "#dfn-list-of-available-service-records"
  1707            class="internalDFN">list of available service records</a> as required. The timing of any <a href=
  1708            "#dfn-service-discovery-mechanisms"
  1709            class="internalDFN">service discovery mechanisms</a> is an implementation detail left to the discretion of
  1710            the implementer (e.g. by continuously monitoring the network as a background process or on invocation of
  1711            this <abbr title="Application Programming Interface">API</abbr> from a Web page).
  1712       </p>
  1713       <p>
  1714         The <dfn id="dfn-list-of-available-service-records">list of available service records</dfn> is a single dynamic
  1715         internal lookup table within user agents that is used to track all the services that have been discovered and
  1716         are available in the current network at the current time. At any point during the running of any of the
  1717         <a href="#dfn-service-discovery-mechanisms"
  1718            class="internalDFN">service discovery mechanisms</a> then existing entries within this table can be updated,
  1719            entries can be added and entries can be removed as the status of networked services changes according to the
  1720            rules defined in this specification.
  1721       </p>
  1722       <p>
  1723         The <dfn id="dfn-list-of-active-service-managers">list of active service managers</dfn> is an internal list
  1724         within user agents that is used to track all <a href="#networkservices"><code>NetworkServices</code></a>
  1725         objects currently being shared with any web pages at the current time within the user agent. Each <a href=
  1726         "#networkservices"><code>NetworkServices</code></a> object in the <a href=
  1727         "#dfn-list-of-active-service-managers"
  1728            class="internalDFN">list of active service managers</a> represents a collection of zero or more <a href=
  1729            "#networkservice"><code>NetworkService</code></a> objects - known as its <dfn id=
  1730            "dfn-indexed-properties-1">indexed properties</dfn>. <a href=
  1731            "#networkservice"><code>NetworkService</code></a> objects are attached as the <a href=
  1732            "#dfn-indexed-properties-1"
  1733            class="internalDFN">indexed properties</a> of a <a href="#networkservices"><code>NetworkServices</code></a>
  1734            object as part of the <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a>
  1735            algorithm.
  1736       </p>
  1737       <p>
  1738         The rule for <dfn id="dfn-adding-an-available-service">adding an available service</dfn> is the process of
  1739         adding a <a href="#dfn-new-service"
  1740            class="internalDFN">new service</a> or updating an <a href="#dfn-existing-service"
  1741            class="internalDFN">existing service</a> that is generally available on the user's current network in the
  1742            <a href="#dfn-list-of-available-service-records"
  1743            class="internalDFN">list of available service records</a>. This rule takes one argument, <var>network
  1744            service record</var>, and consists of running the following steps:
  1745       </p>
  1746       <ol class="rule">
  1747         <li>For each <var>existing service record</var> in the current <a href="#dfn-list-of-available-service-records"
  1748               class="internalDFN">list of available service records</a>, run the following sub-steps:
  1749           <ol class="rule">
  1750             <li>If the <var>existing service record</var>'s <code>id</code> property does not equal <var>network
  1751             service record</var>'s <code>id</code> property then abort any remaining sub-steps and continue at the next
  1752             available <var>existing service record</var>.
  1753             </li>
  1754             <li>Replace the value of <var>existing service record</var> in the current <a href=
  1755             "#dfn-list-of-available-service-records"
  1756                   class="internalDFN">list of available service records</a> with the value of <var>network service
  1757                   record</var>, aborting any remaining steps in this algorithm and return.
  1758             </li>
  1759           </ol>
  1760         </li>
  1761         <li>Add <var>network service record</var> to the <a href="#dfn-list-of-available-service-records"
  1762               class="internalDFN">list of available service records</a> as a new item.
  1763         </li>
  1764         <li>For each <var>service manager</var> in the <a href="#dfn-list-of-active-service-managers"
  1765               class="internalDFN">list of active service managers</a> run the following steps:
  1766           <ol class="rule">
  1767             <li>For each <var>active service</var> in <var>service manager</var> run the following steps:
  1768               <ol class="rule">
  1769                 <li>If the <var>network service record</var>'s <code>id</code> property equals the <var>active
  1770                 service</var>'s <code>id</code> attribute and <var>active service</var>'s <code>online</code> attribute
  1771                 is currently set to <code>false</code> then set <var>active service</var>'s <a href=
  1772                 "#dom-networkservice-online"><code>online</code></a> attribute to <code>true</code> and then <a href=
  1773                 "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
  1774                       class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href=
  1775                       "#event-available"><code>available</code></a> that uses the <a href=
  1776                       "http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event"
  1777                       class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not cancellable,
  1778                       and has no default action, at the current <var>active service</var> object.
  1779                 </li>
  1780               </ol>
  1781             </li>
  1782             <li>Let <var>'service type in current service manager' flag</var> be <code>false</code>.
  1783             </li>
  1784             <li>For each <var>requested control type</var> of the <var>requested control types</var> in <var>service
  1785             manager</var> run the following steps:
  1786               <ol class="rule">
  1787                 <li>If <var>network service record</var>'s <code>type</code> property does not equal <var>requested
  1788                 control type</var> then abort any remaining sub-steps and continue at the next available <var>requested
  1789                 control type</var>.
  1790                 </li>
  1791                 <li>Set the <var>'service type in current service manager' flag</var> to <code>true</code>, abort any
  1792                 remaining sub-steps and continue.
  1793                 </li>
  1794               </ol>
  1795             </li>
  1796             <li>If the <var>'service type in current service manager' flag</var> is set to <code>true</code> then
  1797             increment <var>service manager</var>'s <a href=
  1798             "#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute by <code>1</code> and
  1799             then <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
  1800                   class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href=
  1801                   "#event-servicefound"><code>servicefound</code></a> that uses the <a href=
  1802                   "http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event"
  1803                   class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not cancellable, and
  1804                   has no default action, at the current <var>service manager</var> object.
  1805             </li>
  1806           </ol>
  1807         </li>
  1808       </ol>
  1809       <p>
  1810         The rule for <dfn id="dfn-removing-an-available-service">removing an available service</dfn> is the general
  1811         process of removing an <a href="#dfn-existing-service"
  1812            class="internalDFN">existing service</a> from the <a href="#dfn-list-of-available-service-records"
  1813            class="internalDFN">list of available service records</a> that has left the user's current network or has
  1814            otherwise expired. This rule takes one argument, <var>service identifier</var>, and consists of running the
  1815            following steps:
  1816       </p>
  1817       <ol class="rule">
  1818         <li>For each <var>existing service record</var> in the current <a href="#dfn-list-of-available-service-records"
  1819               class="internalDFN">list of available service records</a>, run the following sub-steps:
  1820           <ol class="rule">
  1821             <li>If the <var>existing service record</var>'s <code>id</code> property does not match <var>service
  1822             identifier</var> then skip any remaining sub-steps for the current <var>existing service record</var> and
  1823             continue at the next available <var>existing service record</var>.
  1824             </li>
  1825             <li>Let <var>'service type in use' flag</var> be <code>false</code>.
  1826             </li>
  1827             <li>For each <var>service manager</var> in the <a href="#dfn-list-of-active-service-managers"
  1828                   class="internalDFN">list of active service managers</a> run the following steps:
  1829               <ol class="rule">
  1830                 <li>Let <var>'service type in current service manager' flag</var> be <code>false</code>.
  1831                 </li>
  1832                 <li>For each <var>active service</var> in <var>service manager</var> run the following steps:
  1833                   <ol class="rule">
  1834                     <li>If <var>existing service record</var>'s <code>id</code> property equals the <var>active
  1835                     service</var>'s <code>id</code> attribute and <var>active service</var>'s <a href=
  1836                     "#dom-networkservice-online"><code>online</code></a> attribute is currently set to
  1837                     <code>true</code> then set <var>active service</var>'s <a href="#dom-networkservice-online"><code>
  1838                       online</code></a> attribute to <code>false</code> and then <a href=
  1839                       "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
  1840                           class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href=
  1841                           "#event-unavailable"><code>unavailable</code></a> that uses the <a href=
  1842                           "http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event"
  1843                           class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not
  1844                           cancellable, and has no default action, at the current <var>active service</var>.
  1845                     </li>
  1846                   </ol>
  1847                 </li>
  1848                 <li>For each <var>requested control type</var> of the <var>requested control types</var> in
  1849                 <var>service manager</var> run the following steps:
  1850                   <ol class="rule">
  1851                     <li>If <var>existing service record</var>'s <code>type</code> property does not equal
  1852                     <var>requested control type</var> then abort any remaining sub-steps and continue at the next
  1853                     available <var>requested control type</var>.
  1854                     </li>
  1855                     <li>Set the <var>'service type in current service manager' flag</var> to <code>true</code> and the
  1856                     <var>'service type in use' flag</var> to <code>true</code>, abort any remaining sub-steps and
  1857                     continue.
  1858                     </li>
  1859                   </ol>
  1860                 </li>
  1861                 <li>If the <var>'service type in current service manager' flag</var> is set to <code>true</code> then
  1862                 decrement <var>service manager</var>'s <a href=
  1863                 "#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute by <code>1</code>
  1864                 and then <a href=
  1865                 "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
  1866                       class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href=
  1867                       "#event-servicelost"><code>servicelost</code></a> that uses the <a href=
  1868                       "http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event"
  1869                       class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not cancellable,
  1870                       and has no default action, at the current <var>service manager</var> object.
  1871                 </li>
  1872               </ol>
  1873             </li>
  1874             <li>If the <var>'service type in use' flag</var> is <code>false</code> and the <var>existing service
  1875             record</var>'s <code>type</code> property begins with the DOMString "<code>upnp:</code>" and <var>existing
  1876             service record</var>'s <code>eventsURL</code> property is set then run the rule to <a href=
  1877             "#dfn-terminate-an-existing-upnp-events-subscription"
  1878                   class="internalDFN">terminate an existing UPnP Events Subscription</a>, if one is currently active
  1879                   (as a result of having previously called <a href="#dfn-setup-a-upnp-events-subscription"
  1880                   class="internalDFN">setup a UPnP Events Subscription</a> against the current <var>existing service
  1881                   record</var>).
  1882             </li>
  1883             <li>Remove <var>existing service record</var> from the current <a href=
  1884             "#dfn-list-of-available-service-records"
  1885                   class="internalDFN">list of available service records</a>.
  1886             </li>
  1887           </ol>
  1888         </li>
  1889       </ol>
  1890       <p>
  1891         User agents <em class="rfc2119"
  1892            title="SHOULD">SHOULD</em> expire a service record from the <a href="#dfn-list-of-available-service-records"
  1893            class="internalDFN">list of available service records</a> when its <code>expiryTimestamp</code> attribute
  1894            exceeds the current UTC timestamp. When this condition is met the <a href="#dfn-user-agent"
  1895            class="internalDFN">user agent</a> <em class="rfc2119"
  1896            title="SHOULD">SHOULD</em> run the rule for <a href="#dfn-removing-an-available-service"
  1897            class="internalDFN">removing an available service</a>, passing in the expired service record's
  1898            <code>id</code> attribute as the only argument.
  1899       </p>
  1900       <p>
  1901         The <dfn id="dfn-cors-preflight-check">CORS preflight check</dfn> algorithm determines whether a
  1902         Local-networked Service supports Cross-Origin Resource Sharing [<cite><a class="bibref"
  1903            href="#bib-CORS">CORS</a></cite>] prior to that service being proposed for sharing to users and prior to
  1904            active sharing with web pages. This algorithm takes one argument, <var>control endpoint URL</var>, and
  1905            consists of running the following steps:
  1906       </p>
  1907       <ol class="rule">
  1908         <li>Let <var>cross-origin request status</var> be set to the resulting value of <a href=
  1909         "http://www.w3.org/TR/cors/#cross-origin-request-status"
  1910               class="externalDFN">cross-origin request status</a> [<cite><a class="bibref"
  1911              href="#bib-CORS">CORS</a></cite>] after performing a <a href=
  1912              "http://www.w3.org/TR/cors/#cross-origin-request-with-preflight"
  1913               class="externalDFN">cross-origin request with preflight</a> [<cite><a class="bibref"
  1914              href="#bib-CORS">CORS</a></cite>] towards the <var>control endpoint URL</var> with the <a href=
  1915              "http://www.w3.org/TR/cors/#source-origin"
  1916               class="externalDFN">source origin</a> [<cite><a class="bibref"
  1917              href="#bib-CORS">CORS</a></cite>] set to the public IP address of the current machine, terminating this
  1918              algorithm at Step 2 (when <a href="http://www.w3.org/TR/cors/#cross-origin-request-status"
  1919               class="externalDFN">cross-origin request status</a> has been set to <var>preflight complete</var> or a
  1920               prior error has occurred in the algorithm).
  1921         </li>
  1922         <li>If <var>cross-origin request status</var> is set to <var>preflight complete</var> then return
  1923         <code>pass</code>. Otherwise, return <code>fail</code>.
  1924         </li>
  1925       </ol>
  1926       <p>
  1927         User agents <em class="rfc2119"
  1928            title="SHOULD">SHOULD</em> re-run the <a href="#dfn-cors-preflight-check"
  1929            class="internalDFN">CORS preflight check</a> algorithm against service endpoint URLs when their <a href=
  1930            "http://www.w3.org/TR/cors/#cache-max-age"
  1931            class="externalDFN">max-age</a> [<cite><a class="bibref"
  1932            href="#bib-CORS">CORS</a></cite>] entry in the <a href="http://www.w3.org/TR/cors/#preflight-result-cache"
  1933            class="externalDFN">preflight result cache</a> [<cite><a class="bibref"
  1934            href="#bib-CORS">CORS</a></cite>] exceeds the current time. If this subsequent execution of the <a href=
  1935            "#dfn-cors-preflight-check"
  1936            class="internalDFN">CORS preflight check</a> algorithm returns <code>fail</code> then the <a href=
  1937            "#dfn-user-agent"
  1938            class="internalDFN">user agent</a> <em class="rfc2119"
  1939            title="MUST">MUST</em> run the general rule for <a href="#dfn-removing-an-available-service"
  1940            class="internalDFN">removing an available service</a> passing in the associated <var>network service
  1941            record</var>'s <code>id</code> attribute as the only argument.
  1942       </p>
  1943       <section id="zeroconf-mdns-dns-sd">
  1944         <h3 aria-level="2"
  1945             role="heading"
  1946             id="h3_zeroconf-mdns-dns-sd">
  1947           <span class="secno">8.1</span> Zeroconf (<abbr title="Multicast DNS">mDNS</abbr> + <abbr title=
  1948           "Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr>)
  1949         </h3>
  1950         <p>
  1951           For each <abbr title="Domain Name System">DNS</abbr> response received from a user-agent-initiated Multicast
  1952           <abbr title="Domain Name System">DNS</abbr> Browse for <abbr title="DNS Pointer Record">PTR</abbr> records
  1953           with the name <code>_services._dns-sd._udp</code> on the resolved recommended automatic browsing domain
  1954           [<cite><a class="bibref"
  1955              href="#bib-MDNS">MDNS</a></cite>], the <a href="#dfn-user-agent"
  1956              class="internalDFN">user agent</a> <em class="rfc2119"
  1957              title="MUST">MUST</em> run the following steps:
  1958         </p>
  1959         <ol class="rule">
  1960           <li>Let <var>service <abbr title="Multicast DNS">mDNS</abbr> responses</var> be an array of <abbr title=
  1961           "DNS Pointer Record">PTR</abbr> records received by issuing a Multicast <abbr title=
  1962           "Domain Name System">DNS</abbr> Browse for <abbr title="DNS Pointer Record">PTR</abbr> records with the name
  1963           of the current discovered service type.
  1964           </li>
  1965           <li>For each Object <var>service <abbr title="Multicast DNS">mDNS</abbr> response</var> in <var>service
  1966           <abbr title="Multicast DNS">mDNS</abbr> responses</var>, run the following steps:
  1967             <ol>
  1968               <li>Let <var>network service record</var> be an Object consisting of the following empty properties:
  1969               <code>id</code>, <code>name</code>, <code>type</code>, <code>url</code>, <code>config</code>,
  1970               <code>expiryTimestamp</code>.
  1971               </li>
  1972               <li>Set <var>network service record</var>'s <code>id</code> property to the value of the full
  1973                 <abbr title="DNS Pointer Record">PTR</abbr> Service Instance Name [<cite><a class="bibref"
  1974                    href="#bib-MDNS">MDNS</a></cite>].
  1975               </li>
  1976               <li>Set <var>network service record</var>'s <code>name</code> property to the value of the <abbr title=
  1977               "DNS Pointer Record">PTR</abbr> Service Instance Name's <var>Instance</var> component [<cite><a class=
  1978               "bibref"
  1979                    href="#bib-MDNS">MDNS</a></cite>].
  1980               </li>
  1981               <li>Set <var>network service record</var>'s <code>type</code> property to the concatenation of the string
  1982               <code>zeroconf:</code> followed be the value of the <abbr title="DNS Pointer Record">PTR</abbr> Service
  1983               Instance Name's <var>Service</var> component [<cite><a class="bibref"
  1984                    href="#bib-MDNS">MDNS</a></cite>].
  1985               </li>
  1986               <li>Set <var>network service record</var>'s <code>url</code> property to the resolvable Service URL
  1987               obtained from performing an <abbr title="Domain Name System">DNS</abbr>-<abbr title=
  1988               "Service Discovery">SD</abbr> Lookup [<cite><a class="bibref"
  1989                    href="#bib-DNS-SD">DNS-SD</a></cite>] of the current service from the <abbr title=
  1990                    "DNS Pointer Record">PTR</abbr> record provided [<cite><a class="bibref"
  1991                    href="#bib-MDNS">MDNS</a></cite>].
  1992               </li>
  1993               <li>Set <var>network service record</var>'s <code>config</code> property to the string value of the
  1994               contents of the first <abbr title="Domain Name System">DNS</abbr>-<abbr title=
  1995               "Service Discovery">SD</abbr> TXT record associated with the <var>service <abbr title=
  1996               "Multicast DNS">mDNS</abbr> response</var> as defined in [<cite><a class="bibref"
  1997                    href="#bib-DNS-SD">DNS-SD</a></cite>].
  1998               </li>
  1999               <li>Set <var>network service record</var>'s <code>expiryTimestamp</code> property to the value of the
  2000               current date, in UTC timestamp format, plus a value of <code>120</code> seconds.
  2001               </li>
  2002               <li>If the result of running the <a href="#dfn-cors-preflight-check"
  2003                     class="internalDFN">CORS preflight check</a> algorithm is <code>pass</code>, passing in the current
  2004                     <var>network service record</var>'s <code>url</code> property as the only argument, or the current
  2005                     <var>network service record</var>'s <code>type</code> property is present in the <a href=
  2006                     "#dfn-network-services-whitelist"
  2007                     class="internalDFN">network services whitelist</a> then run the general rule for <a href=
  2008                     "#dfn-adding-an-available-service"
  2009                     class="internalDFN">adding an available service</a>, passing in the current <var>network service
  2010                     record</var> as the only argument. Otherwise, discard the current <var>network service
  2011                     record</var>.
  2012               </li>
  2013             </ol>
  2014           </li>
  2015         </ol>
  2016       </section>
  2017       <section id="simple-service-discovery-protocol-ssdp">
  2018         <h3 aria-level="2"
  2019             role="heading"
  2020             id="h3_simple-service-discovery-protocol-ssdp">
  2021           <span class="secno">8.2</span> Simple Service Discovery Protocol (<abbr title=
  2022           "Simple Service Discovery Protocol">SSDP</abbr>)
  2023         </h3>
  2024         <p>
  2025           A user agent that implements UPnP service discovery <em class="rfc2119"
  2026              title="MUST">MUST</em> issue a <dfn id="dfn-search-request-for-upnp-root-devices">search request for UPnP
  2027              root devices</dfn> against the user's current local network according to the full normative text and
  2028              timing provided in 'Section 1.3.2: Search request with M-SEARCH' detailed in [<cite><a class="bibref"
  2029              href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>].
  2030         </p>
  2031         <p>
  2032           The user agent <em class="rfc2119"
  2033              title="MUST">MUST</em> issue all <a title="search request for UPnP root devices"
  2034              href="#dfn-search-request-for-upnp-root-devices"
  2035              class="internalDFN">search requests for UPnP root devices</a> with a <abbr title=
  2036              "Hypertext Transfer Protocol">HTTP</abbr> request line equal to <code>M-SEARCH * <abbr title=
  2037              "Hypertext Transfer Protocol">HTTP</abbr>/1.1</code>, with a HOST header equal to the reserved multicast
  2038              address and port of <code>239.255.255.250:1900</code> and a MAN header equal to
  2039              <code>ssdp:discover</code>. The <a href="#dfn-user-agent"
  2040              class="internalDFN">user agent</a> must also send an ST header with this <abbr title=
  2041              "Hypertext Transfer Protocol">HTTP</abbr> request equal to the String value of <code>ssdp:all</code> or
  2042              <code>upnp:rootdevice</code> or a single <a href="#dfn-valid-service-type"
  2043              class="internalDFN">valid service type</a> token beginning with the String value <code>upnp:</code>. If a
  2044              single <a href="#dfn-valid-service-type"
  2045              class="internalDFN">valid service type</a> token beginning with the String value <code>upnp:</code> is to
  2046              be used, the user agent <em class="rfc2119"
  2047              title="MUST">MUST</em> strip the leading String <code>upnp:</code> before using this value in this
  2048              <abbr title="Hypertext Transfer Protocol">HTTP</abbr> request. The user-agent <em class="rfc2119"
  2049              title="MUST">MUST</em> also send an MX header equal to a <dfn id=
  2050              "dfn-maximum-upnp-advertisement-response-wait-time">maximum UPnP advertisement response wait time</dfn>
  2051              value between <code>1</code> and <code>5</code> seconds with this <abbr title=
  2052              "Hypertext Transfer Protocol">HTTP</abbr> request.
  2053         </p>
  2054         <p>
  2055           The user agent <em class="rfc2119"
  2056              title="MUST">MUST</em> listen for any incoming responses to any <a href=
  2057              "#dfn-search-request-for-upnp-root-devices"
  2058              class="internalDFN">search request for UPnP root devices</a>.
  2059         </p>
  2060         <p>
  2061           For each <dfn id="dfn-http-response"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response</dfn>
  2062           following an initial <a href="#dfn-search-request-for-upnp-root-devices"
  2063              class="internalDFN">search request for UPnP root devices</a> sent on a <a href=
  2064              "#dfn-standard-upnp-address-and-port"
  2065              class="internalDFN">standard UPnP address and port</a> the user agent <em class="rfc2119"
  2066              title="MUST">MUST</em> run the following steps:
  2067         </p>
  2068         <ol class="rule">
  2069           <li>If the <a href="#dfn-http-response"
  2070                 class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response</a> is not a
  2071                 <abbr title="Hypertext Transfer Protocol">HTTP</abbr> 200 OK response then this response is invalid and
  2072                 the user agent <em class="rfc2119"
  2073                 title="MUST">MUST</em> discard this response, abort any remaining steps and return. The user agent
  2074                 <em class="rfc2119"
  2075                 title="MAY">MAY</em> issue a new <a href="#dfn-search-request-for-upnp-root-devices"
  2076                 class="internalDFN">search request for UPnP root devices</a> as a result of this error occurring.
  2077           </li>
  2078           <li>If the <a href="#dfn-maximum-upnp-advertisement-response-wait-time"
  2079                 class="internalDFN">maximum UPnP advertisement response wait time</a> has been exceeded since the
  2080                 initial <a href="#dfn-search-request-for-upnp-root-devices"
  2081                 class="internalDFN">search request for UPnP root devices</a> was sent then the <a href=
  2082                 "#dfn-http-response"
  2083                 class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response</a> is invalid and
  2084                 the user agent <em class="rfc2119"
  2085                 title="MUST">MUST</em> discard this response, abort any remaining steps and return. The user agent
  2086                 <em class="rfc2119"
  2087                 title="MAY">MAY</em> stop listening for responses from the current <a href=
  2088                 "#dfn-search-request-for-upnp-root-devices"
  2089                 class="internalDFN">search request for UPnP root devices</a> as a result of this error occurring.
  2090                 Equally, the user agent <em class="rfc2119"
  2091                 title="MAY">MAY</em> issue a new <a href="#dfn-search-request-for-upnp-root-devices"
  2092                 class="internalDFN">search request for UPnP root devices</a> as a result of this error occurring.
  2093           </li>
  2094           <li>Let <var>ssdp device</var> be an Object with a property for each <abbr title=
  2095           "Hypertext Transfer Protocol">HTTP</abbr> header received in the <a href="#dfn-http-response"
  2096                 class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response</a>, with each key
  2097                 being the name of a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> response header and each
  2098                 value being that <abbr title="Hypertext Transfer Protocol">HTTP</abbr> response header's value.
  2099           </li>
  2100           <li>If <var>ssdp device</var> does not contain at least one <var>CACHE-CONTROL</var> entry, at least one
  2101           <var>USN</var> entry, at least one <var>ST</var> entry and at least one <var>LOCATION</var> entry then the
  2102           <a href="#dfn-http-response"
  2103                 class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response</a> is invalid and
  2104                 the <a href="#dfn-user-agent"
  2105                 class="internalDFN">user agent</a> <em class="rfc2119"
  2106                 title="MUST">MUST</em> discard this response, abort any remaining steps and return.
  2107           </li>
  2108           <li>The user agent <em class="rfc2119"
  2109                 title="MUST">MUST</em> run the rule for <a href="#dfn-obtaining-a-upnp-device-description-file"
  2110                 class="internalDFN">obtaining a UPnP Device Description File</a> passing in the first occurrence of
  2111                 <var>LOCATION</var> from <var>ssdp device</var> as the <var>device descriptor URL</var> argument and
  2112                 the first occurrence of <var>USN</var> from <var>ssdp device</var> as the <var>device identifier</var>
  2113                 argument and the first occurrence of <var>CACHE-CONTROL</var> from <var>ssdp device</var> (minus the
  2114                 leading string of <code>max-age=</code>) as the <var>device expiry</var> argument.
  2115           </li>
  2116         </ol>
  2117         <p>
  2118           The user agent <em class="rfc2119"
  2119              title="MUST">MUST</em> listen for incoming requests on the <dfn id=
  2120              "dfn-standard-upnp-address-and-port">standard UPnP address and port</dfn> on all current local network
  2121              interface addresses with the port <code>1900</code>.
  2122         </p>
  2123         <p>
  2124           For each <dfn id="dfn-http-request"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Request</dfn>
  2125           received on a <a href="#dfn-standard-upnp-address-and-port"
  2126              class="internalDFN">standard UPnP address and port</a> the user agent <em class="rfc2119"
  2127              title="MUST">MUST</em> run the following steps:
  2128         </p>
  2129         <ol class="rule">
  2130           <li>If the <a href="#dfn-http-request"
  2131                 class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Request</a> is not a
  2132                 <abbr title="Hypertext Transfer Protocol">HTTP</abbr> NOTIFY request then it is not a valid UPnP
  2133                 Request and the user agent <em class="rfc2119"
  2134                 title="MUST">MUST</em> discard this request, abort any remaining steps and return.
  2135           </li>
  2136           <li>Let <var>ssdp device</var> be an Object with a property for each <abbr title=
  2137           "Hypertext Transfer Protocol">HTTP</abbr> header received in the <a href="#dfn-http-request"
  2138                 class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Request</a>, with each key
  2139                 being the name of a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> header and each value being
  2140                 that <abbr title="Hypertext Transfer Protocol">HTTP</abbr> header's value.
  2141           </li>
  2142           <li>If <var>ssdp device</var>'s <var>NTS</var> entry is equal to <code>ssdp:alive</code> and the <a href=
  2143           "#dfn-http-request"
  2144                 class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Request</a> does not contain
  2145                 at least one <var>CACHE-CONTROL</var> entry, at least one <var>USN</var> entry, at least one
  2146                 <var>NT</var> entry, at least one <var>NTS</var> entry and at least one <var>LOCATION</var> entry, then
  2147                 the <a href="#dfn-user-agent"
  2148                 class="internalDFN">user agent</a> <em class="rfc2119"
  2149                 title="MUST">MUST</em> discard this request, abort any remaining steps and return.
  2150           </li>
  2151           <li>If <var>ssdp device</var>'s <var>NTS</var> entry is equal to <code>ssdp:alive</code> then the user agent
  2152           <em class="rfc2119"
  2153                 title="MUST">MUST</em> run the rule for <a href="#dfn-obtaining-a-upnp-device-description-file"
  2154                 class="internalDFN">obtaining a UPnP Device Description File</a> passing in the first occurrence of
  2155                 <var>LOCATION</var> from <var>ssdp device</var> as the <var>device descriptor URL</var> argument and
  2156                 the first occurrence of <var>USN</var> from <var>ssdp device</var> as the <var>device identifier</var>
  2157                 argument and the first occurrence of <var>CACHE-CONTROL</var> from <var>ssdp device</var> (minus the
  2158                 leading string of <code>max-age=</code>) as the <var>device expiry</var>.<br>
  2159             <br>
  2160             Otherwise, if <var>ssdp device</var>'s <var>NTS</var> entry is equal to <code>ssdp:byebye</code> then the
  2161             user agent <em class="rfc2119"
  2162                 title="MUST">MUST</em> run the rule for <a href=
  2163                 "#dfn-removing-all-services-from-a-registered-upnp-device"
  2164                 class="internalDFN">removing all services from a registered UPnP Device</a> passing in the first
  2165                 occurrence of <var>USN</var> from <var>ssdp device</var> as the <var>device identifier</var> argument.
  2166           </li>
  2167         </ol>
  2168         <p>
  2169           The rule for <dfn id="dfn-obtaining-a-upnp-device-description-file">obtaining a UPnP Device Description
  2170           File</dfn> is the process of obtaining the contents of a standard UPnP Device Description [<cite><a class=
  2171           "bibref"
  2172              href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>] from a URL-based resource. This rule takes
  2173              three arguments - <var>device descriptor URL</var>, <var>device identifier</var> and <var>device
  2174              expiry</var> - and when called the user agent <em class="rfc2119"
  2175              title="MUST">MUST</em> run the following steps:
  2176         </p>
  2177         <ol class="rule">
  2178           <li>Let <var>device descriptor file</var> contain the contents of the file located at the URL provided in
  2179           <var>device descriptor URL</var> obtained according to the rules defined in 'Section 2.11: Retrieving a
  2180           description using <abbr title="Hypertext Transfer Protocol">HTTP</abbr>' in [<cite><a class="bibref"
  2181                href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>].
  2182           </li>
  2183           <li>If the value provided in <var>device descriptor URL</var> cannot be resolved as a reachable URL on the
  2184           current network or the <var>device descriptor file</var> remains empty then it is invalid and the <a href=
  2185           "#dfn-user-agent"
  2186                 class="internalDFN">user agent</a> <em class="rfc2119"
  2187                 title="MUST">MUST</em> abort any remaining steps and return.
  2188           </li>
  2189           <li>Run the rule for <a href="#dfn-processing-a-upnp-device-description-file"
  2190                 class="internalDFN">processing a UPnP Device Description File</a>, passing in the current <var>device
  2191                 descriptor file</var>, <var>device identifier</var> and <var>device expiry</var> arguments.
  2192           </li>
  2193         </ol>
  2194         <p>
  2195           The rule for <dfn id="dfn-processing-a-upnp-device-description-file">processing a UPnP Device Description
  2196           File</dfn> is the process of parsing the contents of a standard UPnP Device Description [<cite><a class=
  2197           "bibref"
  2198              href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>] and registering the UPnP services contained
  2199              therein within the <a href="#dfn-list-of-available-service-records"
  2200              class="internalDFN">list of available service records</a>.
  2201         </p>
  2202         <p>
  2203           The rule for <a href="#dfn-processing-a-upnp-device-description-file"
  2204              class="internalDFN">processing a UPnP Device Description File</a> takes three arguments - <var>device
  2205              descriptor file</var>, <var>device identifier</var> and <var>device expiry</var> - and when called the
  2206              user agent <em class="rfc2119"
  2207              title="MUST">MUST</em> run the following steps:
  2208         </p>
  2209         <ol class="rule">
  2210           <li>Let <var>advertised services</var> be a list of all advertised services obtained from the <var>device
  2211           descriptor file</var> containing the value of the first occurrence of the <code>&lt;serviceList&gt;</code>
  2212           element as it is defined in 'Section 2.3: Device Description' in [<cite><a class="bibref"
  2213                href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>].
  2214           </li>
  2215           <li>For each <code>&lt;service&gt;</code> element - known as an <var>advertised service</var> - in
  2216           <var>advertised services</var> run the following steps:
  2217             <ol class="rule">
  2218               <li>Let <var>network service record</var> be a new Object consisting of the following empty properties:
  2219               <code>id</code>, <code>deviceId</code>, <code>name</code>, <code>type</code>, <code>url</code>,
  2220               <code>eventsUrl</code>, <code>config</code>, <code>expiryTimestamp</code>.
  2221               </li>
  2222               <li>Set <var>network service record</var>'s <code>id</code> property to the concatenated string value of
  2223               the first occurrence of the <code>&lt;UDN&gt;</code> element in the <var>device descriptor file</var>
  2224               with the <var>advertised service</var>'s <code>&lt;serviceId&gt;</code> sub-element.
  2225               </li>
  2226               <li>Set <var>network service record</var>'s <code>deviceId</code> property to the value of <var>device
  2227               identifier</var>.
  2228               </li>
  2229               <li>Set <var>network service record</var>'s <code>name</code> property to the string value of the first
  2230               occurrence of the <var>advertised service</var>'s <code>&lt;serviceId&gt;</code> sub-element.
  2231               </li>
  2232               <li>Set <var>network service record</var>'s <code>type</code> property to the concatenation of the string
  2233               <code>upnp:</code> followed by the string value of the first occurrence of the <var>advertised
  2234               service</var>'s <code>&lt;serviceType&gt;</code> sub-element.
  2235               </li>
  2236               <li>Set <var>network service record</var>'s <code>url</code> property to the string value of the first
  2237               occurrence of the <var>advertised service</var>'s <code>&lt;controlURL&gt;</code> sub-element.
  2238               </li>
  2239               <li>Set <var>network service record</var>'s <code>config</code> property to the string value of the
  2240               contents of the first occurrence of the <code>&lt;device&gt;</code> element in the <var>device descriptor
  2241               file</var>.
  2242               </li>
  2243               <li>If <var>advertised service</var>'s <code>&lt;eventSubURL&gt;</code> sub-element is not empty, then
  2244               set <var>network service record</var>'s <code>eventsUrl</code> property to the string value of the first
  2245               occurrence of the <var>advertised service</var>'s <code>&lt;eventSubURL&gt;</code> sub-element.
  2246               Otherwise, do not set <var>network service record</var>'s <code>eventsUrl</code> property.
  2247               </li>
  2248               <li>Set <var>network service record</var>'s <code>expiryTimestamp</code> property to the value of the
  2249               current date, in UTC timestamp format, plus the value of <var>device expiry</var>.
  2250               </li>
  2251               <li>If the result of running the <a href="#dfn-cors-preflight-check"
  2252                     class="internalDFN">CORS preflight check</a> algorithm is <code>pass</code>, passing in the current
  2253                     <var>network service record</var>'s <code>url</code> property as the only argument, or the current
  2254                     <var>network service record</var>'s <code>type</code> property is present in the <a href=
  2255                     "#dfn-network-services-whitelist"
  2256                     class="internalDFN">network services whitelist</a> then run the general rule for <a href=
  2257                     "#dfn-adding-an-available-service"
  2258                     class="internalDFN">adding an available service</a>, passing in the current <var>network service
  2259                     record</var> as the only argument. Otherwise, discard the current <var>network service
  2260                     record</var>.
  2261               </li>
  2262             </ol>
  2263           </li>
  2264           <li>If <var>device descriptor file</var> contains a <code>&lt;deviceList&gt;</code> element then for each
  2265           <code>&lt;device&gt;</code> element within <code>&lt;deviceList&gt;</code> - herein known as an <var>embedded
  2266           device descriptor file</var> - the user agent <em class="rfc2119"
  2267                 title="MUST">MUST</em> run the rule for <a href="#dfn-processing-a-upnp-device-description-file"
  2268                 class="internalDFN">processing a UPnP Device Description File</a>, passing in the current <var>embedded
  2269                 device descriptor file</var> as the <var>device descriptor file</var> argument, along with the current
  2270                 <var>device identifier</var> and <var>device expiry</var> arguments.
  2271           </li>
  2272         </ol>
  2273         <p>
  2274           The rule for <dfn id="dfn-removing-all-services-from-a-registered-upnp-device">removing all services from a
  2275           registered UPnP Device</dfn> is the process of removing all services associated with a device from the
  2276           <a href="#dfn-list-of-available-service-records"
  2277              class="internalDFN">list of available service records</a> that has left the user's current network or has
  2278              otherwise timed out or expired. This rule takes one argument, <var>device identifier</var>, and consists
  2279              of running the following steps:
  2280         </p>
  2281         <ol class="rule">
  2282           <li>For each <var>existing service record</var> in the current <a href=
  2283           "#dfn-list-of-available-service-records"
  2284                 class="internalDFN">list of available service records</a>, run the following sub-steps:
  2285             <ol class="rule">
  2286               <li>If the <var>existing service record</var>'s <code>deviceId</code> property does not match <var>device
  2287               identifier</var> then skip any remaining sub-steps for the current <var>existing service record</var> and
  2288               continue at the next available <var>existing service record</var>.
  2289               </li>
  2290               <li>Run the general rule for <a href="#dfn-removing-an-available-service"
  2291                     class="internalDFN">removing an available service</a> passing in <var>existing service
  2292                     record</var>'s <code>id</code> property as the only argument.
  2293               </li>
  2294             </ol>
  2295           </li>
  2296         </ol>
  2297         <p>
  2298           When the <a href="#dfn-user-agent"
  2299              class="internalDFN">user agent</a> is to <dfn id="dfn-setup-a-upnp-events-subscription">setup a UPnP
  2300              Events Subscription</dfn>, it is to run the following steps with the current <var>network service
  2301              record</var> object as defined in 'Section 4.1.2: SUBSCRIBE with NT and CALLBACK' in [<cite><a class=
  2302              "bibref"
  2303              href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>]:
  2304         </p>
  2305         <ol class="rule">
  2306           <li>If <var>network service record</var>'s <code>eventsUrl</code> property is empty then the <a href=
  2307           "#dfn-user-agent"
  2308                 class="internalDFN">user agent</a> <em class="rfc2119"
  2309                 title="MUST">MUST</em> abort these steps.
  2310           </li>
  2311           <li>Let <var>callback URL</var> be the value of creating a new <a href=
  2312           "#dfn-user-agent-generated-callback-url"
  2313                 class="internalDFN">user-agent generated callback url</a>.
  2314           </li>
  2315           <li>Send a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> SUBSCRIBE request with a <em>NT</em> header
  2316           with a string value of <code>upnp:event</code>, a <em>TIMEOUT</em> header with a user-agent defined timeout
  2317           value (in the form <code>Second-XX</code> where <code>XX</code> is the user-agent defined timeout value in
  2318           seconds) and a <em>CALLBACK</em> header with a string value of <var>callback URL</var> towards the
  2319           <var>network service record</var>'s <code>eventsUrl</code> property.
  2320           </li>
  2321           <li>If a non-200 OK response is received from the <abbr title="Hypertext Transfer Protocol">HTTP</abbr>
  2322           SUBSCRIBE request then the <a href="#dfn-user-agent"
  2323                 class="internalDFN">user agent</a> <em class="rfc2119"
  2324                 title="MUST">MUST</em> abort these steps.
  2325           </li>
  2326           <li>On receiving a valid 200 OK response, run the following steps:
  2327             <ol class="rule">
  2328               <li>Let <var>callback ID</var> equal the string value of the first included <em>SID</em> header, if it
  2329               exists.
  2330               </li>
  2331               <li>Let <var>timeout date</var> equal the sum of the current UTC date value plus the integer value of the
  2332               first included <em>TIMEOUT</em> header (minus the leading string of <code>Second-</code>), if it exists.
  2333               </li>
  2334               <li>Run the following steps asynchronously and continue to the step labeled <em>listen</em> below.
  2335               </li>
  2336               <li>
  2337                 <em>Refresh Subscription</em>: Run the following steps at a set interval (X) within the <a href=
  2338                 "#dfn-user-agent"
  2339                     class="internalDFN">user agent</a>:
  2340                 <ol class="rule">
  2341                   <li>Let <var>current date</var> equal the current UTC date.
  2342                   </li>
  2343                   <li>If <var>current date</var> is less than the <var>timeout date</var> then continue to the step
  2344                   labeled <em>refresh subscription</em> above.
  2345                   </li>
  2346                   <li>Send a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> SUBSCRIBE request with a
  2347                   <em>SID</em> header with the string value of <var>callback ID</var> and a user-agent defined
  2348                   <em>TIMEOUT</em> header (in the form <code>Second-XX</code> where <code>XX</code> is the user-agent
  2349                   defined timeout value in seconds) towards the <var>network service record</var>'s
  2350                   <code>eventsUrl</code> property.
  2351                   </li>
  2352                   <li>On receiving a valid 200 OK, update <var>callback ID</var> with the string value of the first
  2353                   included <em>SID</em> header and set <var>timeout date</var> to the sum of the current UTC date value
  2354                   plus the integer value of the first included <em>TIMEOUT</em> header (minus the leading string of
  2355                   <code>Second-</code>), if it exists. If the current date is greater than or equal to <var>timeout
  2356                   date</var> then the <a href="#dfn-user-agent"
  2357                         class="internalDFN">user agent</a> <em class="rfc2119"
  2358                         title="SHOULD">SHOULD</em> continue from the step labeled <em>refresh subscription</em> above.
  2359                         For all non 200 OK responses the <a href="#dfn-user-agent"
  2360                         class="internalDFN">user agent</a> <em class="rfc2119"
  2361                         title="SHOULD">SHOULD</em> continue from the step labeled <em>refresh subscription</em> above.
  2362                   </li>
  2363                 </ol>
  2364               </li>
  2365               <li>
  2366                 <em>Listen</em>: For each <abbr title="Hypertext Transfer Protocol">HTTP</abbr> NOTIFY request received
  2367                 at the <var>callback URL</var> the <a href="#dfn-user-agent"
  2368                     class="internalDFN">user agent</a> is to run the following steps:
  2369                 <ol class="rule">
  2370                   <li>Let <var>content clone</var> be the result of obtaining the message body of the <abbr title=
  2371                   "Hypertext Transfer Protocol">HTTP</abbr> NOTIFY request. If <var>content clone</var> is empty, then
  2372                   the <a href="#dfn-user-agent"
  2373                         class="internalDFN">user agent</a> <em class="rfc2119"
  2374                         title="MUST">MUST</em> abort these steps.
  2375                   </li>
  2376                   <li>Let <var>notification event</var> be a new simple event that uses the <a href=
  2377                   "http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event"
  2378                         class="externalDFN"><code>Event</code></a> interface with the name <a href=
  2379                         "#event-notify"><code>notify</code></a>, which does not bubble, is not cancellable, and has no
  2380                         default action.
  2381                   </li>
  2382                   <li>Let the <code>data</code> attribute of <var>notification event</var> have the DOMString value of
  2383                   <var>content clone</var>.
  2384                   </li>
  2385                   <li>
  2386                     <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
  2387                         class="externalDFN">Queue a task</a> to dispatch <var>notification event</var> at the current
  2388                         <a href="#networkservice"
  2389                         class="internalDFN"><code>NetworkService</code></a> object.
  2390                   </li>
  2391                   <li>Return a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> 200 OK response to the sender of
  2392                   the <abbr title="Hypertext Transfer Protocol">HTTP</abbr> NOTIFY request.
  2393                   </li>
  2394                 </ol>
  2395               </li>
  2396             </ol>
  2397           </li>
  2398         </ol>
  2399         <p>
  2400           A <a href="#dfn-user-agent"
  2401              class="internalDFN">user agent</a> can <dfn id=
  2402              "dfn-terminate-an-existing-upnp-events-subscription">terminate an existing UPnP Events Subscription</dfn>
  2403              at any time for a <var>network service record</var> by sending an <abbr title=
  2404              "Hypertext Transfer Protocol">HTTP</abbr> UNSUBSCRIBE request - as defined in 'Section 4.1.4: Cancelling a
  2405              subscription with UNSUBSCRIBE' in [<cite><a class="bibref"
  2406              href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>] - with a HOST header set to that <var>active
  2407              service</var>'s <code>eventsUrl</code> property and a SID header set to the <var>callback ID</var>
  2408              obtained when the initial <a href="#dfn-setup-a-upnp-events-subscription"
  2409              class="internalDFN">setup a UPnP Events Subscription</a> action occurred.
  2410         </p>
  2411       </section>
  2412       <section id="discovery-and-launch-protocol-dial">
  2413         <h3 aria-level="2"
  2414             role="heading"
  2415             id="h3_discovery-and-launch-protocol-dial">
  2416           <span class="secno">8.3</span> Discovery and Launch Protocol (<abbr title=
  2417           "Discovery and Launch Protocol">DIAL</abbr>)
  2418         </h3>
  2419         <p>
  2420           A user agent that implements <abbr title="Discovery and Launch Protocol">DIAL</abbr> service discovery
  2421           <em class="rfc2119"
  2422              title="MUST">MUST</em> issue a <dfn id="dfn-search-request-for-dial-enabled-devices">search request for
  2423              <abbr title="Discovery and Launch Protocol">DIAL</abbr>-enabled devices</dfn> against the user's current
  2424              local network according to the full normative text and timing provided in 'Section 1.3.2: Search request
  2425              with M-SEARCH' detailed in [<cite><a class="bibref"
  2426              href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>].
  2427         </p>
  2428         <p>
  2429           Let <var>dial version</var> be the version number specified in the <a href="#dfn-valid-service-type"
  2430              class="internalDFN">valid service type</a> token. Let <var>dial search target</var> be the concatentation
  2431              of the <code>urn:dial-multiscreen-org:service:dial:</code> string constant with the <var>dial
  2432              version</var> (currently, <var>dial version</var> can only be <code>1</code>)
  2433         </p>
  2434         <p>
  2435           The user agent <em class="rfc2119"
  2436              title="MUST">MUST</em> issue all <a title="search request for DIAL devices">search requests for
  2437              <abbr title="Discovery and Launch Protocol">DIAL</abbr> devices</a> with a <abbr title=
  2438              "Hypertext Transfer Protocol">HTTP</abbr> request line equal to <code>M-SEARCH * <abbr title=
  2439              "Hypertext Transfer Protocol">HTTP</abbr>/1.1</code>, with a HOST header equal to the reserved multicast
  2440              address and port of <code>239.255.255.250:1900</code>, a MAN header equal to <code>ssdp:discover</code>,
  2441              an ST header equal to <var>dial search target</var> and a user-agent defined MX header equal to a <dfn id=
  2442              "dfn-maximum-dial-advertisement-response-wait-time">maximum <abbr title=
  2443              "Discovery and Launch Protocol">DIAL</abbr> advertisement response wait time</dfn> value between
  2444              <code>1</code> and <code>5</code> seconds.
  2445         </p>
  2446         <p>
  2447           The user agent <em class="rfc2119"
  2448              title="MUST">MUST</em> listen for any incoming responses to a <a>search request for <abbr title=
  2449              "Discovery and Launch Protocol">DIAL</abbr> devices</a>.
  2450         </p>
  2451         <p>
  2452           For each <abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response following an initial <a>search
  2453           request for <abbr title="Discovery and Launch Protocol">DIAL</abbr> devices</a> sent on a <a href=
  2454           "#dfn-standard-upnp-address-and-port"
  2455              class="internalDFN">standard UPnP address and port</a> the user agent <em class="rfc2119"
  2456              title="MUST">MUST</em> run the following steps:
  2457         </p>
  2458         <ol class="rule">
  2459           <li>If the <abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response is not a <abbr title=
  2460           "Hypertext Transfer Protocol">HTTP</abbr> 200 OK response then this response is invalid and the user agent
  2461           <em class="rfc2119"
  2462                 title="MUST">MUST</em> discard this response, abort any remaining steps and return. The user agent
  2463                 <em class="rfc2119"
  2464                 title="MAY">MAY</em> issue a new <a>search request for <abbr title=
  2465                 "Discovery and Launch Protocol">DIAL</abbr> devices</a> as a result of this error occurring.
  2466           </li>
  2467           <li>If the <a href="#dfn-maximum-dial-advertisement-response-wait-time"
  2468                 class="internalDFN">maximum <abbr title="Discovery and Launch Protocol">DIAL</abbr> advertisement
  2469                 response wait time</a> has been exceeded since the initial <a>search request for <abbr title=
  2470                 "Discovery and Launch Protocol">DIAL</abbr> devices</a> was sent then the <a href="#dfn-http-response"
  2471                 class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response</a> is invalid and
  2472                 the user agent <em class="rfc2119"
  2473                 title="MUST">MUST</em> discard this response, abort any remaining steps and return. The user agent
  2474                 <em class="rfc2119"
  2475                 title="MAY">MAY</em> stop listening for responses from the current <a>search request for <abbr title=
  2476                 "Discovery and Launch Protocol">DIAL</abbr> devices</a> as a result of this error occurring. Equally,
  2477                 the user agent <em class="rfc2119"
  2478                 title="MAY">MAY</em> issue a new <a>search request for <abbr title=
  2479                 "Discovery and Launch Protocol">DIAL</abbr> devices</a> as a result of this error occurring.
  2480           </li>
  2481           <li>Let <var>dial device</var> be an Object with a property for each <abbr title=
  2482           "Hypertext Transfer Protocol">HTTP</abbr> header received in the <a href="#dfn-http-response"
  2483                 class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response</a>, with each key
  2484                 being the name of a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> response header and each
  2485                 value being that <abbr title="Hypertext Transfer Protocol">HTTP</abbr> response header's value.
  2486           </li>
  2487           <li>If <var>dial device</var> does not contain at least one <var>CACHE-CONTROL</var> entry, at least one
  2488           <var>USN</var> entry, at least one <var>ST</var> entry and at least one <var>LOCATION</var> entry or the
  2489           value of its <var>ST</var> entry is not <var>dial search target</var>, then the <a href="#dfn-http-response"
  2490                 class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response</a> is invalid and
  2491                 the <a href="#dfn-user-agent"
  2492                 class="internalDFN">user agent</a> <em class="rfc2119"
  2493                 title="MUST">MUST</em> discard this response, abort any remaining steps and return.
  2494           </li>
  2495           <li>The user agent <em class="rfc2119"
  2496                 title="MUST">MUST</em> run the rule for <a href="#dfn-obtaining-a-upnp-device-description-file"
  2497                 class="internalDFN">obtaining a UPnP Device Description File</a> passing in the first occurrence of
  2498                 <var>LOCATION</var> from <var>dial device</var> as the <var>device descriptor URL</var> argument and
  2499                 the first occurrence of <var>USN</var> from <var>dial device</var> as the <var>device identifier</var>
  2500                 argument and the first occurrence of <var>CACHE-CONTROL</var> from <var>dial device</var> (minus the
  2501                 leading string of <code>max-age=</code>) as the <var>device expiry</var> argument.
  2502           </li>
  2503         </ol>
  2504         <p>
  2505           The rule for <dfn id="dfn-obtaining-a-dial-device-description-file">obtaining a <abbr title=
  2506           "Discovery and Launch Protocol">DIAL</abbr> Device Description File</dfn> is the process of obtaining the
  2507           contents of a standard UPnP Device Description [<cite><a class="bibref"
  2508              href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>] from a URL-based resource. This rule takes
  2509              three arguments - <var>device descriptor URL</var>, <var>device identifier</var> and <var>device
  2510              expiry</var> - and when called the user agent <em class="rfc2119"
  2511              title="MUST">MUST</em> run the following steps:
  2512         </p>
  2513         <ol class="rule">
  2514           <li>Let <var>device descriptor file</var> contain the contents of the file located at the URL provided in
  2515           <var>device descriptor URL</var> obtained according to the rules defined in 'Section 2.11: Retrieving a
  2516           description using <abbr title="Hypertext Transfer Protocol">HTTP</abbr>' in [<cite><a class="bibref"
  2517                href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>].
  2518           </li>
  2519           <li>Let <var>application url</var> be the value of the first occurrence of the <code>Application-URL</code>
  2520           response header field obtained according to the rules defined in 'Section 5.4: Device Description Response'
  2521           in [<a href="https://sites.google.com/a/dial-multiscreen.org/dial/dial-protocol-specification"><abbr title=
  2522           "Discovery and Launch Protocol">DIAL</abbr></a>]
  2523           </li>
  2524           <li>If the value provided in <var>device descriptor URL</var> cannot be resolved as a reachable URL on the
  2525           current network or the <var>device descriptor file</var> remains empty or <var>application url</var> is
  2526           undefined then it is invalid and the <a href="#dfn-user-agent"
  2527                 class="internalDFN">user agent</a> <em class="rfc2119"
  2528                 title="MUST">MUST</em> abort any remaining steps and return.
  2529           </li>
  2530           <li>Run the following steps to add the newly discovered <abbr title=
  2531           "Discovery and Launch Protocol">DIAL</abbr> service:
  2532             <ol class="rule">
  2533               <li>Let <var>network service record</var> be a new Object consisting of the following empty properties:
  2534               <code>id</code>, <code>deviceId</code>, <code>name</code>, <code>type</code>, <code>url</code>,
  2535               <code>expiryTimestamp</code>.
  2536               </li>
  2537               <li>Set <var>network service record</var>'s <code>id</code> property to the first occurrence of the
  2538               <code>&lt;UDN&gt;</code> element in the <var>descriptor file</var> prefixed with the <code>dial:</code>
  2539               string constant
  2540               </li>
  2541               <li>Set <var>network service record</var>'s <code>deviceId</code> property to the value of <var>device
  2542               identifier</var>.
  2543               </li>
  2544               <li>Set <var>network service record</var>'s <code>name</code> property to the string value of the first
  2545               occurrence of the <code>&lt;friendlyName&gt;</code> element in the <var>descriptor file</var>.
  2546               </li>
  2547               <li>Set <var>network service record</var>'s <code>type</code> property to <var>dial search target</var>.
  2548               </li>
  2549               <li>Set <var>network service record</var>'s <code>url</code> property to the string value of the
  2550               <var>application url</var>.
  2551               </li>
  2552               <li>Set <var>network service record</var>'s <code>expiryTimestamp</code> property to the value of the
  2553               current date, in UTC timestamp format, plus the value of <var>device expiry</var>.
  2554               </li>
  2555               <li>If the result of running the <a href="#dfn-cors-preflight-check"
  2556                     class="internalDFN">CORS preflight check</a> algorithm is <code>pass</code>, passing in the current
  2557                     <var>network service record</var>'s <code>url</code> property as the only argument, or the current
  2558                     <var>network service record</var>'s <code>type</code> property is present in the <a href=
  2559                     "#dfn-network-services-whitelist"
  2560                     class="internalDFN">network services whitelist</a> then run the general rule for <a href=
  2561                     "#dfn-adding-an-available-service"
  2562                     class="internalDFN">adding an available service</a>, passing in the current <var>network service
  2563                     record</var> as the only argument. Otherwise, discard the current <var>network service
  2564                     record</var>.
  2565               </li>
  2566             </ol>
  2567           </li>
  2568         </ol>
  2569       </section>
  2570       <section id="network-topology-monitoring">
  2571         <h3 aria-level="2"
  2572             role="heading"
  2573             id="h3_network-topology-monitoring">
  2574           <span class="secno">8.4</span> Network Topology Monitoring
  2575         </h3>
  2576         <div>
  2577           <p>
  2578             When the <a href="#dfn-user-agent"
  2579                class="internalDFN">user agent</a> detects that the user has dropped from a connected network then, for
  2580                each <var>existing service record</var> in the <a href="#dfn-list-of-available-service-records"
  2581                class="internalDFN">list of available service records</a> discovered via that network connection, the
  2582                <a href="#dfn-user-agent"
  2583                class="internalDFN">user agent</a> <em class="rfc2119"
  2584                title="MUST">MUST</em> run the general rule for <a href="#dfn-removing-an-available-service"
  2585                class="internalDFN">removing an available service</a> passing in each <var>existing service
  2586                record</var>'s <code>id</code> property as the only argument for each call.
  2587           </p>
  2588           <p>
  2589             When the <a href="#dfn-user-agent"
  2590                class="internalDFN">user agent</a> detects that the user has connected to a new network or reconnected
  2591                to an existing network, then it <em class="rfc2119"
  2592                title="SHOULD">SHOULD</em> restart its discovery mechanisms as defined in the <a href=
  2593                "#service-discovery">Service Discovery</a> section of this specification, maintaining the existing
  2594                <a href="#dfn-list-of-active-service-managers"
  2595                class="internalDFN">list of active service managers</a> currently in use.
  2596           </p>
  2597         </div>
  2598       </section>
  2599     </section>
  2600     <section id="events-summary">
  2601       <h2 aria-level="1"
  2602           role="heading"
  2603           id="h2_events-summary">
  2604         <span class="secno">9.</span> Events Summary
  2605       </h2>
  2606       <p>
  2607         The following events are dispatched on the <a href="#networkservices"><code>NetworkServices</code></a> and/or
  2608         <a href="#networkservice"><code>NetworkService</code></a> objects:
  2609       </p>
  2610       <table border="1">
  2611         <thead>
  2612           <tr>
  2613             <th>
  2614               <span>Event name</span>
  2615             </th>
  2616             <th>
  2617               <span>Interface</span>
  2618             </th>
  2619             <th>
  2620               <span>Dispatched when...</span>
  2621             </th>
  2622           </tr>
  2623         </thead>
  2624         <tbody>
  2625           <tr>
  2626             <td>
  2627               <dfn id="event-servicefound"><code>servicefound</code></dfn>
  2628             </td>
  2629             <td>
  2630               <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event"
  2631                   class="externalDFN"><code>Event</code></a>
  2632             </td>
  2633             <td>
  2634               When a <a href="#dfn-new-service"
  2635                   class="internalDFN">new service</a> that matches one of the <a>requested type tokens</a> is found in
  2636                   the current network.
  2637             </td>
  2638           </tr>
  2639           <tr>
  2640             <td>
  2641               <dfn id="event-servicelost"><code>servicelost</code></dfn>
  2642             </td>
  2643             <td>
  2644               <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event"
  2645                   class="externalDFN"><code>Event</code></a>
  2646             </td>
  2647             <td>
  2648               When an <a href="#dfn-existing-service"
  2649                   class="internalDFN">existing service</a> that matches one of the <a>requested type tokens</a>
  2650                   gracefully leaves or expires from the current network.
  2651             </td>
  2652           </tr>
  2653           <tr>
  2654             <td>
  2655               <dfn id="event-available"><code>available</code></dfn>
  2656             </td>
  2657             <td>
  2658               <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event"
  2659                   class="externalDFN"><code>Event</code></a>
  2660             </td>
  2661             <td>
  2662               When a <a href="#dfn-current-service"
  2663                   class="internalDFN">current service</a> renews its service registration within the current network.
  2664             </td>
  2665           </tr>
  2666           <tr>
  2667             <td>
  2668               <dfn id="event-unavailable"><code>unavailable</code></dfn>
  2669             </td>
  2670             <td>
  2671               <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event"
  2672                   class="externalDFN"><code>Event</code></a>
  2673             </td>
  2674             <td>
  2675               When a <a href="#dfn-current-service"
  2676                   class="internalDFN">current service</a> gracefully leaves or otherwise expires from the current
  2677                   network.
  2678             </td>
  2679           </tr>
  2680           <tr>
  2681             <td>
  2682               <dfn id="event-notify"><code>notify</code></dfn>
  2683             </td>
  2684             <td>
  2685               <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event"
  2686                   class="externalDFN"><code>Event</code></a>
  2687             </td>
  2688             <td>
  2689               When a valid UPnP Events Subscription Message is received on a <a href=
  2690               "#dfn-user-agent-generated-callback-url"
  2691                   class="internalDFN">user-agent generated callback url</a> for a <a href="#dfn-current-service"
  2692                   class="internalDFN">current service</a>. This event never fires for Zeroconf-based services.
  2693             </td>
  2694           </tr>
  2695         </tbody>
  2696       </table>
  2697     </section>
  2698     <section id="garbage-collection">
  2699       <h2 aria-level="1"
  2700           role="heading"
  2701           id="h2_garbage-collection">
  2702         <span class="secno">10.</span> Garbage collection
  2703       </h2>
  2704       <p>
  2705         There is an <dfn id="dfn-implied-strong-reference">implied strong reference</dfn> from any IDL attribute in
  2706         this <abbr title="Application Programming Interface">API</abbr> that returns a pre-existing object to that
  2707         object.
  2708       </p>
  2709       <div class="note">
  2710         <div class="note-title"
  2711              aria-level="2"
  2712              role="heading"
  2713              id="h_note_2">
  2714           <span>Note</span>
  2715         </div>
  2716         <p class="">
  2717           For example, if a <a href="#networkservices"
  2718              class="internalDFN"><code>NetworkServices</code></a> object has one or more <a href=
  2719              "#dfn-indexed-properties-1"
  2720              class="internalDFN">indexed properties</a> attached to it then there is a strong reference from that
  2721              <a href="#networkservices"
  2722              class="internalDFN"><code>NetworkServices</code></a> object toward each of its <a href=
  2723              "#dfn-indexed-properties-1"
  2724              class="internalDFN">indexed properties</a>.
  2725         </p>
  2726       </div>
  2727       <p>
  2728         If a <a href="#dfn-user-agent"
  2729            class="internalDFN">user agent</a> is to <dfn id="dfn-make-disappear">make disappear</dfn> a <a href=
  2730            "#networkservices"
  2731            class="internalDFN"><code>NetworkServices</code></a> object (this happens when a <a href=
  2732            "http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#document"
  2733            class="externalDFN"><code>Document</code></a> object goes away), the <a href="#dfn-user-agent"
  2734            class="internalDFN">user agent</a> <em class="rfc2119"
  2735            title="MUST">MUST</em> remove this object from the <a href="#dfn-list-of-active-service-managers"
  2736            class="internalDFN">list of active service managers</a>.
  2737       </p>
  2738     </section>
  2739     <section id="use-cases-and-requirements">
  2740       <h2 aria-level="1"
  2741           role="heading"
  2742           id="h2_use-cases-and-requirements">
  2743         <span class="secno">11.</span> Use Cases and Requirements
  2744       </h2>
  2745       <p>
  2746         This section covers what the requirements are for this <abbr title=
  2747         "Application Programming Interface">API</abbr>, as well as illustrates some use cases.
  2748       </p>
  2749       <ul class="rule">
  2750         <li>Once a user has given permission, user agents should provide the ability for Web pages to communicate
  2751         directly with a Local-networked Service.
  2752           <ul class="rule">
  2753             <li>Example: A web-based TV remote control. A Web page wants to control the current user's TV, changing the
  2754             programming shown or increasing/decreasing/muting the volume of the Local-networked Device. The Web page
  2755             requests a service type that is known to be implemented by television sets to which it has the application
  2756             logic to communicate. Local devices providing the request service types are discovered and presented to the
  2757             user for authorization. The user selects one or more of the discovered television sets to be accessible to
  2758             the current Web page and then clicks 'Share'. The Web page can now communicate directly with the
  2759             user-authorized Local-networked services.
  2760             </li>
  2761           </ul>
  2762         </li>
  2763         <li>Web pages should be able to communicate with Local-networked Services using the messaging channel supported
  2764         by those Devices.
  2765           <ul class="rule">
  2766             <li>Example: A Web page advertises that it is capable of controlling multiple Home Media Servers. The user
  2767             can select their Home Media Server type from a drop-down list, at which point the Web page sends a request
  2768             to the user agent to connect with the associated service type of the Home Media Server. The Media Server
  2769             selected implements a Web Socket channel for bi-directional service communication and so the Web page opens
  2770             a web socket to the requested Media Server and can communicate as required via that appropriate channel.
  2771             </li>
  2772           </ul>
  2773         </li>
  2774         <li>Web pages should be able to communicate with Local-networked Services using the messaging format supported
  2775         by those Devices.
  2776           <ul class="rule">
  2777             <li>Example: A Web page advertises that it is capable of interacting with and controlling multiple types of
  2778             Home Media Server. The user can select their Home Media Server type from a drop-down list or known Media
  2779             Servers, at which point the Web page sends a request to the user agent to connect with the associated
  2780             service type (and, optionally, the associated event type) of the Home Media Server. The communication
  2781             protocols supported by Home Media Servers typically vary between UPnP, JSON-RPC, Protocol Buffers or other
  2782             messaging formats depending on the Home Media Server requested. The Web page is able to communicate with
  2783             the user-selected Home Media Server in the messaging format supported by that Device, which, in this
  2784             example is a simple key/value pair text format.
  2785             </li>
  2786           </ul>
  2787         </li>
  2788         <li>Web pages should not be able to communicate with Local-networked Services that have not been authorized by
  2789         the user thereby maintaining the user's privacy.
  2790           <ul class="rule">
  2791             <li>Example: A Web page requests access to one type of Local-networked service. The user authorizes access
  2792             to that particular service. Other services running on that same device, and on other devices within the
  2793             network, should not be accessible to the current Web page.
  2794             </li>
  2795           </ul>
  2796         </li>
  2797         <li>A user should be able to share one or more Local-networked Services based on a particular service type
  2798         request from a Web page.
  2799           <ul class="rule">
  2800             <li>Example: A Web page is capable of interacting with a specific profile of Local-networked Service. As
  2801             such, it makes a request to the user agent to access those services, of which multiple matches are found.
  2802             The user is capable of selecting one or more of the discovered services to share with the Web page. The Web
  2803             page can then implement a drag-and-drop interface for the user to drag specific actions on to one or more
  2804             of the authorized Local-networked Services.
  2805             </li>
  2806           </ul>
  2807         </li>
  2808         <li>User agents should provide an <abbr title="Application Programming Interface">API</abbr> exposed to script
  2809         that exposes the features above. The user is notified by UI anytime interaction with Local-networked Services
  2810         is requested, giving the user full ability to cancel or abort the transaction. The user selects the
  2811         Local-networked Services to be connected to the current Web page, and can cancel these at any time. No
  2812         invocations to these APIs occur silently without user intervention.
  2813         </li>
  2814       </ul>
  2815     </section>
  2816     <section class="informative appendix"
  2817              id="examples">
  2818       <h2 aria-level="1"
  2819           role="heading"
  2820           id="h2_examples">
  2821         <span class="secno">A.</span> Examples
  2822       </h2>
  2823       <p>
  2824         <em>This section is non-normative.</em>
  2825       </p>
  2826       <div class="example">
  2827         <p>
  2828           This sample code exposes a button. When clicked, this button is disabled and the user is prompted to offer a
  2829           network service. The user may also select multiple network services. When the user has authorized a network
  2830           service to be connected to the web page then the web page issues a simple command to get a list of all the
  2831           albums stored on the connected media player service.
  2832         </p>
  2833         <p>
  2834           The button is re-enabled only when the connected network service disconnects for whatever reason (the service
  2835           becomes unavailable on the network, the user disconnects from their current network or the user revokes
  2836           access to the service from the current web page). At this point the user can re-click the button to select a
  2837           new network service to connect to the web page and the above steps are repeated.
  2838         </p>
  2839         <p>
  2840           The provided service type identifier and service interaction used in this example is based on the
  2841           well-defined service type and messaging format supported by the <a href="http://xbmc.org/about/">XBMC Media
  2842           Server</a>.
  2843         </p>
  2844         <hr>
  2845         <pre class="highlight prettyprint">
  2846 <span class="tag">&lt;input</span><span class="pln"> </span><span class="atn">type</span><span class=
  2847 "pun">=</span><span class="atv">"button"</span><span class="pln"> </span><span class="atn">value</span><span class=
  2848 "pun">=</span><span class="atv">"Start"</span><span class="pln"> </span><span class="atn">onclick</span><span class=
  2849 "pun">=</span><span class="atv">"</span><span class="pln">start</span><span class="pun">()</span><span class=
  2850 "atv">"</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class=
  2851 "atv">"startBtn"</span><span class="tag">/&gt;</span><span class="pln">
  2852 </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">id</span><span class=
  2853 "pun">=</span><span class="atv">"debugconsole"</span><span class="tag">&gt;&lt;/div&gt;</span><span class="pln">
  2854 
  2855 </span><span class="tag">&lt;script&gt;</span><span class="pln">
  2856  </span><span class="kwd">var</span><span class="pln"> startBtn </span><span class="pun">=</span><span class=
  2857 "pln"> document</span><span class="pun">.</span><span class="pln">getElementById</span><span class=
  2858 "pun">(</span><span class="str">'startBtn'</span><span class="pun">),</span><span class="pln">
  2859      debug </span><span class="pun">=</span><span class="pln"> document</span><span class="pun">.</span><span class=
  2860 "pln">getElementById</span><span class="pun">(</span><span class="str">'debugconsole'</span><span class=
  2861 "pun">);</span><span class="pln">
  2862 
  2863  </span><span class="kwd">function</span><span class="pln"> start</span><span class="pun">()</span><span class=
  2864 "pln"> </span><span class="pun">{</span><span class="pln">
  2865    </span><span class="kwd">if</span><span class="pun">(</span><span class="pln">navigator</span><span class=
  2866 "pun">.</span><span class="pln">getNetworkServices</span><span class="pun">)</span><span class=
  2867 "pln"> </span><span class="pun">{</span><span class="pln">
  2868       navigator</span><span class="pun">.</span><span class="pln">getNetworkServices</span><span class=
  2869 "pun">(</span><span class="str">'zeroconf:_xbmc-jsonrpc._tcp'</span><span class="pun">).</span><span class=
  2870 "pln">then</span><span class="pun">(</span><span class="pln">gotXBMCService</span><span class=
  2871 "pun">).</span><span class="kwd">catch</span><span class="pun">(</span><span class="pln">error</span><span class=
  2872 "pun">);</span><span class="pln">
  2873       startBtn</span><span class="pun">.</span><span class="pln">disabled </span><span class="pun">=</span><span class=
  2874 "pln"> </span><span class="kwd">true</span><span class="pun">;</span><span class="pln">
  2875    </span><span class="pun">}</span><span class="pln"> </span><span class="kwd">else</span><span class=
  2876 "pln"> </span><span class="pun">{</span><span class="pln">
  2877       debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class=
  2878 "pln"> </span><span class="str">"&lt;br&gt;Service Discovery not supported!"</span><span class=
  2879 "pun">;</span><span class="pln">
  2880    </span><span class="pun">}</span><span class="pln">
  2881  </span><span class="pun">}</span><span class="pln">
  2882 
  2883  </span><span class="kwd">function</span><span class="pln"> gotXBMCService</span><span class="pun">(</span><span class=
  2884 "pln">services</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  2885 
  2886 </span><span class="com">// Listen for service disconnect messages</span><span class="pln">
  2887 
  2888    services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class=
  2889 "pln">addEventListener</span><span class="pun">(</span><span class="str">'unavailable'</span><span class=
  2890 "pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class=
  2891 "pun">(</span><span class="pln"> e </span><span class="pun">)</span><span class="pln"> </span><span class=
  2892 "pun">{</span><span class="pln">
  2893        debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class=
  2894 "pln"> </span><span class="str">"&lt;br&gt;"</span><span class="pln"> </span><span class="pun">+</span><span class=
  2895 "pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class=
  2896 "pln">name </span><span class="pun">+</span><span class="pln"> </span><span class=
  2897 "str">" disconnected."</span><span class="pun">;</span><span class="pln">
  2898        startBtn</span><span class="pun">.</span><span class="pln">disabled </span><span class=
  2899 "pun">=</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">;</span><span class="pln">
  2900    </span><span class="pun">},</span><span class="pln"> </span><span class="kwd">false</span><span class=
  2901 "pun">);</span><span class="pln">
  2902 
  2903 </span><span class=
  2904 "com">// Send a service message to get albums list (and process the service response)</span><span class="pln">
  2905 
  2906    </span><span class="kwd">var</span><span class="pln"> svcXhr </span><span class="pun">=</span><span class=
  2907 "pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">XMLHttpRequest</span><span class=
  2908 "pun">();</span><span class="pln">
  2909    svcXhr</span><span class="pun">.</span><span class="pln">open</span><span class="pun">(</span><span class=
  2910 "str">"POST"</span><span class="pun">,</span><span class="pln"> services</span><span class="pun">[</span><span class=
  2911 "lit">0</span><span class="pun">].</span><span class="pln">url </span><span class="pun">+</span><span class=
  2912 "pln"> </span><span class="str">"/getAlbums"</span><span class="pun">);</span><span class="pln"> </span><span class=
  2913 "com">// services[0].url and its sub-resources are</span><span class="pln">
  2914                                                         </span><span class=
  2915 "com">// available for cross-site XHR use.</span><span class="pln">
  2916 
  2917    svcXhr</span><span class="pun">.</span><span class="pln">setRequestHeader</span><span class=
  2918 "pun">(</span><span class="str">'Content-Type'</span><span class="pun">,</span><span class="pln"> </span><span class=
  2919 "str">'application/json-rpc'</span><span class="pun">);</span><span class="pln">
  2920 
  2921    svcXhr</span><span class="pun">.</span><span class="pln">addEventListener</span><span class=
  2922 "pun">(</span><span class="str">'readystatechange'</span><span class="pun">,</span><span class=
  2923 "pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class=
  2924 "pln"> response </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  2925      </span><span class="kwd">if</span><span class="pun">(</span><span class="pln"> response</span><span class=
  2926 "pun">.</span><span class="pln">readyState </span><span class="pun">!=</span><span class="pln"> </span><span class=
  2927 "lit">4</span><span class="pln"> </span><span class="pun">||</span><span class="pln"> response</span><span class=
  2928 "pun">.</span><span class="pln">status </span><span class="pun">!=</span><span class="pln"> </span><span class=
  2929 "lit">200</span><span class="pln"> </span><span class="pun">)</span><span class="pln">
  2930         </span><span class="kwd">return</span><span class="pun">;</span><span class="pln">
  2931      debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class=
  2932 "pln"> </span><span class="str">"&lt;br&gt;"</span><span class="pln"> </span><span class="pun">+</span><span class=
  2933 "pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class=
  2934 "pln">name </span><span class="pun">+</span><span class="pln"> </span><span class=
  2935 "str">" response received: "</span><span class="pun">;</span><span class="pln">
  2936      debug</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">+=</span><span class=
  2937 "pln"> JSON</span><span class="pun">.</span><span class="pln">parse</span><span class="pun">(</span><span class=
  2938 "pln">response</span><span class="pun">.</span><span class="pln">responseText</span><span class=
  2939 "pun">);</span><span class="pln">
  2940    </span><span class="pun">},</span><span class="pln"> </span><span class="kwd">false</span><span class=
  2941 "pun">);</span><span class="pln">
  2942 
  2943    </span><span class="kwd">var</span><span class="pln"> svcMsg </span><span class="pun">=</span><span class=
  2944 "pln"> </span><span class="pun">[</span><span class="pln">
  2945      </span><span class="pun">{</span><span class="pln"> </span><span class="str">"jsonrpc"</span><span class=
  2946 "pun">:</span><span class="pln"> </span><span class="str">"2.0"</span><span class="pun">,</span><span class=
  2947 "pln"> </span><span class="str">"method"</span><span class="pun">:</span><span class="pln"> </span><span class=
  2948 "str">"AudioLibrary.GetAlbums"</span><span class="pun">,</span><span class="pln"> </span><span class=
  2949 "str">"params"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">{</span><span class=
  2950 "pln"> </span><span class="str">"genreid"</span><span class="pun">:</span><span class="pln"> </span><span class=
  2951 "pun">-</span><span class="lit">1</span><span class="pun">,</span><span class="pln">
  2952          </span><span class="str">"artistid"</span><span class="pun">:</span><span class="pln"> </span><span class=
  2953 "pun">-</span><span class="lit">1</span><span class="pun">,</span><span class="pln"> </span><span class=
  2954 "str">"start"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">-</span><span class=
  2955 "lit">1</span><span class="pun">,</span><span class="pln"> </span><span class="str">"end"</span><span class=
  2956 "pun">:</span><span class="pln"> </span><span class="pun">-</span><span class="lit">1</span><span class=
  2957 "pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="str">"id"</span><span class=
  2958 "pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class=
  2959 "pun">}</span><span class="pln">
  2960    </span><span class="pun">];</span><span class="pln">
  2961 
  2962    svcXhr</span><span class="pun">.</span><span class="pln">send</span><span class="pun">(</span><span class=
  2963 "pln">JSON</span><span class="pun">.</span><span class="pln">stringify</span><span class="pun">(</span><span class=
  2964 "pln">svcMsg</span><span class="pun">));</span><span class="pln">
  2965    debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class=
  2966 "pln"> </span><span class="str">"&lt;br&gt;"</span><span class="pln"> </span><span class="pun">+</span><span class=
  2967 "pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class=
  2968 "pln">name </span><span class="pun">+</span><span class="pln"> </span><span class=
  2969 "str">" request sent: "</span><span class="pun">;</span><span class="pln">
  2970    debug</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">+=</span><span class=
  2971 "pln"> JSON</span><span class="pun">.</span><span class="pln">stringify</span><span class="pun">(</span><span class=
  2972 "pln">svcMsg</span><span class="pun">);</span><span class="pln">
  2973 
  2974  </span><span class="pun">}</span><span class="pln">
  2975 
  2976  </span><span class="kwd">function</span><span class="pln"> error</span><span class="pun">(</span><span class=
  2977 "pln"> err </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  2978    debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class=
  2979 "pln"> </span><span class="str">"&lt;br&gt;An error occurred obtaining a local network service."</span><span class=
  2980 "pun">;</span><span class="pln">
  2981    startBtn</span><span class="pun">.</span><span class="pln">disabled </span><span class="pun">=</span><span class=
  2982 "pln"> </span><span class="kwd">false</span><span class="pun">;</span><span class="pln">
  2983  </span><span class="pun">}</span><span class="pln">
  2984 </span><span class="tag">&lt;/script&gt;</span>
  2985 </pre>
  2986       </div>
  2987       <div class="example">
  2988         <p>
  2989           This sample exposes a drop-down list containing a number of common Home-based audio devices. When the user
  2990           selects an audio device from the list provided, they are prompted to authorize a network service based on the
  2991           service type requested. The user may also select multiple network services matching the selected service
  2992           type. In this example, the user selects their make as being <var>Sony</var> and their model as being
  2993           <var>Bravia S1000</var> from which the Web page can derive a service type
  2994           (<var>urn:schemas-upnp-org:service:RenderingControl:1</var>).<br>
  2995           <br>
  2996           Once the user has authorized the device, the web page sends a simple mute command according to the messaging
  2997           format supported by the device.
  2998         </p>
  2999         <hr>
  3000         <pre class="highlight prettyprint">
  3001 <span class="tag">&lt;select</span><span class="pln"> </span><span class="atn">name</span><span class=
  3002 "pun">=</span><span class="atv">"make"</span><span class="pln"> </span><span class="atn">id</span><span class=
  3003 "pun">=</span><span class="atv">"make"</span><span class="tag">&gt;</span><span class="pln">
  3004   </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">selected</span><span class=
  3005 "pun">=</span><span class="atv">"selected"</span><span class="pln"> </span><span class=
  3006 "atn">disabled</span><span class="pun">=</span><span class="atv">"disabled"</span><span class=
  3007 "tag">&gt;</span><span class="pln">Select make</span><span class="tag">&lt;/option&gt;</span><span class="pln">
  3008   </span><span class="tag">&lt;option&gt;</span><span class="pln">Sony</span><span class=
  3009 "tag">&lt;/option&gt;</span><span class="pln">
  3010   </span><span class="tag">&lt;option&gt;</span><span class="pln">Philips</span><span class=
  3011 "tag">&lt;/option&gt;</span><span class="pln">
  3012   </span><span class="tag">&lt;option&gt;</span><span class="pln">Alba</span><span class=
  3013 "tag">&lt;/option&gt;</span><span class="pln">
  3014 </span><span class="tag">&lt;/select&gt;</span><span class="pln">
  3015 </span><span class="tag">&lt;select</span><span class="pln"> </span><span class="atn">name</span><span class=
  3016 "pun">=</span><span class="atv">"model"</span><span class="pln"> </span><span class="atn">id</span><span class=
  3017 "pun">=</span><span class="atv">"model"</span><span class="tag">&gt;&lt;/select&gt;</span><span class="pln">
  3018 </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">id</span><span class=
  3019 "pun">=</span><span class="atv">"debugconsole"</span><span class="tag">&gt;&lt;/div&gt;</span><span class="pln">
  3020 
  3021 </span><span class="tag">&lt;script&gt;</span><span class="pln">
  3022   </span><span class="kwd">var</span><span class="pln"> debug </span><span class="pun">=</span><span class=
  3023 "pln"> document</span><span class="pun">.</span><span class="pln">getElementById</span><span class=
  3024 "pun">(</span><span class="str">'debugconsole'</span><span class="pun">);</span><span class="pln">
  3025 
  3026   </span><span class="kwd">var</span><span class="pln"> models </span><span class="pun">=</span><span class=
  3027 "pln"> </span><span class="pun">{</span><span class="pln">
  3028     </span><span class="str">"Sony"</span><span class="pun">:</span><span class="pln"> </span><span class=
  3029 "pun">[</span><span class="pln">
  3030       </span><span class="pun">{</span><span class="str">"name"</span><span class="pun">:</span><span class=
  3031 "pln"> </span><span class="str">"Bravia TV S1000"</span><span class="pun">,</span><span class=
  3032 "pln"> </span><span class="str">"type"</span><span class="pun">:</span><span class="pln"> </span><span class=
  3033 "str">"upnp"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"service"</span><span class=
  3034 "pun">:</span><span class="pln"> </span><span class=
  3035 "str">"urn:schemas-upnp-org:service:RenderingControl:1"</span><span class="pln"> </span><span class=
  3036 "pun">},</span><span class="pln">
  3037       </span><span class="pun">{</span><span class="str">"name"</span><span class="pun">:</span><span class=
  3038 "pln"> </span><span class="str">"Bravia TV S2000"</span><span class="pun">,</span><span class=
  3039 "pln"> </span><span class="str">"type"</span><span class="pun">:</span><span class="pln"> </span><span class=
  3040 "str">"zeroconf"</span><span class="pun">,</span><span class="pln"> </span><span class=
  3041 "str">"service"</span><span class="pun">:</span><span class="pln"> </span><span class=
  3042 "str">"_mediarenderer._http._tcp"</span><span class="pln"> </span><span class="pun">},</span><span class="pln">
  3043       </span><span class="pun">{</span><span class="str">"name"</span><span class="pun">:</span><span class=
  3044 "pln"> </span><span class="str">"HiFi WD10"</span><span class="pun">,</span><span class="pln"> </span><span class=
  3045 "str">"type"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"upnp"</span><span class=
  3046 "pun">,</span><span class="pln"> </span><span class="str">"service"</span><span class="pun">:</span><span class=
  3047 "pln"> </span><span class="str">"urn:schemas-upnp-org:service:RenderingControl:1"</span><span class=
  3048 "pln"> </span><span class="pun">}</span><span class="pln">
  3049     </span><span class="pun">],</span><span class="pln">
  3050     </span><span class="str">"Philips"</span><span class="pun">:</span><span class="pln"> </span><span class=
  3051 "pun">[</span><span class="pln"> </span><span class="com">/* ... */</span><span class="pln"> </span><span class=
  3052 "pun">],</span><span class="pln">
  3053     </span><span class="str">"Alba"</span><span class="pun">:</span><span class="pln"> </span><span class=
  3054 "pun">[</span><span class="pln"> </span><span class="com">/* ... */</span><span class="pln"> </span><span class=
  3055 "pun">]</span><span class="pln">
  3056   </span><span class="pun">};</span><span class="pln">
  3057 
  3058   </span><span class="kwd">var</span><span class="pln"> makeEl </span><span class="pun">=</span><span class=
  3059 "pln"> document</span><span class="pun">.</span><span class="pln">getElementById</span><span class=
  3060 "pun">(</span><span class="str">"make"</span><span class="pun">),</span><span class="pln">
  3061       modelEl </span><span class="pun">=</span><span class="pln"> document</span><span class="pun">.</span><span class=
  3062 "pln">getElementById</span><span class="pun">(</span><span class="str">"model"</span><span class=
  3063 "pun">);</span><span class="pln">
  3064 
  3065   makeEl</span><span class="pun">.</span><span class="pln">addEventListener</span><span class=
  3066 "pun">(</span><span class="str">'change'</span><span class="pun">,</span><span class="pln"> </span><span class=
  3067 "kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  3068     modelEl</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">=</span><span class=
  3069 "pln"> </span><span class="str">""</span><span class="pun">;</span><span class="pln"> </span><span class=
  3070 "com">// reset</span><span class="pln">
  3071     </span><span class="kwd">var</span><span class="pln"> defaultOption </span><span class="pun">=</span><span class=
  3072 "pln"> document</span><span class="pun">.</span><span class="pln">createElement</span><span class=
  3073 "pun">(</span><span class="str">"option"</span><span class="pun">);</span><span class="pln">
  3074     defaultOption</span><span class="pun">.</span><span class="pln">textContent </span><span class=
  3075 "pun">=</span><span class="pln"> </span><span class="str">"Select model"</span><span class="pun">;</span><span class=
  3076 "pln">
  3077     defaultOption</span><span class="pun">.</span><span class="pln">setAttribute</span><span class=
  3078 "pun">(</span><span class="str">"disabled"</span><span class="pun">,</span><span class="pln"> </span><span class=
  3079 "str">"disabled"</span><span class="pun">);</span><span class="pln">
  3080     defaultOption</span><span class="pun">.</span><span class="pln">setAttribute</span><span class=
  3081 "pun">(</span><span class="str">"selected"</span><span class="pun">,</span><span class="pln"> </span><span class=
  3082 "str">"selected"</span><span class="pun">);</span><span class="pln">
  3083     modelEl</span><span class="pun">.</span><span class="pln">appendChild</span><span class="pun">(</span><span class=
  3084 "pln">defaultOption</span><span class="pun">);</span><span class="pln">
  3085     </span><span class="kwd">for</span><span class="pun">(</span><span class="kwd">var</span><span class=
  3086 "pln"> i </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class=
  3087 "pun">,</span><span class="pln"> l </span><span class="pun">=</span><span class="pln"> models</span><span class=
  3088 "pun">[</span><span class="pln">makeEl</span><span class="pun">.</span><span class="pln">value</span><span class=
  3089 "pun">].</span><span class="pln">length</span><span class="pun">;</span><span class="pln"> i </span><span class=
  3090 "pun">&lt;</span><span class="pln"> l</span><span class="pun">;</span><span class="pln"> i</span><span class=
  3091 "pun">++)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  3092       </span><span class="kwd">var</span><span class="pln"> option </span><span class="pun">=</span><span class=
  3093 "pln"> document</span><span class="pun">.</span><span class="pln">createElement</span><span class=
  3094 "pun">(</span><span class="str">"option"</span><span class="pun">);</span><span class="pln">
  3095       option</span><span class="pun">.</span><span class="pln">textContent </span><span class=
  3096 "pun">=</span><span class="pln"> models</span><span class="pun">[</span><span class="pln">makeEl</span><span class=
  3097 "pun">.</span><span class="pln">value</span><span class="pun">][</span><span class="pln">i</span><span class=
  3098 "pun">][</span><span class="str">"name"</span><span class="pun">];</span><span class="pln">
  3099       option</span><span class="pun">.</span><span class="pln">setAttribute</span><span class=
  3100 "pun">(</span><span class="str">"value"</span><span class="pun">,</span><span class="pln"> models</span><span class=
  3101 "pun">[</span><span class="pln">makeEl</span><span class="pun">.</span><span class="pln">value</span><span class=
  3102 "pun">][</span><span class="pln">i</span><span class="pun">][</span><span class="str">"type"</span><span class=
  3103 "pun">]</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> </span><span class=
  3104 "str">":"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> models</span><span class=
  3105 "pun">[</span><span class="pln">makeEl</span><span class="pun">.</span><span class="pln">value</span><span class=
  3106 "pun">][</span><span class="pln">i</span><span class="pun">][</span><span class="str">"service"</span><span class=
  3107 "pun">]);</span><span class="pln">
  3108       modelEl</span><span class="pun">.</span><span class="pln">appendChild</span><span class=
  3109 "pun">(</span><span class="pln">option</span><span class="pun">);</span><span class="pln">
  3110     </span><span class="pun">}</span><span class="pln">
  3111   </span><span class="pun">},</span><span class="pln"> </span><span class="kwd">false</span><span class=
  3112 "pun">);</span><span class="pln">
  3113 
  3114   modelEl</span><span class="pun">.</span><span class="pln">addEventListener</span><span class=
  3115 "pun">(</span><span class="str">'change'</span><span class="pun">,</span><span class="pln"> </span><span class=
  3116 "kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  3117     </span><span class="kwd">if</span><span class="pun">(</span><span class="pln">navigator</span><span class=
  3118 "pun">.</span><span class="pln">getNetworkServices </span><span class="pun">&amp;&amp;</span><span class="pln">
  3119          modelEl</span><span class="pun">.</span><span class="pln">value </span><span class="pun">==</span><span class=
  3120 "pln"> </span><span class="str">"upnp:urn:schemas-upnp-org:service:RenderingControl:1"</span><span class=
  3121 "pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  3122       </span><span class="kwd">var</span><span class="pln"> servicesPromise </span><span class=
  3123 "pun">=</span><span class="pln"> navigator</span><span class="pun">.</span><span class=
  3124 "pln">getNetworkServices</span><span class="pun">(</span><span class="pln">modelEl</span><span class=
  3125 "pun">.</span><span class="pln">value</span><span class="pun">).</span><span class="pln">then</span><span class=
  3126 "pun">(</span><span class="pln">successCallback</span><span class="pun">,</span><span class=
  3127 "pln"> errorCallback</span><span class="pun">);</span><span class="pln">
  3128     </span><span class="pun">}</span><span class="pln"> </span><span class="kwd">else</span><span class=
  3129 "pln"> </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class=
  3130 "pln">modelEl</span><span class="pun">.</span><span class="pln">value </span><span class="pun">==</span><span class=
  3131 "pln"> </span><span class="str">"zeroconf:_mediarenderer._http._tcp"</span><span class="pun">)</span><span class=
  3132 "pln"> </span><span class="pun">{</span><span class="pln">
  3133       debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class=
  3134 "pln"> </span><span class="str">"&lt;br&gt;Service type is not implemented by this application."</span><span class=
  3135 "pun">;</span><span class="pln">
  3136     </span><span class="pun">}</span><span class="pln"> </span><span class="kwd">else</span><span class=
  3137 "pln"> </span><span class="pun">{</span><span class="pln">
  3138       debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class=
  3139 "pln"> </span><span class="str">"&lt;br&gt;Service Discovery is not supported!"</span><span class=
  3140 "pun">;</span><span class="pln">
  3141     </span><span class="pun">}</span><span class="pln">
  3142   </span><span class="pun">},</span><span class="pln"> </span><span class="kwd">false</span><span class=
  3143 "pun">);</span><span class="pln">
  3144 </span><span class="tag">&lt;/script&gt;</span><span class="pln">
  3145 
  3146 </span><span class="tag">&lt;script&gt;</span><span class="pln">
  3147   </span><span class="kwd">function</span><span class="pln"> successCallback</span><span class=
  3148 "pun">(</span><span class="pln"> services </span><span class="pun">)</span><span class="pln"> </span><span class=
  3149 "pun">{</span><span class="pln">
  3150 
  3151   </span><span class="com">// Listen for service push notification messages</span><span class="pln">
  3152 
  3153     services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class=
  3154 "pln">addEventListener</span><span class="pun">(</span><span class="str">'notify'</span><span class=
  3155 "pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class=
  3156 "pun">(</span><span class="pln"> msg </span><span class="pun">)</span><span class="pln"> </span><span class=
  3157 "pun">{</span><span class="pln">
  3158          debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class=
  3159 "pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;"</span><span class="pln"> </span><span class=
  3160 "pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class=
  3161 "pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class=
  3162 "str">" event received: "</span><span class="pun">;</span><span class="pln">
  3163          debug</span><span class="pun">.</span><span class="pln">textContent </span><span class=
  3164 "pun">+=</span><span class="pln"> msg</span><span class="pun">.</span><span class="pln">data</span><span class=
  3165 "pun">;</span><span class="pln">
  3166     </span><span class="pun">},</span><span class="pln"> </span><span class="kwd">false</span><span class=
  3167 "pun">);</span><span class="pln">
  3168 
  3169  </span><span class="com">// Send a control signal to mute the service audio</span><span class="pln">
  3170 
  3171     </span><span class="kwd">var</span><span class="pln"> svcXhr </span><span class="pun">=</span><span class=
  3172 "pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">XMLHttpRequest</span><span class=
  3173 "pun">();</span><span class="pln">
  3174     svcXhr</span><span class="pun">.</span><span class="pln">open</span><span class="pun">(</span><span class=
  3175 "str">"POST"</span><span class="pun">,</span><span class="pln"> services</span><span class="pun">[</span><span class=
  3176 "lit">0</span><span class="pun">].</span><span class="pln">url</span><span class="pun">);</span><span class=
  3177 "pln"> </span><span class="com">// services[0].url and its sub-resources are</span><span class="pln">
  3178                                           </span><span class=
  3179 "com">// available for cross-site XHR use.</span><span class="pln">
  3180 
  3181     svcXhr</span><span class="pun">.</span><span class="pln">setRequestHeader</span><span class=
  3182 "pun">(</span><span class="str">'SOAPAction'</span><span class="pun">,</span><span class="pln"> </span><span class=
  3183 "str">'urn:schemas-upnp-org:service:RenderingControl:1#SetMute'</span><span class="pun">);</span><span class="pln">
  3184     svcXhr</span><span class="pun">.</span><span class="pln">setRequestHeader</span><span class=
  3185 "pun">(</span><span class="str">'Content-Type'</span><span class="pun">,</span><span class="pln"> </span><span class=
  3186 "str">'text/xml; charset="utf-8";'</span><span class="pun">);</span><span class="pln">
  3187 
  3188     svcXhr</span><span class="pun">.</span><span class="pln">onreadystatechange </span><span class=
  3189 "pun">=</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class=
  3190 "pun">(</span><span class="pln"> response </span><span class="pun">)</span><span class="pln"> </span><span class=
  3191 "pun">{</span><span class="pln">
  3192       </span><span class="kwd">if</span><span class="pun">(</span><span class="pln"> response</span><span class=
  3193 "pun">.</span><span class="pln">readyState </span><span class="pun">!=</span><span class="pln"> </span><span class=
  3194 "lit">4</span><span class="pln"> </span><span class="pun">||</span><span class="pln"> response</span><span class=
  3195 "pun">.</span><span class="pln">status </span><span class="pun">!=</span><span class="pln"> </span><span class=
  3196 "lit">200</span><span class="pln"> </span><span class="pun">)</span><span class="pln">
  3197         </span><span class="kwd">return</span><span class="pun">;</span><span class="pln">
  3198       debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class=
  3199 "pln"> </span><span class="str">"&lt;br&gt;"</span><span class="pln"> </span><span class="pun">+</span><span class=
  3200 "pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class=
  3201 "pln">name </span><span class="pun">+</span><span class="pln"> </span><span class=
  3202 "str">" response received: "</span><span class="pun">;</span><span class="pln">
  3203       debug</span><span class="pun">.</span><span class="pln">textContent </span><span class=
  3204 "pun">+=</span><span class="pln"> response</span><span class="pun">.</span><span class=
  3205 "pln">responseXML</span><span class="pun">;</span><span class="pln">
  3206     </span><span class="pun">}</span><span class="pln">
  3207 
  3208     </span><span class="com">// Service messaging to mute the provided service</span><span class="pln">
  3209     </span><span class="kwd">var</span><span class="pln"> svcMsg </span><span class="pun">=</span><span class=
  3210 "pln"> </span><span class="str">'&lt;?xml version="1.0" encoding="utf-8"?&gt;'</span><span class=
  3211 "pln"> </span><span class="pun">+</span><span class="pln">
  3212                  </span><span class=
  3213 "str">'&lt;s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" '</span><span class=
  3214 "pln"> </span><span class="pun">+</span><span class="pln">
  3215                    </span><span class=
  3216 "str">'xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;'</span><span class="pln"> </span><span class=
  3217 "pun">+</span><span class="pln">
  3218                    </span><span class="str">'&lt;s:Body&gt;'</span><span class="pln"> </span><span class=
  3219 "pun">+</span><span class="pln">
  3220                      </span><span class=
  3221 "str">'&lt;u:SetMute xmlns:u="urn:schemas-upnp-org:service:RenderingControl:1"&gt;'</span><span class=
  3222 "pln"> </span><span class="pun">+</span><span class="pln">
  3223                        </span><span class="str">'&lt;InstanceID&gt;0&lt;/InstanceID&gt;'</span><span class=
  3224 "pln"> </span><span class="pun">+</span><span class="pln">
  3225                        </span><span class="str">'&lt;Channel&gt;Master&lt;/Channel&gt;'</span><span class=
  3226 "pln"> </span><span class="pun">+</span><span class="pln">
  3227                        </span><span class="str">'&lt;DesiredMute&gt;true&lt;/DesiredMute&gt;'</span><span class=
  3228 "pln"> </span><span class="pun">+</span><span class="pln">
  3229                      </span><span class="str">'&lt;/u:SetMute&gt;'</span><span class="pln"> </span><span class=
  3230 "pun">+</span><span class="pln">
  3231                    </span><span class="str">'&lt;/s:Body&gt;'</span><span class="pln"> </span><span class=
  3232 "pun">+</span><span class="pln">
  3233                  </span><span class="str">'&lt;/s:Envelope&gt;'</span><span class="pun">;</span><span class="pln">
  3234 
  3235     svcXhr</span><span class="pun">.</span><span class="pln">send</span><span class="pun">(</span><span class=
  3236 "pln">svcMsg</span><span class="pun">);</span><span class="pln">
  3237     debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class=
  3238 "pln"> </span><span class="str">"&lt;br&gt;"</span><span class="pln"> </span><span class="pun">+</span><span class=
  3239 "pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class=
  3240 "pln">name </span><span class="pun">+</span><span class="pln"> </span><span class=
  3241 "str">" request sent: "</span><span class="pun">;</span><span class="pln">
  3242     debug</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">+=</span><span class=
  3243 "pln"> svcMsg</span><span class="pun">;</span><span class="pln">
  3244   </span><span class="pun">}</span><span class="pln">
  3245 
  3246   </span><span class="kwd">function</span><span class="pln"> errorCallback</span><span class="pun">(</span><span class=
  3247 "pln"> error </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  3248     debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class=
  3249 "pln"> </span><span class="str">"&lt;br&gt;An error occurred: "</span><span class="pln"> </span><span class=
  3250 "pun">+</span><span class="pln"> error</span><span class="pun">.</span><span class="pln">name</span><span class=
  3251 "pun">;</span><span class="pln">
  3252   </span><span class="pun">}</span><span class="pln">
  3253 </span><span class="tag">&lt;/script&gt;</span>
  3254 </pre>
  3255       </div>
  3256     </section>
  3257     <section id="acknowledgements">
  3258       <h2 aria-level="1"
  3259           role="heading"
  3260           id="h2_acknowledgements">
  3261         <span class="secno">B.</span> Acknowledgements
  3262       </h2>
  3263       <p>
  3264         Thanks are expressed by the editor to the following individuals for their feedback on this specification to
  3265         date (in alphabetical order):<br>
  3266         <br>
  3267         Adam Barth, Gar Bergstedt, Robin Berjon, Lars-Erik Bolstad, Marcos Caceres, Cathy Chan, Daniel Danciu,
  3268         Jean-Claude Dufourd, Mark Foltz, Dominique Hazael-Massieux, Frederick Hirsch, Hari G Kumar, Bob Lund, Giuseppe
  3269         Pascale, Marcin Simonides, Clarke Stevens, Christian Söderström, Mark Vickers.
  3270       </p>
  3271       <p>
  3272         Thanks are also expressed by the editor to the following organizations and groups for their support in
  3273         producing this specification to date (in alphabetical order):<br>
  3274         <br>
  3275         CableLabs, Google Inc., Opera Software ASA, Nokia Corp., Télécom ParisTech, <abbr title=
  3276         "World Wide Web Consortium">W3C</abbr> Device APIs Working Group, <abbr title=
  3277         "World Wide Web Consortium">W3C</abbr> Web and TV Interest Group.
  3278       </p>
  3279     </section><style>
  3280 a.externalDFN { color: #00C; border-bottom: 1px dashed #00C; }
  3281     a.internalDFN { color: #00C; text-decoration: solid; }
  3282     </style>
  3283     <section id="references"
  3284              class="appendix"
  3285              typeof="bibo:Chapter"
  3286              resource="#references"
  3287              rel="bibo:chapter">
  3288       <h2 aria-level="1"
  3289           role="heading"
  3290           id="h2_references">
  3291         <span class="secno">C.</span> References
  3292       </h2>
  3293       <section id="normative-references"
  3294                typeof="bibo:Chapter"
  3295                resource="#normative-references"
  3296                rel="bibo:chapter">
  3297         <h3 aria-level="2"
  3298             role="heading"
  3299             id="h3_normative-references">
  3300           <span class="secno">C.1</span> Normative references
  3301         </h3>
  3302         <dl class="bibliography"
  3303             about="">
  3304           <dt id="bib-CORS">
  3305             [CORS]
  3306           </dt>
  3307           <dd rel="dcterms:requires">
  3308             Anne van Kesteren. <a href="http://www.w3.org/TR/cors/"><cite>Cross-Origin Resource Sharing</cite></a>. 29
  3309             January 2013. W3C Candidate Recommendation. URL: <a href=
  3310             "http://www.w3.org/TR/cors/">http://www.w3.org/TR/cors/</a>
  3311           </dd>
  3312           <dt id="bib-DNS-SD">
  3313             [DNS-SD]
  3314           </dt>
  3315           <dd rel="dcterms:requires">
  3316             S. Cheshire; M. Krochmal. <a href="http://www.ietf.org/rfc/rfc6763.txt"><cite>DNS-Based Service
  3317             Discovery</cite></a>. February 2013. RFC. URL: <a href=
  3318             "http://www.ietf.org/rfc/rfc6763.txt">http://www.ietf.org/rfc/rfc6763.txt</a>
  3319           </dd>
  3320           <dt id="bib-DOM4">
  3321             [DOM4]
  3322           </dt>
  3323           <dd rel="dcterms:requires">
  3324             Anne van Kesteren; Aryeh Gregor; Lachlan Hunt; Ms2ger. <a href=
  3325             "http://www.w3.org/TR/dom/"><cite>DOM4</cite></a>. 6 December 2012. W3C Working Draft. URL: <a href=
  3326             "http://www.w3.org/TR/dom/">http://www.w3.org/TR/dom/</a>
  3327           </dd>
  3328           <dt id="bib-HTML5">
  3329             [HTML5]
  3330           </dt>
  3331           <dd rel="dcterms:requires">
  3332             Robin Berjon; Steve Faulkner; Travis Leithead; Erika Doyle Navara; Edward O'Connor; Silvia Pfeiffer.
  3333             <a href="http://www.w3.org/TR/html5/"><cite>HTML5</cite></a>. 6 August 2013. W3C Candidate Recommendation.
  3334             URL: <a href="http://www.w3.org/TR/html5/">http://www.w3.org/TR/html5/</a>
  3335           </dd>
  3336           <dt id="bib-MDNS">
  3337             [MDNS]
  3338           </dt>
  3339           <dd rel="dcterms:requires">
  3340             S. Cheshire; M. Krochmal. <a href="http://www.ietf.org/rfc/rfc6763.txt"><cite>Multicast DNS</cite></a>.
  3341             February 2013. RFC. URL: <a href=
  3342             "http://www.ietf.org/rfc/rfc6763.txt">http://www.ietf.org/rfc/rfc6763.txt</a>
  3343           </dd>
  3344           <dt id="bib-RFC2119">
  3345             [RFC2119]
  3346           </dt>
  3347           <dd rel="dcterms:requires">
  3348             S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key words for use in RFCs to Indicate
  3349             Requirement Levels.</cite></a> March 1997. Internet RFC 2119. URL: <a href=
  3350             "http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a>
  3351           </dd>
  3352           <dt id="bib-UPNP-DEVICEARCH11">
  3353             [UPNP-DEVICEARCH11]
  3354           </dt>
  3355           <dd rel="dcterms:requires">
  3356             <a href="http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf"><cite>UPnP Device Architecture
  3357             1.1</cite></a>. 15 October 2008. UPnP Forum. PDF document. URL: <a href=
  3358             "http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf">http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf</a>
  3359           </dd>
  3360           <dt id="bib-WEBIDL">
  3361             [WEBIDL]
  3362           </dt>
  3363           <dd rel="dcterms:requires">
  3364             Cameron McCormack. <a href="http://www.w3.org/TR/WebIDL/"><cite>Web IDL</cite></a>. 19 April 2012. W3C
  3365             Candidate Recommendation. URL: <a href="http://www.w3.org/TR/WebIDL/">http://www.w3.org/TR/WebIDL/</a>
  3366           </dd>
  3367         </dl>
  3368       </section>
  3369       <section id="informative-references"
  3370                typeof="bibo:Chapter"
  3371                resource="#informative-references"
  3372                rel="bibo:chapter">
  3373         <h3 aria-level="2"
  3374             role="heading"
  3375             id="h3_informative-references">
  3376           <span class="secno">C.2</span> Informative references
  3377         </h3>
  3378         <dl class="bibliography"
  3379             about="">
  3380           <dt id="bib-hnreq">
  3381             [hnreq]
  3382           </dt>
  3383           <dd rel="dcterms:references">
  3384             Giuseppe Pascale. <a href="http://www.w3.org/TR/hnreq/"><cite>Requirements for Home Networking
  3385             Scenarios</cite></a>. 1 December 2011. W3C Note. URL: <a href=
  3386             "http://www.w3.org/TR/hnreq/">http://www.w3.org/TR/hnreq/</a>
  3387           </dd>
  3388         </dl>
  3389       </section>
  3390     </section>
  3391   </body>
  3392 </html>