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