- From: Mercurial notifier <cvsmail@w3.org>
- Date: Wed, 03 Oct 2012 12:47:27 +0000
- To: public-dap-commits@w3.org
changeset: 254:f29ec967fb3b tag: tip user: Rich Tibbett <richt@opera.com> date: Wed Oct 03 14:47:11 2012 +0200 files: discovery-api/Overview.html discovery-api/Overview.src.html discovery-api/WD.html description: Editorial updates to NSD spec diff -r a1f05d57cfcd -r f29ec967fb3b discovery-api/Overview.html --- a/discovery-api/Overview.html Tue Oct 02 18:07:01 2012 -0700 +++ b/discovery-api/Overview.html Wed Oct 03 14:47:11 2012 +0200 @@ -463,8 +463,8 @@ <p> Using this <abbr title="Application Programming Interface">API</abbr> consists of requesting a well-known service type, known by developers and advertised by Local-networked Devices. User authorization, where the user - connects the web page to one or more discovered services, is expected before the web page is able to interact - with any Local-networked Services. + connects the web page to discovered services, is expected before the web page is able to interact with any + Local-networked Services. </p> <p> A web page creates a request to obtain connectivity to services running in the network by specifying a @@ -748,15 +748,15 @@ </dt> <dd> <p> - Prompts the user to select one or more discovered network services that have advertised support for the - requested service type. + Prompts the user to select discovered network services that have advertised support for the requested + service type. </p> <p> The <var title="">type</var> argument contains one or more <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> tokens that the web page would like to interact with. </p> <p> - If the user accepts, the <var title="">successCallback</var> is invoked, with one or more <a href= + If the user accepts, the <var title="">successCallback</var> is invoked, with zero or more <a href= "#networkservice"><code>NetworkService</code></a> objects as its argument. </p> <p> @@ -826,18 +826,6 @@ </li> </ol> </li> - <li>If <var>services found</var> is an empty array, then the <a href="#dfn-user-agent" - class="internalDFN">user agent</a> <em class="rfc2119" - title="must">must</em> <a href= - "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" - class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an - object of type <code>Function</code>, with a new <a href= - "#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose <a href= - "#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1 - (<a href= - "#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its - argument, abort any remaining steps and return. - </li> <li>Return, and run the remaining steps asynchronously. </li> <li>Optionally, e.g. based on a previously-established user preference, for security reasons, or due to @@ -853,15 +841,16 @@ "#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its argument, abort any remaining steps and return. </li> - <li>The <a href="#dfn-user-agent" + <li>If <var>services found</var> is not an empty array then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> prompt the user in a user-agent-specific manner for permission to provide the <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" class="externalDFN">entry script</a>'s <a href= "http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" class="externalDFN">origin</a> with an array of <a href= - "#networkservice"><code>NetworkService</code></a> objects representing the user-authorized subset of - <var>services found</var>. + "#networkservice"><code>NetworkService</code></a> objects representing the <a href= + "#dfn-user-authorized" + class="internalDFN">user-authorized</a> subset of <var>services found</var>. <p> If the user grants permission to access one or more networked services then the <a href= "#dfn-user-agent" @@ -885,10 +874,14 @@ If the user never responds, this algorithm stalls on this step. </p> </li> - <li>Let <var>services</var> be the array of one or more <a href= - "#networkservice"><code>NetworkService</code></a> objects for which the user granted permission. + <li>Let <var>services</var> be an empty array. </li> - <li>For each Object <var>service</var> in <var>services</var>, run the following sub-steps: + <li>If <var>services found</var> is not an empty array then set <var>services</var> to be an array of one + or more <a href="#networkservice"><code>NetworkService</code></a> objects for which the user granted + permission above - known as the current objects <dfn id="dfn-user-authorized">user-authorized</dfn> + services. + </li> + <li>For each Object <var>service</var> in <var>services</var>, if any, run the following sub-steps: <ol class="rule"> <li>Add the <var>service</var>'s <code>url</code> parameter to the <a href= "#dfn-entry-script-origin-s-url-whitelist" @@ -911,9 +904,10 @@ class="internalDFN">list of available service records</a> whose <code>type</code> property matches any of the tokens requested in <var>requested control types</var>. </li> - <li>Add <var>services</var> to the <var>services manager</var> object as its collection of <a href= - "#dfn-indexed-properties" - class="internalDFN">indexed properties</a>. + <li>Add <var>services</var>, if any, to the <var>services manager</var> object as its collection of + <a href="#dfn-indexed-properties-1" + class="internalDFN">indexed properties</a>. If <var>services</var> is an empty array then the + <var>services manager</var> does not have any <var>indexed properties</var>. </li> <li>Set <var>services manager</var>'s <a href="#dom-networkservices-length"><code>length</code></a> attribute to the number of items in <var>services</var>. @@ -953,7 +947,11 @@ Web Messaging, XMLHttpRequest). </p> <p> - If the user navigates away from the current browsing context, the <a href="#dfn-user-agent" + If the user navigates away from the <a href= + "http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" + class="externalDFN">entry script</a>'s <a href= + "http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" + class="externalDFN">origin</a> then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="ct"><em class="rfc2119" title="must">must</em></em> remove all previously whitelisted urls from the <a href= "#dfn-entry-script-origin-s-url-whitelist" @@ -1028,10 +1026,13 @@ <span class="secno">5.</span> Obtaining networked services </h2> <p> - The <a href="#networkservices"><code>NetworkServices</code></a> interface is the top-level response object from - a call to <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> and provides access - to a set of user-authorized <a href="#networkservice"><code>NetworkService</code></a> objects for the given - request. + The <a href="#networkservices"><code>NetworkServices</code></a> interface represents a collection of zero or + more <dfn id="dfn-indexed-properties">indexed properties</dfn> that are each a <a href="#dfn-user-authorized" + class="internalDFN">user-authorized</a> <a href="#networkservice"><code>NetworkService</code></a> object. + </p> + <p> + A <a href="#networkservices"><code>NetworkServices</code></a> object is the top level success callback + parameter from a call to <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a>. </p> <pre class="widl"> [NoInterfaceObject] @@ -1128,10 +1129,14 @@ </dd> </dl> <p> - A <a href="#networkservices"><code>NetworkServices</code></a> object represents the current collection of one - or more <a href="#networkservice"><code>NetworkService</code></a> objects. A <a href= - "#networkservices"><code>NetworkServices</code></a> object is <span>immutable</span> meaning that it cannot - be modified. + A <a href="#networkservices"><code>NetworkServices</code></a> object represents the current collection of + zero or more <a href="#networkservice"><code>NetworkService</code></a> objects - its <a href= + "#dfn-indexed-properties-1" + class="internalDFN">indexed properties</a>. A <a href="#networkservices"><code>NetworkServices</code></a> + object is <span>immutable</span> meaning that <a href="#dfn-indexed-properties-1" + class="internalDFN">indexed properties</a> cannot be added and <a href="#dfn-indexed-properties-1" + class="internalDFN">indexed properties</a> cannot be removed for the lifetime of a <a href= + "#networkservices"><code>NetworkServices</code></a> object. </p> <div class="note"> <div class="note-title"> @@ -1445,8 +1450,8 @@ <p> This section presents how the results of these two <a href="#dfn-service-discovery-mechanisms" class="internalDFN">service discovery mechanisms</a> will be matched to requested service types, how the - user agent stores available and active services, how their properties are applied to any resulting <a href= - "#networkservice"><code>NetworkService</code></a> objects. + user agent stores available and active services and how their properties are applied to any resulting + <a href="#networkservice"><code>NetworkService</code></a> objects. </p> <p> It is expected that user agents will perform these <a href="#dfn-service-discovery-mechanisms" @@ -1470,13 +1475,14 @@ <p> The <dfn id="dfn-list-of-active-service-managers">list of active service managers</dfn> is an internal list within user agents that is used to track all <a href="#networkservices"><code>NetworkServices</code></a> - objects currently being shared with any web pages at the current time. Each <a href= + objects currently being shared with any web pages at the current time within the user agent. Each <a href= "#networkservices"><code>NetworkServices</code></a> object in the <a href= "#dfn-list-of-active-service-managers" - class="internalDFN">list of active service managers</a> represents a collection of one or more <a href= + class="internalDFN">list of active service managers</a> represents a collection of zero or more <a href= "#networkservice"><code>NetworkService</code></a> objects - known as its <dfn id= - "dfn-indexed-properties">indexed properties</dfn>. <a href="#networkservice"><code>NetworkService</code></a> - objects are attached as the <a href="#dfn-indexed-properties" + "dfn-indexed-properties-1">indexed properties</dfn>. <a href= + "#networkservice"><code>NetworkService</code></a> objects are attached as the <a href= + "#dfn-indexed-properties-1" class="internalDFN">indexed properties</a> of a <a href="#networkservices"><code>NetworkServices</code></a> object as part of the <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> algorithm. @@ -2204,8 +2210,11 @@ title="must">must</em> only garbage collect a <a href="#networkservices" class="internalDFN"><code>NetworkServices</code></a> object and remove its entry from the <a href= "#dfn-list-of-active-service-managers" - class="internalDFN">list of active service managers</a> when the user has navigated away from the browsing - context in which that <a href="#networkservices" + class="internalDFN">list of active service managers</a> when the user has navigated away from the <a href= + "http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" + class="externalDFN">entry script</a>'s <a href= + "http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" + class="externalDFN">origin</a> in which the current <a href="#networkservices" class="internalDFN"><code>NetworkServices</code></a> object was provided. </p> <p> @@ -2217,7 +2226,7 @@ <p> A user agent <em class="rfc2119" title="must">must</em> garbage collect the <a href="#networkservice" - class="internalDFN"><code>NetworkService</code></a> <a href="#dfn-indexed-properties" + class="internalDFN"><code>NetworkService</code></a> <a href="#dfn-indexed-properties-1" class="internalDFN">indexed properties</a> of a <a href="#networkservices" class="internalDFN"><code>NetworkServices</code></a> object when that <a href="#networkservices" class="internalDFN"><code>NetworkServices</code></a> object itself has been garbage-collected. diff -r a1f05d57cfcd -r f29ec967fb3b discovery-api/Overview.src.html --- a/discovery-api/Overview.src.html Tue Oct 02 18:07:01 2012 -0700 +++ b/discovery-api/Overview.src.html Wed Oct 03 14:47:11 2012 +0200 @@ -35,7 +35,7 @@ class='remove'> var respecConfig = { specStatus: "ED", - //publishDate: "2012-10-09", + //publishDate: "2012-10-04", shortName: "discovery-api", edDraftURI: "http://dvcs.w3.org/hg/dap/raw-file/tip/discovery-api/Overview.html", previousMaturity: "FPWD", @@ -124,7 +124,7 @@ <p> Using this <abbr title="Application Programming Interface">API</abbr> consists of requesting a well-known service type, known by developers and advertised by Local-networked Devices. User authorization, where the user - connects the web page to one or more discovered services, is expected before the web page is able to interact + connects the web page to discovered services, is expected before the web page is able to interact with any Local-networked Services. </p> <p> @@ -336,7 +336,7 @@ </dt> <dd> <p> - Prompts the user to select one or more discovered network services that have advertised support for the + Prompts the user to select discovered network services that have advertised support for the requested service type. </p> <p> @@ -344,7 +344,7 @@ page would like to interact with. </p> <p> - If the user accepts, the <var title="">successCallback</var> is invoked, with one or more <a href= + If the user accepts, the <var title="">successCallback</var> is invoked, with zero or more <a href= "#networkservice"><code>NetworkService</code></a> objects as its argument. </p> <p> @@ -406,16 +406,6 @@ </li> </ol> </li> - <li>If <var>services found</var> is an empty array, then the <a>user agent</a> MUST <a href= - "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" - class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an - object of type <code>Function</code>, with a new <a href= - "#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose <a href= - "#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1 - (<a href= - "#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its - argument, abort any remaining steps and return. - </li> <li>Return, and run the remaining steps asynchronously. </li> <li>Optionally, e.g. based on a previously-established user preference, for security reasons, or due to @@ -429,13 +419,14 @@ "#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its argument, abort any remaining steps and return. </li> - <li>The <a>user agent</a> MUST prompt the user in a user-agent-specific manner for permission to provide + <li>If <var>services found</var> is not an empty array then the <a>user agent</a> MUST prompt the user in a + user-agent-specific manner for permission to provide the <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" class="externalDFN">entry script</a>'s <a href= "http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" class="externalDFN">origin</a> with an array of <a href= - "#networkservice"><code>NetworkService</code></a> objects representing the user-authorized subset of - <var>services found</var>. + "#networkservice"><code>NetworkService</code></a> objects representing the <a>user-authorized</a> subset + of <var>services found</var>. <p> If the user grants permission to access one or more networked services then the <a>user agent</a> SHOULD include an "ongoing local-network communication" indicator. @@ -455,10 +446,14 @@ If the user never responds, this algorithm stalls on this step. </p> </li> - <li>Let <var>services</var> be the array of one or more <a href= - "#networkservice"><code>NetworkService</code></a> objects for which the user granted permission. + <li>Let <var>services</var> be an empty array. </li> - <li>For each Object <var>service</var> in <var>services</var>, run the following sub-steps: + <li> + If <var>services found</var> is not an empty array then set <var>services</var> to be an array of one or more <a href= + "#networkservice"><code>NetworkService</code></a> objects for which the user granted permission above - known as the + current objects <dfn>user-authorized</dfn> services. + </li> + <li>For each Object <var>service</var> in <var>services</var>, if any, run the following sub-steps: <ol class="rule"> <li>Add the <var>service</var>'s <code>url</code> parameter to the <a>entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a>. @@ -477,8 +472,9 @@ items currently found in the <a>list of available service records</a> whose <code>type</code> property matches any of the tokens requested in <var>requested control types</var>. </li> - <li>Add <var>services</var> to the <var>services manager</var> object as its collection of <a>indexed - properties</a>. + <li>Add <var>services</var>, if any, to the <var>services manager</var> object as its collection of <a>indexed + properties</a>. If <var>services</var> is an empty array then the <var>services manager</var> does not have any + <var>indexed properties</var>. </li> <li>Set <var>services manager</var>'s <a href="#dom-networkservices-length"><code>length</code></a> attribute to the number of items in <var>services</var>. @@ -511,7 +507,11 @@ Web Messaging, XMLHttpRequest). </p> <p> - If the user navigates away from the current browsing context, the <a>user agent</a> <em class= + If the user navigates away from the + <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" + class="externalDFN">entry script</a>'s <a href= + "http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" + class="externalDFN">origin</a> then the <a>user agent</a> <em class= "ct">MUST</em> remove all previously whitelisted urls from the <a>entry script origin's URL whitelist</a>. There is no persistence to network service selections provided to a web page. It is not possible to access a previously white-listed networked service without the necessary user authorization in all of the @@ -581,10 +581,14 @@ Obtaining networked services </h2> <p> - The <a href="#networkservices"><code>NetworkServices</code></a> interface is the top-level response object from - a call to <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> and provides access - to a set of user-authorized <a href="#networkservice"><code>NetworkService</code></a> objects for the given - request. + The <a href="#networkservices"><code>NetworkServices</code></a> interface represents a collection of zero + or more <dfn>indexed properties</dfn> that are + each a <a>user-authorized</a> <a href="#networkservice"><code>NetworkService</code></a> object. + </p> + <p> + A <a href="#networkservices"><code>NetworkServices</code></a> object is the top level success callback + parameter from a call to + <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a>. </p> <pre class="widl"> [NoInterfaceObject] @@ -674,10 +678,11 @@ </dd> </dl> <p> - A <a href="#networkservices"><code>NetworkServices</code></a> object represents the current collection of one - or more <a href="#networkservice"><code>NetworkService</code></a> objects. A <a href= - "#networkservices"><code>NetworkServices</code></a> object is <span>immutable</span> meaning that it cannot - be modified. + A <a href="#networkservices"><code>NetworkServices</code></a> object represents the current collection of zero + or more <a href="#networkservice"><code>NetworkService</code></a> objects - its <a>indexed properties</a>. A <a href= + "#networkservices"><code>NetworkServices</code></a> object is <span>immutable</span> meaning that + <a>indexed properties</a> cannot be added and <a>indexed properties</a> cannot be removed for the lifetime of + a <a href="#networkservices"><code>NetworkServices</code></a> object. </p> <p class="note"> Each service in a <a href="#networkservices"><code>NetworkServices</code></a> object thus has an index; the @@ -961,7 +966,7 @@ </p> <p> This section presents how the results of these two <a>service discovery mechanisms</a> will be matched to - requested service types, how the user agent stores available and active services, how their properties are + requested service types, how the user agent stores available and active services and how their properties are applied to any resulting <a href="#networkservice"><code>NetworkService</code></a> objects. </p> <p> @@ -980,8 +985,9 @@ <p> The <dfn>list of active service managers</dfn> is an internal list within user agents that is used to track all <a href="#networkservices"><code>NetworkServices</code></a> objects currently being shared with any web pages - at the current time. Each <a href="#networkservices"><code>NetworkServices</code></a> object in the <a>list of - active service managers</a> represents a collection of one or more <a href= + at the current time within the user agent. Each <a href="#networkservices"><code>NetworkServices</code></a> object + in the <a>list of + active service managers</a> represents a collection of zero or more <a href= "#networkservice"><code>NetworkService</code></a> objects - known as its <dfn>indexed properties</dfn>. <a href="#networkservice"><code>NetworkService</code></a> objects are attached as the <a>indexed properties</a> of a <a href="#networkservices"><code>NetworkServices</code></a> object as part of the <a href= @@ -1565,8 +1571,12 @@ </h3> <p> A user agent MUST only garbage collect a <a><code>NetworkServices</code></a> object and remove its entry from - the <a>list of active service managers</a> when the user has navigated away from the browsing context in which - that <a><code>NetworkServices</code></a> object was provided. + the <a>list of active service managers</a> when the user has navigated away from the + <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" + class="externalDFN">entry script</a>'s <a href= + "http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" + class="externalDFN">origin</a> in which + the current <a><code>NetworkServices</code></a> object was provided. </p> <p> A user agent MUST NOT garbage collect individual <a><code>NetworkService</code></a> objects until their parent diff -r a1f05d57cfcd -r f29ec967fb3b discovery-api/WD.html --- a/discovery-api/WD.html Tue Oct 02 18:07:01 2012 -0700 +++ b/discovery-api/WD.html Wed Oct 03 14:47:11 2012 +0200 @@ -5,8 +5,8 @@ Network Service Discovery </title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - - + + <style type="text/css"> /* Custom ReSpec CSS (by Rich Tibbett) */ @@ -45,7 +45,7 @@ *****************************************************************/ /* --- INLINES --- */ -em.rfc2119 { +em.rfc2119 { text-transform: lowercase; font-variant: small-caps; font-style: normal; @@ -200,50 +200,51 @@ /* this from google-code-prettify */ .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} -</style><link rel="stylesheet" href="http://www.w3.org/StyleSheets/TR/W3C-WD"><!--[if lt IE 9]><script src='undefined://www.w3.org/2008/site/js/html5shiv.js'></script><![endif]--></head><body><div class="head"> +</style><link rel="stylesheet" href="http://www.w3.org/StyleSheets/TR/W3C-WD"><!--[if lt IE 9]><script src='undefined://www.w3.org/2008/site/js/html5shiv.js'></script><![endif]--></head> + <body><div class="head"> <p> - + <a href="http://www.w3.org/"><img width="72" height="48" src="http://www.w3.org/Icons/w3c_home" alt="W3C"></a> - + </p> <h1 class="title" id="title">Network Service Discovery</h1> - + <h2 id="w3c-working-draft-04-october-2012"><abbr title="World Wide Web Consortium">W3C</abbr> Working Draft 04 October 2012</h2> <dl> - + <dt>This version:</dt> <dd><a href="http://www.w3.org/TR/2012/WD-discovery-api-20121004/">http://www.w3.org/TR/2012/WD-discovery-api-20121004/</a></dd> <dt>Latest published version:</dt> <dd><a href="http://www.w3.org/TR/discovery-api/">http://www.w3.org/TR/discovery-api/</a></dd> - - + + <dt>Latest editor's draft:</dt> <dd><a href="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></dd> - - - - - + + + + + <dt>Previous version:</dt> <dd><a href="http://www.w3.org/TR/2012/WD-discovery-api-20120807/">http://www.w3.org/TR/2012/WD-discovery-api-20120807/</a></dd> - - + + <dt>Editors:</dt> <dd><span>Rich Tibbett</span>, <a href="http://opera.com/">Opera Software ASA</a></dd> <dd><span>Clarke Stevens</span>, <a href="http://cablelabs.com/">CableLabs</a></dd> - + </dl> - - - - - + + + + + <p class="copyright"> - <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © + <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2012 - - <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> + + <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. @@ -251,8 +252,8 @@ <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply. </p> - - + + <hr> </div> <section id="abstract" class="introductory"><h2>Abstract</h2> @@ -262,63 +263,63 @@ within the current network. </p> </section><section id="sotd" class="introductory"><h2>Status of This Document</h2> - - - + + + <p> <em>This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current <abbr title="World Wide Web Consortium">W3C</abbr> publications and the latest revision of this technical report can be found in the <a href="http://www.w3.org/TR/"><abbr title="World Wide Web Consortium">W3C</abbr> technical reports index</a> at http://www.w3.org/TR/.</em> </p> - + <p> This document represents the early consensus of the group on the scope and features of the proposed <abbr title="Application Programming Interface">API</abbr>. </p> - + <p> This document was published by the <a href="http://www.w3.org/2009/dap/">Device APIs Working Group</a> as a Working Draft. - + This document is intended to become a <abbr title="World Wide Web Consortium">W3C</abbr> Recommendation. - - If you wish to make comments regarding this document, please send them to - <a href="mailto:public-device-apis@w3.org">public-device-apis@w3.org</a> + + If you wish to make comments regarding this document, please send them to + <a href="mailto:public-device-apis@w3.org">public-device-apis@w3.org</a> (<a href="mailto:public-device-apis-request@w3.org?subject=subscribe">subscribe</a>, <a href="http://lists.w3.org/Archives/Public/public-device-apis/">archives</a>). - - + + All feedback is welcome. </p> - + <p> Publication as a Working Draft does not imply endorsement by the <abbr title="World Wide Web Consortium">W3C</abbr> Membership. - This is a draft document and may be updated, replaced or obsoleted by other documents at + This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress. </p> - - + + <p> - - This document was produced by a group operating under the + + This document was produced by a group operating under the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>. - - - - - <abbr title="World Wide Web Consortium">W3C</abbr> maintains a <a href="http://www.w3.org/2004/01/pp-impl/43696/status" rel="disclosure">public list of any patent disclosures</a> - - made in connection with the deliverables of the group; that page also includes instructions for + + + + + <abbr title="World Wide Web Consortium">W3C</abbr> maintains a <a href="http://www.w3.org/2004/01/pp-impl/43696/status" rel="disclosure">public list of any patent disclosures</a> + + made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>. - - + + </p> - - - - + + + + </section><section id="toc"><h2 class="introductory">Table of Contents</h2><ul class="toc"><li class="tocline"><a href="#introduction" class="tocxref"><span class="secno">1. </span> Introduction </a></li><li class="tocline"><a href="#conformance" class="tocxref"><span class="secno">2. </span>Conformance</a><ul class="toc"><li class="tocline"><a href="#dependencies" class="tocxref"><span class="secno">2.1 </span> @@ -366,7 +367,7 @@ </a></li><li class="tocline"><a href="#acknowledgements" class="tocxref"><span class="secno">B. </span> Acknowledgements </a></li><li class="tocline"><a href="#references" class="tocxref"><span class="secno">C. </span>References</a><ul class="toc"><li class="tocline"><a href="#normative-references" class="tocxref"><span class="secno">C.1 </span>Normative references</a></li></ul></li></ul></section> - + <section class="informative" id="introduction"> <!--OddPage--><h2><span class="secno">1. </span> Introduction @@ -379,7 +380,7 @@ <p> Using this <abbr title="Application Programming Interface">API</abbr> consists of requesting a well-known service type, known by developers and advertised by Local-networked Devices. User authorization, where the user - connects the web page to one or more discovered services, is expected before the web page is able to interact + connects the web page to discovered services, is expected before the web page is able to interact with any Local-networked Services. </p> <p> @@ -387,9 +388,9 @@ well-known discovery service type that it wishes to interact with. </p> <p> - The user agent, having captured all advertised services on the network from the Service Discovery mechanisms - included in this recommendation, attempts to match the requested service type to a discovered service according - to the processing described herein. + The user agent, having captured all advertised services on the network from the <a href="#dfn-service-discovery-mechanisms" class="internalDFN">service discovery + mechanisms</a> included in this recommendation, attempts to match the requested service type to a discovered + service according to the processing described herein. </p> <p> If a service connectivity request is successful then the Web page is provided with the necessary information to @@ -472,25 +473,24 @@ are to be interpreted as requirements on user agents. </p> <p> - Conformance requirements phrased as algorithms or specific steps <em class="rfc2119" title="may">may</em> be implemented in any - manner, so long as the end result is equivalent. (In particular, the algorithms defined in this specification - are intended to be easy to follow, and not intended to be performant.) + Conformance requirements phrased as algorithms or specific steps <em class="rfc2119" title="may">may</em> be implemented in any manner, so long as + the end result is equivalent. (In particular, the algorithms defined in this specification are intended to be + easy to follow, and not intended to be performant.) </p> <p> The only conformance class defined by this specification is a <dfn id="dfn-user-agent">user agent</dfn>. </p> <p> - User agents <em class="rfc2119" title="may">may</em> impose implementation-specific limits on otherwise unconstrained inputs, - e.g. to prevent denial of service attacks, to guard against running out of memory, or to work around - platform-specific limitations. + User agents <em class="rfc2119" title="may">may</em> impose implementation-specific limits on otherwise unconstrained inputs, e.g. to prevent denial + of service attacks, to guard against running out of memory, or to work around platform-specific limitations. </p> <p> When support for a feature is disabled (e.g. as an emergency measure to mitigate a security problem, or to aid - in development, or for performance reasons), user agents <em class="rfc2119" title="must">must</em> act as if they had no support - for the feature whatsoever, and as if the feature was not mentioned in this specification. For example, if a - particular feature is accessed via an attribute in a Web IDL interface, the attribute itself would be omitted - from the objects that implement that interface - leaving the attribute on the object but making it return null - or throw an exception is insufficient. + in development, or for performance reasons), user agents <em class="rfc2119" title="must">must</em> act as if they had no support for the feature + whatsoever, and as if the feature was not mentioned in this specification. For example, if a particular feature + is accessed via an attribute in a Web IDL interface, the attribute itself would be omitted from the objects + that implement that interface - leaving the attribute on the object but making it return null or throw an + exception is insufficient. </p> <section id="dependencies"> <h3><span class="secno">2.1 </span> @@ -586,7 +586,7 @@ </dt> <dd> <p> - Prompts the user to select one or more discovered network services that have advertised support for the + Prompts the user to select discovered network services that have advertised support for the requested service type. </p> <p> @@ -594,7 +594,7 @@ page would like to interact with. </p> <p> - If the user accepts, the <var title="">successCallback</var> is invoked, with one or more <a href="#networkservice"><code>NetworkService</code></a> objects as its argument. + If the user accepts, the <var title="">successCallback</var> is invoked, with zero or more <a href="#networkservice"><code>NetworkService</code></a> objects as its argument. </p> <p> If the user declines, the <var title="">errorCallback</var> (if any) is invoked. @@ -604,8 +604,7 @@ <div> <p> When the <dfn id="dom-navigator-getnetworkservices" title="dom-navigator-getnetworkservices"><code>getNetworkServices(type, successCallback[, - errorCallback])</code></dfn> method is called, the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> run the - following steps: + errorCallback])</code></dfn> method is called, the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> run the following steps: </p> <ol class="rule"> <li>Let <var>requested control types</var> be initially set to an empty array. @@ -648,12 +647,6 @@ </li> </ol> </li> - <li>If <var>services found</var> is an empty array, then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> - <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an - object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1 - (<a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its - argument, abort any remaining steps and return. - </li> <li>Return, and run the remaining steps asynchronously. </li> <li>Optionally, e.g. based on a previously-established user preference, for security reasons, or due to @@ -662,9 +655,10 @@ (<a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its argument, abort any remaining steps and return. </li> - <li>The <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> prompt the user in a user-agent-specific manner for - permission to provide the <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" class="externalDFN">entry script</a>'s <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" class="externalDFN">origin</a> with an array of <a href="#networkservice"><code>NetworkService</code></a> objects representing the user-authorized subset of - <var>services found</var>. + <li>If <var>services found</var> is not an empty array then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> prompt the user in a + user-agent-specific manner for permission to provide + the <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" class="externalDFN">entry script</a>'s <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" class="externalDFN">origin</a> with an array of <a href="#networkservice"><code>NetworkService</code></a> objects representing the <a href="#dfn-user-authorized" class="internalDFN">user-authorized</a> subset + of <var>services found</var>. <p> If the user grants permission to access one or more networked services then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="should">should</em> include an "ongoing local-network communication" indicator. @@ -679,9 +673,13 @@ If the user never responds, this algorithm stalls on this step. </p> </li> - <li>Let <var>services</var> be the array of one or more <a href="#networkservice"><code>NetworkService</code></a> objects for which the user granted permission. + <li>Let <var>services</var> be an empty array. </li> - <li>For each Object <var>service</var> in <var>services</var>, run the following sub-steps: + <li> + If <var>services found</var> is not an empty array then set <var>services</var> to be an array of one or more <a href="#networkservice"><code>NetworkService</code></a> objects for which the user granted permission above - known as the + current objects <dfn id="dfn-user-authorized">user-authorized</dfn> services. + </li> + <li>For each Object <var>service</var> in <var>services</var>, if any, run the following sub-steps: <ol class="rule"> <li>Add the <var>service</var>'s <code>url</code> parameter to the <a href="#dfn-entry-script-origin-s-url-whitelist" class="internalDFN">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a>. @@ -696,11 +694,17 @@ object. </li> <li>Set <var>services manager</var>'s <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute to the number of - services currently found in the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a> whose <code>type</code> property + items currently found in the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a> whose <code>type</code> property matches any of the tokens requested in <var>requested control types</var>. </li> - <li>Add the set of <var>services</var> to the <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service records</a> internally against - the newly created <var>services manager</var> object. + <li>Add <var>services</var>, if any, to the <var>services manager</var> object as its collection of <a href="#dfn-indexed-properties-1" class="internalDFN">indexed + properties</a>. If <var>services</var> is an empty array then the <var>services manager</var> does not have any + <var>indexed properties</var>. + </li> + <li>Set <var>services manager</var>'s <a href="#dom-networkservices-length"><code>length</code></a> + attribute to the number of items in <var>services</var>. + </li> + <li>Add <var>services manager</var> to the <a href="#dfn-list-of-active-service-managers" class="internalDFN">list of active service managers</a>. </li> <li>The <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>successCallback</var> with <var>services manager</var> as its argument. @@ -711,13 +715,14 @@ </p> <p> When a <a href="#networkservice"><code>NetworkService</code></a> object is provided to a Web page, the - <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> add the <code>url</code> property to the <dfn id="dfn-entry-script-origin-s-url-whitelist">entry script - origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</dfn>. This list enables the Web page to override and initiate cross-site resource - requests towards these URLs, and any sub-resources of these URLs, within the current <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" class="externalDFN">entry script</a>'s <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" class="externalDFN">origin</a> via various existing mechanisms (e.g. Web Sockets, Server-Sent Events, + <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> add the <code>url</code> property to the <dfn id="dfn-entry-script-origin-s-url-whitelist">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> + whitelist</dfn>. This list enables the Web page to override and initiate cross-site resource requests + towards these URLs, and any sub-resources of these URLs, within the current <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" class="externalDFN">entry script</a>'s <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" class="externalDFN">origin</a> via various existing mechanisms (e.g. Web Sockets, Server-Sent Events, Web Messaging, XMLHttpRequest). </p> <p> - If the user navigates away from the current browsing context, the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="ct"><em class="rfc2119" title="must">must</em></em> remove all previously whitelisted urls from the <a href="#dfn-entry-script-origin-s-url-whitelist" class="internalDFN">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a>. + If the user navigates away from the + <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" class="externalDFN">entry script</a>'s <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" class="externalDFN">origin</a> then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="ct"><em class="rfc2119" title="must">must</em></em> remove all previously whitelisted urls from the <a href="#dfn-entry-script-origin-s-url-whitelist" class="internalDFN">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a>. There is no persistence to network service selections provided to a web page. It is not possible to access a previously white-listed networked service without the necessary user authorization in all of the following cases: @@ -777,10 +782,14 @@ Obtaining networked services </h2> <p> - The <a href="#networkservices"><code>NetworkServices</code></a> interface is the top-level response object from - a call to <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> and provides access - to a set of user-authorized <a href="#networkservice"><code>NetworkService</code></a> objects for the given - request. + The <a href="#networkservices"><code>NetworkServices</code></a> interface represents a collection of zero + or more <dfn id="dfn-indexed-properties">indexed properties</dfn> that are + each a <a href="#dfn-user-authorized" class="internalDFN">user-authorized</a> <a href="#networkservice"><code>NetworkService</code></a> object. + </p> + <p> + A <a href="#networkservices"><code>NetworkServices</code></a> object is the top level success callback + parameter from a call to + <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a>. </p> <pre class="widl">[NoInterfaceObject] interface <dfn id="networkservices">NetworkServices</dfn> { @@ -808,8 +817,7 @@ </dt> <dd> <p> - Returns the current number of services belonging in the respective object's <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service - records</a>. + Returns the current number of items in the current object's collection of <a href="#networkservice"><code>NetworkService</code></a> objects. </p> </dd> <dt> @@ -817,22 +825,21 @@ </dt> <dd> <p> - Returns the current number of services matching one of the app-requested <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> tokens - in the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>. + Returns the current number of items matching one of the app-requested <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> tokens in + the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>. </p> </dd> </dl> <div> <p> - The <dfn id="dom-networkservices-length"><code>length</code></dfn> attribute <em class="rfc2119" title="must">must</em> - return the number of services represented in the object's corresponding <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service - records</a> at the time of getting. + The <dfn id="dom-networkservices-length"><code>length</code></dfn> attribute <em class="rfc2119" title="must">must</em> return the number of + <a href="#networkservice"><code>NetworkService</code></a> objects represented by the collection. </p> <p> - The <dfn id="dom-networkservices-servicesavailable"><code>servicesAvailable</code></dfn> attribute - <em class="rfc2119" title="must">must</em> return the number of services in the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a> - whose <code>type</code> attribute matches any of the <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> tokens that was initially - used to create the current <a href="#networkservices"><code>NetworkServices</code></a> object. + The <dfn id="dom-networkservices-servicesavailable"><code>servicesAvailable</code></dfn> attribute <em class="rfc2119" title="must">must</em> + return the number of services in the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a> whose <code>type</code> + attribute matches any of the <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> tokens that was initially used to create the current + <a href="#networkservices"><code>NetworkServices</code></a> object. </p> </div> </section> @@ -860,11 +867,10 @@ </dd> </dl> <p> - A <a href="#networkservices"><code>NetworkServices</code></a> object represents the current list of one or - more current authorized services - the <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service records</a>. Each item in the <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of - authorized service records</a> is represented by a <a href="#networkservice"><code>NetworkService</code></a> - object. The <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service records</a> is <span>immutable</span> meaning that it cannot be - modified for the lifetime of a <a href="#networkservices"><code>NetworkServices</code></a> object. + A <a href="#networkservices"><code>NetworkServices</code></a> object represents the current collection of zero + or more <a href="#networkservice"><code>NetworkService</code></a> objects - its <a href="#dfn-indexed-properties-1" class="internalDFN">indexed properties</a>. A <a href="#networkservices"><code>NetworkServices</code></a> object is <span>immutable</span> meaning that + <a href="#dfn-indexed-properties-1" class="internalDFN">indexed properties</a> cannot be added and <a href="#dfn-indexed-properties-1" class="internalDFN">indexed properties</a> cannot be removed for the lifetime of + a <a href="#networkservices"><code>NetworkServices</code></a> object. </p> <div class="note"><div class="note-title"><span>Note</span></div><p class=""> Each service in a <a href="#networkservices"><code>NetworkServices</code></a> object thus has an index; the @@ -872,20 +878,19 @@ </p></div> <p> The <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#supported-property-indices" class="externalDFN">supported property indices</a> of <a href="#networkservices"><code>NetworkServices</code></a> objects at any instant are the numbers from zero to - the number of items in the <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service records</a> represented by the respective object - minus one, if any services are represented in the <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service records</a>. + the number of the <a href="#networkservice"><code>NetworkService</code></a> objects in the collection + minus one. </p> <p> To <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#determine-the-value-of-an-indexed-property" class="externalDFN">determine the value of an indexed property</a> for a given index <var>index</var> in a - <a href="#networkservices"><code>NetworkServices</code></a> object's <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service - records</a>, the user agent <em class="rfc2119" title="must">must</em> return the <a href="#networkservice"><code>NetworkService</code></a> object that represents the <var>index</var>th service in - the <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service records</a>. + <a href="#networkservices"><code>NetworkServices</code></a> object the user agent <em class="rfc2119" title="must">must</em> return the <a href="#networkservice"><code>NetworkService</code></a> object that represents the <var>index</var>th item in + the collection. </p> <p> The <dfn id="dom-networkservices-getservicebyid"><code>getServiceById(id)</code></dfn> method <em class="ct"><em class="rfc2119" title="must">must</em></em> return the first <a href="#networkservice"><code>NetworkService</code></a> object in the - <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service records</a> represented by the respective object whose <a href="#dom-networkservice-id"><code>id</code></a> attribute is equal to the value of the <var>id</var> argument. - When no services in the <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service records</a> match the given argument, the method - <em class="rfc2119" title="must">must</em> return null. + collection whose <a href="#dom-networkservice-id"><code>id</code></a> attribute is equal to the value of the + <var>id</var> argument provided. When no <a href="#networkservice"><code>NetworkService</code></a> objects + match the given argument, the method <em class="rfc2119" title="must">must</em> return null. </p> <p> Services available within the local network can connect and disconnect at different times during the @@ -1010,8 +1015,7 @@ </dl> <p> The <dfn id="dom-networkservice-id"><code>id</code></dfn> attribute is a unique identifier for the service. - The same service provided at different times or on different objects <em class="rfc2119" title="must">must</em> have the same - <a href="#dom-networkservice-id"><code>id</code></a> value. + The same service provided at different times or on different objects <em class="rfc2119" title="must">must</em> have the same <a href="#dom-networkservice-id"><code>id</code></a> value. </p> <p> The <dfn id="dom-networkservice-name"><code>name</code></dfn> attribute represents a human-readable title for @@ -1109,34 +1113,38 @@ </h2> <p> A <a href="#dfn-user-agent" class="internalDFN">user agent</a> conforming to this specification <em class="rfc2119" title="may">may</em> implement <abbr title="Simple Service Discovery Protocol">SSDP</abbr> [<cite><a class="bibref" href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>] and Zeroconf [<cite><a class="bibref" href="#bib-DNS-SD">DNS-SD</a></cite>] + [<cite><a class="bibref" href="#bib-MDNS">MDNS</a></cite>] - service discovery mechanisms to enable Web pages to request and connect with <abbr title="Hypertext Transfer Protocol">HTTP</abbr> services running on networked - devices, discovered via either mechanism, through this <abbr title="Application Programming Interface">API</abbr>. When a <a href="#dfn-user-agent" class="internalDFN">user agent</a> implements either of these - service discovery mechanisms, then it <em class="rfc2119" title="must">must</em> conform to the corresponding algorithms provided - in this section of the specification. + <dfn id="dfn-service-discovery-mechanisms">service discovery mechanisms</dfn> - the requirements detailed in this section of the specification - to + enable Web pages to request and connect with <abbr title="Hypertext Transfer Protocol">HTTP</abbr> services running on networked devices, discovered via either + mechanism, through this <abbr title="Application Programming Interface">API</abbr>. When a <a href="#dfn-user-agent" class="internalDFN">user agent</a> implements either of these <a href="#dfn-service-discovery-mechanisms" class="internalDFN">service discovery + mechanisms</a>, then it <em class="rfc2119" title="must">must</em> conform to the corresponding algorithms provided in this section of the + specification. </p> <p> - This section presents how the results of these two service discovery mechanisms will be matched to requested - service types, how the user agent stores available and active services, how their properties are applied to any - resulting <a href="#networkservice"><code>NetworkService</code></a> objects. + This section presents how the results of these two <a href="#dfn-service-discovery-mechanisms" class="internalDFN">service discovery mechanisms</a> will be matched to + requested service types, how the user agent stores available and active services and how their properties are + applied to any resulting <a href="#networkservice"><code>NetworkService</code></a> objects. </p> <p> - It is expected that user agents will perform these service discovery mechanisms asynchronously and - periodically update the <a>list of networked devices</a> as required. The timing of any service discovery - mechanisms is an implementation detail left to the discretion of the implementer (e.g. once on user agent - start-up, every X seconds during user agent execution or on invocation of this <abbr title="Application Programming Interface">API</abbr> from a Web page). + It is expected that user agents will perform these <a href="#dfn-service-discovery-mechanisms" class="internalDFN">service discovery mechanisms</a> asynchronously and + periodically update the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a> as required. The timing of any <a href="#dfn-service-discovery-mechanisms" class="internalDFN">service + discovery mechanisms</a> is an implementation detail left to the discretion of the implementer (e.g. by + continuously monitoring the network as a background process or on invocation of this <abbr title="Application Programming Interface">API</abbr> from a Web page). </p> <p> The <dfn id="dfn-list-of-available-service-records">list of available service records</dfn> is a single dynamic internal lookup table within user agents that is used to track all the services that have been discovered and are available in the current network at - any given time. At any point during the running of either of the two service discovery mechanisms then existing - entries within this table can be updated, entries can be added and entries can be removed as the status of - networked services changes according to the rules defined in this specification. + any given time. At any point during the running of either of the two <a href="#dfn-service-discovery-mechanisms" class="internalDFN">service discovery mechanisms</a> then + existing entries within this table can be updated, entries can be added and entries can be removed as the + status of networked services changes according to the rules defined in this specification. </p> <p> - The <dfn id="dfn-list-of-authorized-service-records">list of authorized service records</dfn> is a single dynamic internal lookup table within user agents - that is used to track the current services that are being shared with web pages at any given time from the - <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>. Each record in the <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service records</a> is - associated with a <var>services manager</var> object that is assigned as part of the <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> algorithm. + The <dfn id="dfn-list-of-active-service-managers">list of active service managers</dfn> is an internal list within user agents that is used to track all + <a href="#networkservices"><code>NetworkServices</code></a> objects currently being shared with any web pages + at the current time within the user agent. Each <a href="#networkservices"><code>NetworkServices</code></a> object + in the <a href="#dfn-list-of-active-service-managers" class="internalDFN">list of + active service managers</a> represents a collection of zero or more <a href="#networkservice"><code>NetworkService</code></a> objects - known as its <dfn id="dfn-indexed-properties-1">indexed properties</dfn>. + <a href="#networkservice"><code>NetworkService</code></a> objects are attached as the <a href="#dfn-indexed-properties-1" class="internalDFN">indexed properties</a> + of a <a href="#networkservices"><code>NetworkServices</code></a> object as part of the <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> algorithm. </p> <p> The rule for <dfn id="dfn-adding-an-available-service">adding an available service</dfn> is the process of adding a new service or updating an @@ -1162,25 +1170,33 @@ </ol> </li> <li>If <var>new service registration flag</var> is set to <code>true</code> then add <var>network service - record</var> to the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a> as a new entry. + record</var> to the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a> as a new item. </li> - <li>For each <var>active service</var> in the <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service records</a> run the following - steps: + <li>For each <var>service manager</var> in the <a href="#dfn-list-of-active-service-managers" class="internalDFN">list of active service managers</a> run the following steps: <ol class="rule"> - <li>If <var>network service record</var>'s <code>type</code> property does not equal the current - <var>active service</var>'s <code>type</code> attribute then abort any remaining sub-steps for this - <var>active service</var> and continue at the next available <var>active service</var>. + <li>Let <var>service type in current service manager flag</var> be <code>false</code>. </li> - <li>If the <var>new service registration flag</var> is set to <code>true</code> then increment the - <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute of the - <var>services manager</var> associated with the current <var>active service</var> object by - <code>1</code> and then <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href="#event-serviceavailable"><code>serviceavailable</code></a> that uses the <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not cancellable, and - has no default action, at the <var>services manager</var> associated with the current <var>active - service</var> object. + <li>For each <var>active service</var> in <var>service manager</var> run the following steps: + <ol class="rule"> + <li>If <var>network service record</var>'s <code>type</code> property does not equal <var>active + service</var>'s <code>type</code> attribute then abort any remaining sub-steps for this <var>active + service</var> and continue at the next available <var>active service</var>. + </li> + <li>Set the <var>service type in current service manager flag</var> to <code>true</code>. + </li> + <li>If the <var>new service registration flag</var> is set to <code>false</code>, the <var>network + service record</var>'s <code>id</code> property equals the <var>active service</var>'s <code>id</code> + attribute and <var>active service</var>'s <a href="#dom-networkservice-online"><code>online</code></a> + attribute is currently set to <code>false</code> then set <var>active service</var>'s <a href="#dom-networkservice-online"><code>online</code></a> attribute to <code>true</code> and then <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href="#event-serviceonline"><code>serviceonline</code></a> that uses the <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not cancellable, + and has no default action, at the current <var>active service</var> object. + </li> + </ol> </li> - <li>Set <var>active service</var>'s <a href="#dom-networkservice-online"><code>online</code></a> attribute - to <code>true</code> and then <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href="#event-serviceonline"><code>serviceonline</code></a> that uses the <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not cancellable, and - has no default action, at the current <var>active service</var> object. + <li>If the <var>new service registration flag</var> is set to <code>true</code> and the <var>service type + in current service manager flag</var> is also set to <code>true</code> then increment <var>service + manager</var>'s <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> + attribute by <code>1</code> and then <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href="#event-serviceavailable"><code>serviceavailable</code></a> that uses the <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not cancellable, and + has no default action, at the current <var>service manager</var> object. </li> </ol> </li> @@ -1204,22 +1220,31 @@ result of having previously called <a href="#dfn-setup-a-upnp-events-subscription" class="internalDFN">setup a UPnP Events Subscription</a> against the current <var>existing service record</var>). </li> - <li>For each <var>active service</var> in <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service records</a> run the following + <li>For each <var>service manager</var> in the <a href="#dfn-list-of-active-service-managers" class="internalDFN">list of active service managers</a> run the following steps: <ol class="rule"> - <li>If <var>existing service record</var>'s <code>type</code> property does not equal the current <var> - active service</var>'s <code>type</code> attribute then abort any remaining sub-steps for this - <var>active service</var> and continue at the next available <var>active service</var>. + <li>Let <var>service type in current service manager flag</var> be <code>false</code>. </li> - <li>Decrement the <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> - attribute of the <var>services manager</var> associated with the current <var>active service</var> - object by <code>1</code> and then <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href="#event-serviceunavailable"><code>serviceunavailable</code></a> that uses the <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not cancellable, - and has no default action, at the <var>services manager</var> associated with the current - <var>active service</var> object. + <li>For each <var>active service</var> in <var>service manager</var> run the following steps: + <ol class="rule"> + <li>If <var>existing service record</var>'s <code>type</code> property does not equal the + <var>active service</var>'s <code>type</code> attribute then abort any remaining sub-steps for this + <var>active service</var> and continue at the next available <var>active service</var>. + </li> + <li>Set the <var>service type in current service manager flag</var> to <code>true</code>. + </li> + <li>If <var>existing service record</var>'s <code>id</code> property equals the <var>active + service</var>'s <code>id</code> attribute and <var>active service</var>'s <a href="#dom-networkservice-online"><code>online</code></a> attribute is currently set to + <code>true</code> then set <var>active service</var>'s <a href="#dom-networkservice-online"><code> + online</code></a> attribute to <code>false</code> and then <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href="#event-serviceoffline"><code>serviceoffline</code></a> that uses the <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not + cancellable, and has no default action, at the current <var>active service</var>. + </li> + </ol> </li> - <li>Set <var>active service</var>'s <a href="#dom-networkservice-online"><code>online</code></a> - attribute to <code>false</code> and then <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href="#event-serviceoffline"><code>serviceoffline</code></a> that uses the <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not cancellable, - and has no default action, at the current <var>active service</var> object. + <li>If the <var>service type in current service manager flag</var> is set to <code>true</code> then + decrement <var>service manager</var>'s <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute by <code>1</code> + and then <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href="#event-serviceunavailable"><code>serviceunavailable</code></a> that uses the <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not cancellable, + and has no default action, at the current <var>service manager</var> object. </li> </ol> </li> @@ -1229,10 +1254,10 @@ </li> </ol> <p> - User agents <em class="rfc2119" title="should">should</em> expire a service record from the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service - records</a> when its <code>expiryTimestamp</code> attribute exceeds the current UTC timestamp. When this - condition is met the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="should">should</em> run the rule for <a href="#dfn-removing-an-available-service" class="internalDFN">removing an available service</a>, passing in - the expired service record's <code>id</code> attribute as the only argument. + User agents <em class="rfc2119" title="should">should</em> expire a service record from the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a> when its + <code>expiryTimestamp</code> attribute exceeds the current UTC timestamp. When this condition is met the + <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="should">should</em> run the rule for <a href="#dfn-removing-an-available-service" class="internalDFN">removing an available service</a>, passing in the expired service + record's <code>id</code> attribute as the only argument. </p> <section id="zeroconf-mdns-dns-sd"> <h3><span class="secno">7.1 </span> @@ -1240,8 +1265,7 @@ </h3> <p> For each <abbr title="Domain Name System">DNS</abbr> response received from a user-agent-initiated Multicast <abbr title="Domain Name System">DNS</abbr> Browse for <abbr title="DNS Pointer Record">PTR</abbr> records with the name <code>_services._dns-sd._udp</code> on the resolved - recommended automatic browsing domain [<cite><a class="bibref" href="#bib-MDNS">MDNS</a></cite>], the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> run the - following steps: + recommended automatic browsing domain [<cite><a class="bibref" href="#bib-MDNS">MDNS</a></cite>], the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> run the following steps: </p> <ol class="rule"> <li>Let <var>service <abbr title="Multicast DNS">mDNS</abbr> responses</var> be an array of <abbr title="DNS Pointer Record">PTR</abbr> records received by issuing a Multicast <abbr title="Domain Name System">DNS</abbr> @@ -1287,37 +1311,37 @@ Simple Service Discovery Protocol (<abbr title="Simple Service Discovery Protocol">SSDP</abbr>) </h3> <p> - A user agent that implements UPnP service discovery <em class="rfc2119" title="must">must</em> issue an <dfn id="dfn-advertisement-for-upnp-root-devices">advertisement for - UPnP root devices</dfn> against the user's current local network according to the full normative text and - timing provided in 'Section 1.3.2: Search request with M-SEARCH' detailed in [<cite><a class="bibref" href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>]. + A user agent that implements UPnP service discovery <em class="rfc2119" title="must">must</em> issue a <dfn id="dfn-search-request-for-upnp-root-devices">search request for UPnP root + devices</dfn> against the user's current local network according to the full normative text and timing + provided in 'Section 1.3.2: Search request with M-SEARCH' detailed in [<cite><a class="bibref" href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>]. </p> <p> - The user agent <em class="rfc2119" title="must">must</em> issue all <a title="advertisement for UPnP root devices" href="#dfn-advertisement-for-upnp-root-devices" class="internalDFN">advertisements for UPnP root devices</a> with a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> request line equal - to <code>M-SEARCH * <abbr title="Hypertext Transfer Protocol">HTTP</abbr>/1.1</code>, with a HOST header equal to the reserved multicast address and port of - <code>239.255.255.250:1900</code>, a MAN header equal to <code>ssdp:discover</code>, an ST header equal to - <code>upnp:rootdevice</code> and a user-agent defined MX header equal to a <dfn id="dfn-maximum-upnp-advertisement-response-wait-time">maximum UPnP advertisement - response wait time</dfn> value between <code>1</code> and <code>5</code> seconds. + The user agent <em class="rfc2119" title="must">must</em> issue all <a title="search request for UPnP root devices" href="#dfn-search-request-for-upnp-root-devices" class="internalDFN">search requests for UPnP root + devices</a> with a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> request line equal to <code>M-SEARCH * <abbr title="Hypertext Transfer Protocol">HTTP</abbr>/1.1</code>, with a HOST header equal to + the reserved multicast address and port of <code>239.255.255.250:1900</code>, a MAN header equal to + <code>ssdp:discover</code>, an ST header equal to <code>upnp:rootdevice</code> and a user-agent defined MX + header equal to a <dfn id="dfn-maximum-upnp-advertisement-response-wait-time">maximum UPnP advertisement response wait time</dfn> value between <code>1</code> and + <code>5</code> seconds. </p> <p> - The user agent <em class="rfc2119" title="must">must</em> listen for incoming requests and process any incoming responses to - any <a href="#dfn-advertisement-for-upnp-root-devices" class="internalDFN">advertisement for UPnP root devices</a> on the <dfn id="dfn-standard-upnp-address-and-port">standard UPnP address and port</dfn>, on all - current local network interface addresses with the port <code>1900</code>, according to the rules defined in - this section. + The user agent <em class="rfc2119" title="must">must</em> listen for any incoming responses to any <a href="#dfn-search-request-for-upnp-root-devices" class="internalDFN">search request for UPnP root devices</a>. </p> <p> - For each <dfn id="dfn-http-response"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response</dfn> following an initial <a href="#dfn-advertisement-for-upnp-root-devices" class="internalDFN">advertisement for UPnP root devices</a> sent on a + For each <dfn id="dfn-http-response"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response</dfn> following an initial <a href="#dfn-search-request-for-upnp-root-devices" class="internalDFN">search request for UPnP root devices</a> sent on a <a href="#dfn-standard-upnp-address-and-port" class="internalDFN">standard UPnP address and port</a> the user agent <em class="rfc2119" title="must">must</em> run the following steps: </p> <ol class="rule"> <li>If the <a href="#dfn-http-response" class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response</a> is not a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> 200 OK response then this response is invalid and the user - agent <em class="rfc2119" title="must">must</em> discard this response, abort any remaining steps and return. The user agent - <em class="rfc2119" title="may">may</em> issue a new <a href="#dfn-advertisement-for-upnp-root-devices" class="internalDFN">advertisement for UPnP root devices</a> as a result of this error + agent <em class="rfc2119" title="must">must</em> discard this response, abort any remaining steps and return. The user agent <em class="rfc2119" title="may">may</em> issue a new + <a href="#dfn-search-request-for-upnp-root-devices" class="internalDFN">search request for UPnP root devices</a> as a result of this error occurring. + </li> + <li>If the <a href="#dfn-maximum-upnp-advertisement-response-wait-time" class="internalDFN">maximum UPnP advertisement response wait time</a> has been exceeded since the initial <a href="#dfn-search-request-for-upnp-root-devices" class="internalDFN">search + request for UPnP root devices</a> was sent then the <a href="#dfn-http-response" class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response</a> is invalid and the user agent <em class="rfc2119" title="must">must</em> + discard this response, abort any remaining steps and return. The user agent <em class="rfc2119" title="may">may</em> stop listening for responses + from the current <a href="#dfn-search-request-for-upnp-root-devices" class="internalDFN">search request for UPnP root devices</a> as a result of this error occurring. Equally, + the user agent <em class="rfc2119" title="may">may</em> issue a new <a href="#dfn-search-request-for-upnp-root-devices" class="internalDFN">search request for UPnP root devices</a> as a result of this error occurring. </li> - <li>If the <a href="#dfn-maximum-upnp-advertisement-response-wait-time" class="internalDFN">maximum UPnP advertisement response wait time</a> has been exceeded since the initial - <a href="#dfn-advertisement-for-upnp-root-devices" class="internalDFN">advertisement for UPnP root devices</a> was sent then the <a href="#dfn-http-response" class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response</a> is invalid and the user - agent <em class="rfc2119" title="must">must</em> discard this response, abort any remaining steps and return. - </li> <li>Let <var>ssdp device</var> be an Object with a property for each <abbr title="Hypertext Transfer Protocol">HTTP</abbr> header received in the <a href="#dfn-http-response" class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response</a>, with each key being the name of a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> response header and each value being that <abbr title="Hypertext Transfer Protocol">HTTP</abbr> response header's value. @@ -1325,24 +1349,26 @@ <li>If <var>ssdp device</var> does not contain at least one <var>CACHE-CONTROL</var> entry, at least one <var>USN</var> entry, at least one <var>ST</var> entry and at least one <var>LOCATION</var> entry or the value of its <var>ST</var> entry is not <code>upnp:rootdevice</code>, then the <a href="#dfn-http-response" class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response</a> is - invalid and the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> discard this response, abort any remaining steps - and return. + invalid and the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> discard this response, abort any remaining steps and return. </li> - <li>The user agent <em class="rfc2119" title="must">must</em> run the rule for <a href="#dfn-obtaining-a-upnp-device-description-file" class="internalDFN">obtaining a UPnP Device Description File</a> - passing in the first occurrence of <var>LOCATION</var> from <var>ssdp device</var> as the <var>device - descriptor <abbr title="Uniform Resource Locator">URL</abbr></var> argument and the first occurrence of <var>USN</var> from <var>ssdp device</var> as the - <var>device identifier</var> argument and the first occurrence of <var>CACHE-CONTROL</var> from <var>ssdp - device</var> as the <var>device expiry</var> argument. + <li>The user agent <em class="rfc2119" title="must">must</em> run the rule for <a href="#dfn-obtaining-a-upnp-device-description-file" class="internalDFN">obtaining a UPnP Device Description File</a> passing in the first + occurrence of <var>LOCATION</var> from <var>ssdp device</var> as the <var>device descriptor <abbr title="Uniform Resource Locator">URL</abbr></var> + argument and the first occurrence of <var>USN</var> from <var>ssdp device</var> as the <var>device + identifier</var> argument and the first occurrence of <var>CACHE-CONTROL</var> from <var>ssdp device</var> + (minus the leading string of <code>max-age=</code>) as the <var>device expiry</var> argument. </li> </ol> <p> - For each <dfn id="dfn-http-request"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Request</dfn> received on a <a href="#dfn-standard-upnp-address-and-port" class="internalDFN">standard UPnP address and port</a> the user agent - <em class="rfc2119" title="must">must</em> run the following steps: + The user agent <em class="rfc2119" title="must">must</em> listen for incoming requests on the <dfn id="dfn-standard-upnp-address-and-port">standard UPnP address and port</dfn> on all + current local network interface addresses with the port <code>1900</code>. + </p> + <p> + For each <dfn id="dfn-http-request"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Request</dfn> received on a <a href="#dfn-standard-upnp-address-and-port" class="internalDFN">standard UPnP address and port</a> the user agent <em class="rfc2119" title="must">must</em> run + the following steps: </p> <ol class="rule"> <li>If the <a href="#dfn-http-request" class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Request</a> is not a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> NOTIFY request then it is not a valid UPnP Request and the user - agent <em class="rfc2119" title="must">must</em> return a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> 200 OK response, discard this request, abort any remaining steps - and return. + agent <em class="rfc2119" title="must">must</em> discard this request, abort any remaining steps and return. </li> <li>Let <var>ssdp device</var> be an Object with a property for each <abbr title="Hypertext Transfer Protocol">HTTP</abbr> header received in the <a href="#dfn-http-request" class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Request</a>, with each key being the name of a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> header and each value being that <abbr title="Hypertext Transfer Protocol">HTTP</abbr> header's value. @@ -1350,20 +1376,20 @@ <li>If <var>ssdp device</var> does not contain at least one <var>CACHE-CONTROL</var> entry, at least one <var>USN</var> entry, at least one <var>NT</var> entry, at least one <var>NTS</var> entry and at least one <var>LOCATION</var> entry or the value of its <var>NT</var> entry is not <code>upnp:rootdevice</code>, then - the <a href="#dfn-http-request" class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Request</a> is a malformed UPnP Request and the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> return - a 400 Bad Request response, discard this request, abort any remaining steps and return. + the <a href="#dfn-http-request" class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Request</a> is a malformed UPnP Request and the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> discard this request, + abort any remaining steps and return. </li> - <li>If <var>ssdp device</var>'s <var>NTS</var> entry is equal to <code>ssdp:alive</code> or - <code>ssdp:update</code> then the user agent <em class="rfc2119" title="must">must</em> run the rule for <a href="#dfn-obtaining-a-upnp-device-description-file" class="internalDFN">obtaining a UPnP - Device Description File</a> passing in the first occurrence of <var>LOCATION</var> from <var>ssdp - device</var> as the <var>device descriptor <abbr title="Uniform Resource Locator">URL</abbr></var> argument and the first occurrence of <var>USN</var> from - <var>ssdp device</var> as the <var>device identifier</var> argument and the first occurrence of - <var>CACHE-CONTROL</var> from <var>ssdp device</var> as the <var>device expiry</var>.<br> + <li>If <var>ssdp device</var>'s <var>NTS</var> entry is equal to <code>ssdp:alive</code> then the user agent + <em class="rfc2119" title="must">must</em> run the rule for <a href="#dfn-obtaining-a-upnp-device-description-file" class="internalDFN">obtaining a UPnP Device Description File</a> passing in the first occurrence of + <var>LOCATION</var> from <var>ssdp device</var> as the <var>device descriptor <abbr title="Uniform Resource Locator">URL</abbr></var> argument and the + first occurrence of <var>USN</var> from <var>ssdp device</var> as the <var>device identifier</var> argument + and the first occurrence of <var>CACHE-CONTROL</var> from <var>ssdp device</var> (minus the leading string of + <code>max-age=</code>) as the <var>device expiry</var>.<br> <br> Otherwise, if <var>ssdp device</var>'s <var>NTS</var> entry is equal to <code>ssdp:byebye</code> then the - user agent <em class="rfc2119" title="must">must</em> run the rule for <a href="#dfn-removing-all-services-from-a-registered-upnp-device" class="internalDFN">removing all services from a registered UPnP - Device</a> passing in the first occurrence of <var>USN</var> from <var>ssdp device</var> as the <var>device - identifier</var> argument. + user agent <em class="rfc2119" title="must">must</em> run the rule for <a href="#dfn-removing-all-services-from-a-registered-upnp-device" class="internalDFN">removing all services from a registered UPnP Device</a> passing in the + first occurrence of <var>USN</var> from <var>ssdp device</var> as the <var>device identifier</var> + argument. </li> </ol> <p> @@ -1378,19 +1404,12 @@ description using <abbr title="Hypertext Transfer Protocol">HTTP</abbr>' in [<cite><a class="bibref" href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>]. </li> <li>If the value provided in <var>device descriptor <abbr title="Uniform Resource Locator">URL</abbr></var> cannot be resolved as a reachable <abbr title="Uniform Resource Locator">URL</abbr> on the - current network or the <var>root device descriptor file</var> remains empty then it is invalid and the - <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> abort any remaining steps and return. + current network or the <var>device descriptor file</var> remains empty then it is invalid and the <a href="#dfn-user-agent" class="internalDFN">user + agent</a> <em class="rfc2119" title="must">must</em> abort any remaining steps and return. </li> <li>Run the rule for <a href="#dfn-processing-a-upnp-device-description-file" class="internalDFN">processing a UPnP Device Description File</a>, passing in the current <var>device descriptor file</var>, <var>device identifier</var> and <var>device expiry</var> arguments. </li> - <li>If the current <var>device descriptor file</var> contains a <code><deviceList></code> element then - for each <code><device></code> element within <code><deviceList></code> - herein known as an - <var>embedded device descriptor file</var> - the user agent <em class="rfc2119" title="must">must</em> run the rule for - <a href="#dfn-processing-a-upnp-device-description-file" class="internalDFN">processing a UPnP Device Description File</a>, passing in the current <var>embedded device descriptor - file</var> as the <var>device descriptor file</var> argument, along with the common <var>device - identifier</var> and <var>device expiry</var> arguments. - </li> </ol> <p> The rule for <dfn id="dfn-processing-a-upnp-device-description-file">processing a UPnP Device Description File</dfn> is the process of parsing the contents of a @@ -1399,8 +1418,8 @@ </p> <p> The rule for <a href="#dfn-processing-a-upnp-device-description-file" class="internalDFN">processing a UPnP Device Description File</a> takes three arguments - <var>device descriptor - file</var>, <var>device identifier</var> and <var>device expiry</var> - and when called the user agent - <em class="rfc2119" title="must">must</em> run the following steps: + file</var>, <var>device identifier</var> and <var>device expiry</var> - and when called the user agent <em class="rfc2119" title="must">must</em> + run the following steps: </p> <ol class="rule"> <li>Let <var>advertised services</var> be a list of all advertised services obtained from the <var>device @@ -1415,8 +1434,8 @@ <code>eventsUrl</code>, <code>config</code>, <code>expiryTimestamp</code>. </li> <li>Set <var>network service record</var>'s <code>id</code> property to the concatenated string value of - <var>device identifier</var> with the <var>advertised service</var>'s <code><serviceId></code> - sub-element. + the first occurrence of the <code><UDN></code> element in the <var>device descriptor file</var> + with the <var>advertised service</var>'s <code><serviceId></code> sub-element. </li> <li>Set <var>network service record</var>'s <code>deviceId</code> property to the value of <var>device identifier</var>. @@ -1448,6 +1467,13 @@ </li> </ol> </li> + <li>If <var>device descriptor file</var> contains a <code><deviceList></code> element then for each + <code><device></code> element within <code><deviceList></code> - herein known as an <var>embedded + device descriptor file</var> - the user agent <em class="rfc2119" title="must">must</em> run the rule for <a href="#dfn-processing-a-upnp-device-description-file" class="internalDFN">processing a UPnP Device Description + File</a>, passing in the current <var>embedded device descriptor file</var> as the <var>device descriptor + file</var> argument, along with the current <var>device identifier</var> and <var>device expiry</var> + arguments. + </li> </ol> <p> The rule for <dfn id="dfn-removing-all-services-from-a-registered-upnp-device">removing all services from a registered UPnP Device</dfn> is the process of removing all @@ -1486,8 +1512,8 @@ string value of <var>callback <abbr title="Uniform Resource Locator">URL</abbr></var> towards the <var>network service record</var>'s <code>eventsUrl</code> property. </li> - <li>If a non-200 OK response is received from the <abbr title="Hypertext Transfer Protocol">HTTP</abbr> SUBSCRIBE request then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> - <em class="rfc2119" title="must">must</em> abort these steps. + <li>If a non-200 OK response is received from the <abbr title="Hypertext Transfer Protocol">HTTP</abbr> SUBSCRIBE request then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> + abort these steps. </li> <li>On receiving a valid 200 OK response, run the following steps: <ol class="rule"> @@ -1514,8 +1540,12 @@ record</var>'s <code>eventsUrl</code> property. </li> <li>On receiving a valid 200 OK, update <var>callback ID</var> with the string value of the first - included <em>SID</em> header, if it exists. All other <abbr title="Hypertext Transfer Protocol">HTTP</abbr> responses should cause the <a href="#dfn-user-agent" class="internalDFN">user - agent</a> to continue from the step labeled <em>refresh subscription</em> above. + included <em>SID</em> header and set <var>timeout date</var> to the sum of the current UTC date value + plus the integer value of the first included <em>TIMEOUT</em> header (minus the leading string of + <code>Second-</code>), if it exists. If the current date is greater than or equal to <var>timeout + date</var> then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="should">should</em> continue from the step labeled <em>refresh + subscription</em> above. For all non 200 OK responses the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="should">should</em> continue from the + step labeled <em>refresh subscription</em> above. </li> </ol> </li> @@ -1524,8 +1554,7 @@ agent</a> is to run the following steps: <ol class="rule"> <li>Let <var>content clone</var> be the result of obtaining the message body of the <abbr title="Hypertext Transfer Protocol">HTTP</abbr> NOTIFY - request. If <var>content clone</var> is empty, then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> - abort these steps. + request. If <var>content clone</var> is empty, then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> abort these steps. </li> <li>Let <var>notification event</var> be a new simple event that uses the <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" class="externalDFN"><code>Event</code></a> interface with the name <a href="#event-notify"><code>notify</code></a>, which does not bubble, is not cancellable, and has no default action. @@ -1537,18 +1566,19 @@ <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">Queue a task</a> to dispatch <var>notification event</var> at the current <a href="#networkservice" class="internalDFN"><code>NetworkService</code></a> object. </li> + <li>Return a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> 200 OK response to the sender of the <abbr title="Hypertext Transfer Protocol">HTTP</abbr> NOTIFY request. + </li> </ol> </li> </ol> </li> </ol> <p> - A <a href="#dfn-user-agent" class="internalDFN">user agent</a> can <dfn id="dfn-terminate-an-existing-upnp-events-subscription">terminate an existing UPnP Events Subscription</dfn> at any time for any - <var>active service</var> in the <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service records</a> by sending an <abbr title="Hypertext Transfer Protocol">HTTP</abbr> UNSUBSCRIBE - request - as defined in 'Section 4.1.4: Cancelling a subscription with UNSUBSCRIBE' in [<cite><a class="bibref" href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>] - - with a HOST header set to that <var>active service</var>'s <code>eventsUrl</code> property and a SID header - set to the <var>callback ID</var> obtained when the initial <a href="#dfn-setup-a-upnp-events-subscription" class="internalDFN">setup a UPnP Events Subscription</a> action - occurred. + A <a href="#dfn-user-agent" class="internalDFN">user agent</a> can <dfn id="dfn-terminate-an-existing-upnp-events-subscription">terminate an existing UPnP Events Subscription</dfn> at any time for a + <var>network service record</var> by sending an <abbr title="Hypertext Transfer Protocol">HTTP</abbr> UNSUBSCRIBE request - as defined in 'Section 4.1.4: + Cancelling a subscription with UNSUBSCRIBE' in [<cite><a class="bibref" href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>] - with a HOST header set to that + <var>active service</var>'s <code>eventsUrl</code> property and a SID header set to the <var>callback + ID</var> obtained when the initial <a href="#dfn-setup-a-upnp-events-subscription" class="internalDFN">setup a UPnP Events Subscription</a> action occurred. </p> </section> <section id="network-topology-monitoring"> @@ -1558,15 +1588,14 @@ <div> <p> When the <a href="#dfn-user-agent" class="internalDFN">user agent</a> detects that the user has dropped from their connected network then, for each - <var>existing service record</var> in the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>, the user agent - <em class="rfc2119" title="must">must</em> run the general rule for <a href="#dfn-removing-an-available-service" class="internalDFN">removing an available service</a> passing in each - <var>existing service record</var>'s <code>id</code> property as the only argument for each call. + <var>existing service record</var> in the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>, the user agent <em class="rfc2119" title="must">must</em> run + the general rule for <a href="#dfn-removing-an-available-service" class="internalDFN">removing an available service</a> passing in each <var>existing service + record</var>'s <code>id</code> property as the only argument for each call. </p> <p> When the <a href="#dfn-user-agent" class="internalDFN">user agent</a> detects that the user has connected to a new network or reconnected to an - existing network, then it <em class="rfc2119" title="should">should</em> restart its discovery mechanisms as defined in the - <a href="#service-discovery">Service Discovery</a> section of this specification, maintaining the existing - <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service records</a> currently in use. + existing network, then it <em class="rfc2119" title="should">should</em> restart its discovery mechanisms as defined in the <a href="#service-discovery">Service Discovery</a> section of this specification, maintaining the existing <a href="#dfn-list-of-active-service-managers" class="internalDFN">list + of active service managers</a> currently in use. </p> </div> </section> @@ -1659,10 +1688,19 @@ Garbage collection </h2> <p> - Only when the user navigates away from the current browsing context can <a href="#networkservice" class="internalDFN"><code>NetworkService</code></a> - objects be garbage-collected, its records in the <a href="#dfn-entry-script-origin-s-url-whitelist" class="internalDFN">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a> be removed and its - corresponding entry in the <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service records</a> be removed according to passing each - expired object identifier through the rule for <a href="#dfn-removing-an-available-service" class="internalDFN">removing an available service</a>. + A user agent <em class="rfc2119" title="must">must</em> only garbage collect a <a href="#networkservices" class="internalDFN"><code>NetworkServices</code></a> object and remove its entry from + the <a href="#dfn-list-of-active-service-managers" class="internalDFN">list of active service managers</a> when the user has navigated away from the + <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" class="externalDFN">entry script</a>'s <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" class="externalDFN">origin</a> in which + the current <a href="#networkservices" class="internalDFN"><code>NetworkServices</code></a> object was provided. + </p> + <p> + A user agent <em class="rfc2119" title="must not">must not</em> garbage collect individual <a href="#networkservice" class="internalDFN"><code>NetworkService</code></a> objects until their parent + <a href="#networkservices" class="internalDFN"><code>NetworkServices</code></a> object has been garbage collected. + </p> + <p> + A user agent <em class="rfc2119" title="must">must</em> garbage collect the <a href="#networkservice" class="internalDFN"><code>NetworkService</code></a> <a href="#dfn-indexed-properties-1" class="internalDFN">indexed properties</a> of a + <a href="#networkservices" class="internalDFN"><code>NetworkServices</code></a> object when that <a href="#networkservices" class="internalDFN"><code>NetworkServices</code></a> object itself has been + garbage-collected. </p> </section> <section id="use-cases-and-requirements"> @@ -1954,13 +1992,13 @@ CableLabs, Opera Software ASA, <abbr title="World Wide Web Consortium">W3C</abbr> Device APIs Working Group, <abbr title="World Wide Web Consortium">W3C</abbr> Web and TV Interest Group. </p> </section> - + <section id="references" class="appendix"><!--OddPage--><h2><span class="secno">C. </span>References</h2><section id="normative-references"><h3><span class="secno">C.1 </span>Normative references</h3><dl class="bibliography"><dt id="bib-DNS-SD">[DNS-SD]</dt><dd>S. Cheshire; M. Krochmal. <a href="http://files.dns-sd.org/draft-cheshire-dnsext-dns-sd.txt"><cite>DNS-Based Service Discovery.</cite></a> 27 February 2011. IETF Draft. URL: <a href="http://files.dns-sd.org/draft-cheshire-dnsext-dns-sd.txt">http://files.dns-sd.org/draft-cheshire-dnsext-dns-sd.txt</a> -</dd><dt id="bib-DOM4">[DOM4]</dt><dd>Anne van Kesteren; Aryeh Gregor; Ms2ger. <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html/"><cite>DOM4.</cite></a> URL: <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html/">http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html/</a> -</dd><dt id="bib-HTML5">[HTML5]</dt><dd>Ian Hickson; David Hyatt. <a href="http://www.w3.org/TR/html5"><cite>HTML5.</cite></a> 29 March 2012. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/html5">http://www.w3.org/TR/html5</a> +</dd><dt id="bib-DOM4">[DOM4]</dt><dd>Anne van Kesteren; Aryeh Gregor; Ms2ger. <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html/"><cite>DOM4.</cite></a> URL: <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html/">http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html/</a> +</dd><dt id="bib-HTML5">[HTML5]</dt><dd>Ian Hickson; David Hyatt. <a href="http://www.w3.org/TR/html5"><cite>HTML5.</cite></a> 29 March 2012. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/html5">http://www.w3.org/TR/html5</a> </dd><dt id="bib-MDNS">[MDNS]</dt><dd>S. Cheshire; M. Krochmal. <a href="http://files.multicastdns.org/draft-cheshire-dnsext-multicastdns.txt"><cite>Multicast DNS.</cite></a> 14 February 2011. IETF Draft. URL: <a href="http://files.multicastdns.org/draft-cheshire-dnsext-multicastdns.txt">http://files.multicastdns.org/draft-cheshire-dnsext-multicastdns.txt</a> -</dd><dt id="bib-RFC2119">[RFC2119]</dt><dd>S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key words for use in RFCs to Indicate Requirement Levels.</cite></a> March 1997. Internet RFC 2119. URL: <a href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a> +</dd><dt id="bib-RFC2119">[RFC2119]</dt><dd>S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key words for use in RFCs to Indicate Requirement Levels.</cite></a> March 1997. Internet RFC 2119. URL: <a href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a> </dd><dt id="bib-UPNP-DEVICEARCH11">[UPNP-DEVICEARCH11]</dt><dd><a href="http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf"><cite>UPnP Device Architecture 1.1</cite></a>. 15 October 2008. UPnP Forum. PDF document. URL: <a href="http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf">http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf</a> -</dd><dt id="bib-WEBIDL">[WEBIDL]</dt><dd>Cameron McCormack. <a href="http://www.w3.org/TR/2011/WD-WebIDL-20110927/"><cite>Web IDL.</cite></a> 27 September 2011. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/2011/WD-WebIDL-20110927/">http://www.w3.org/TR/2011/WD-WebIDL-20110927/</a> +</dd><dt id="bib-WEBIDL">[WEBIDL]</dt><dd>Cameron McCormack. <a href="http://www.w3.org/TR/2011/WD-WebIDL-20110927/"><cite>Web IDL.</cite></a> 27 September 2011. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/2011/WD-WebIDL-20110927/">http://www.w3.org/TR/2011/WD-WebIDL-20110927/</a> </dd></dl></section></section></body></html> \ No newline at end of file
Received on Wednesday, 3 October 2012 12:47:36 UTC