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