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