aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-09-12 14:08:33 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-09-12 14:08:33 +0200
commit5b74cd6f2b5cdd82273759aa7d72150dfff58a2c (patch)
tree3c589f9487e693f9287b89eeb2fc10a8af651ce1
parent628dc10767d95436538391534dc3c95f45fe9a3a (diff)
add documentation & ideas about config.xml
Also enforce the strings for 'id' and 'version' to be not empty in config.xml Change-Id: I510b62891885033e0b750fac5f5de5e0fd25d75d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--doc/afm-system-daemon.html4
-rw-r--r--doc/afm-user-daemon.html4
-rw-r--r--doc/application-framework.html4
-rw-r--r--doc/overview.html4
-rw-r--r--doc/quick-tutorial.html4
-rw-r--r--doc/security-framework.html4
-rwxr-xr-xdoc/updt.sh1
-rw-r--r--doc/widgets.html62
-rw-r--r--doc/writing-config.xml.html168
-rw-r--r--doc/writing-config.xml.md217
-rw-r--r--src/wgtpkg-install.c9
11 files changed, 445 insertions, 36 deletions
diff --git a/doc/afm-system-daemon.html b/doc/afm-system-daemon.html
index 6cd5ede..199bf38 100644
--- a/doc/afm-system-daemon.html
+++ b/doc/afm-system-daemon.html
@@ -8,10 +8,10 @@
<meta name="author" content="Fulup Ar Foll">
<title>The afm-system-daemon</title>
<style type="text/css">code{white-space: pre;}</style>
+ <link rel="stylesheet" href="doc.css">
<!--[if lt IE 9]>
- <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+ <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
- <link rel="stylesheet" href="doc.css">
</head>
<body>
<header>
diff --git a/doc/afm-user-daemon.html b/doc/afm-user-daemon.html
index 364218f..5bf56f7 100644
--- a/doc/afm-user-daemon.html
+++ b/doc/afm-user-daemon.html
@@ -8,10 +8,10 @@
<meta name="author" content="Fulup Ar Foll">
<title>The afm-user-daemon</title>
<style type="text/css">code{white-space: pre;}</style>
+ <link rel="stylesheet" href="doc.css">
<!--[if lt IE 9]>
- <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+ <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
- <link rel="stylesheet" href="doc.css">
</head>
<body>
<header>
diff --git a/doc/application-framework.html b/doc/application-framework.html
index 4a7e36a..8d0e0e3 100644
--- a/doc/application-framework.html
+++ b/doc/application-framework.html
@@ -8,10 +8,10 @@
<meta name="author" content="Fulup Ar Foll">
<title>Application framework</title>
<style type="text/css">code{white-space: pre;}</style>
+ <link rel="stylesheet" href="doc.css">
<!--[if lt IE 9]>
- <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+ <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
- <link rel="stylesheet" href="doc.css">
</head>
<body>
<header>
diff --git a/doc/overview.html b/doc/overview.html
index c5998a6..055d5d5 100644
--- a/doc/overview.html
+++ b/doc/overview.html
@@ -7,10 +7,10 @@
<meta name="author" content="José Bollo">
<title>AGL framework, overview of the proposal of IoT.bzh</title>
<style type="text/css">code{white-space: pre;}</style>
+ <link rel="stylesheet" href="doc.css">
<!--[if lt IE 9]>
- <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+ <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
- <link rel="stylesheet" href="doc.css">
</head>
<body>
<header>
diff --git a/doc/quick-tutorial.html b/doc/quick-tutorial.html
index 72bf123..3b5c6a9 100644
--- a/doc/quick-tutorial.html
+++ b/doc/quick-tutorial.html
@@ -8,10 +8,10 @@
<meta name="author" content="José Bollo">
<title>AGL Application Framework: A Quick Tutorial</title>
<style type="text/css">code{white-space: pre;}</style>
+ <link rel="stylesheet" href="doc.css">
<!--[if lt IE 9]>
- <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+ <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
- <link rel="stylesheet" href="doc.css">
</head>
<body>
<header>
diff --git a/doc/security-framework.html b/doc/security-framework.html
index dd4e72a..bf4dd48 100644
--- a/doc/security-framework.html
+++ b/doc/security-framework.html
@@ -7,10 +7,10 @@
<meta name="author" content="José Bollo">
<title>The security framework</title>
<style type="text/css">code{white-space: pre;}</style>
+ <link rel="stylesheet" href="doc.css">
<!--[if lt IE 9]>
- <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+ <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
- <link rel="stylesheet" href="doc.css">
</head>
<body>
<header>
diff --git a/doc/updt.sh b/doc/updt.sh
index 5267ad5..d0c02e7 100755
--- a/doc/updt.sh
+++ b/doc/updt.sh
@@ -41,6 +41,7 @@ meta() {
mkhtml() {
local x=$1
local h=${x%%.md}.html
+ echo updating $h from $x
meta "$x" |
pandoc --css doc.css -f markdown -t html5 --toc > "$h"
}
diff --git a/doc/widgets.html b/doc/widgets.html
index 5a22e4b..8c27577 100644
--- a/doc/widgets.html
+++ b/doc/widgets.html
@@ -8,29 +8,47 @@
<meta name="author" content="Fulup Ar Foll">
<title>The widgets</title>
<style type="text/css">code{white-space: pre;}</style>
- <!--[if lt IE 9]>
- <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
- <![endif]-->
<style type="text/css">
+div.sourceCode { overflow-x: auto; }
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
td.sourceCode { padding-left: 5px; }
-code > span.kw { color: #007020; font-weight: bold; }
-code > span.dt { color: #902000; }
-code > span.dv { color: #40a070; }
-code > span.bn { color: #40a070; }
-code > span.fl { color: #40a070; }
-code > span.ch { color: #4070a0; }
-code > span.st { color: #4070a0; }
-code > span.co { color: #60a0b0; font-style: italic; }
-code > span.ot { color: #007020; }
-code > span.al { color: #ff0000; font-weight: bold; }
-code > span.fu { color: #06287e; }
-code > span.er { color: #ff0000; font-weight: bold; }
+code > span.kw { color: #007020; font-weight: bold; } /* Keyword */
+code > span.dt { color: #902000; } /* DataType */
+code > span.dv { color: #40a070; } /* DecVal */
+code > span.bn { color: #40a070; } /* BaseN */
+code > span.fl { color: #40a070; } /* Float */
+code > span.ch { color: #4070a0; } /* Char */
+code > span.st { color: #4070a0; } /* String */
+code > span.co { color: #60a0b0; font-style: italic; } /* Comment */
+code > span.ot { color: #007020; } /* Other */
+code > span.al { color: #ff0000; font-weight: bold; } /* Alert */
+code > span.fu { color: #06287e; } /* Function */
+code > span.er { color: #ff0000; font-weight: bold; } /* Error */
+code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
+code > span.cn { color: #880000; } /* Constant */
+code > span.sc { color: #4070a0; } /* SpecialChar */
+code > span.vs { color: #4070a0; } /* VerbatimString */
+code > span.ss { color: #bb6688; } /* SpecialString */
+code > span.im { } /* Import */
+code > span.va { color: #19177c; } /* Variable */
+code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
+code > span.op { color: #666666; } /* Operator */
+code > span.bu { } /* BuiltIn */
+code > span.ex { } /* Extension */
+code > span.pp { color: #bc7a00; } /* Preprocessor */
+code > span.at { color: #7d9029; } /* Attribute */
+code > span.do { color: #ba2121; font-style: italic; } /* Documentation */
+code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
+code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
+code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
</style>
<link rel="stylesheet" href="doc.css">
+ <!--[if lt IE 9]>
+ <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
+ <![endif]-->
</head>
<body>
<header>
@@ -68,7 +86,7 @@ code > span.er { color: #ff0000; font-weight: bold; }
<h3 id="the-configuration-file-config.xml">The configuration file config.xml</h3>
<p>This is one of the important file of the widget. It fully describes the widget.</p>
<p>Here is the example of the config file for the QML application SmartHome.</p>
-<pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw">&lt;?xml</span> version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;<span class="kw">?&gt;</span>
+<div class="sourceCode"><pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw">&lt;?xml</span> version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;<span class="kw">?&gt;</span>
<span class="kw">&lt;widget</span><span class="ot"> xmlns=</span><span class="st">&quot;http://www.w3.org/ns/widgets&quot;</span><span class="ot"> id=</span><span class="st">&quot;smarthome&quot;</span><span class="ot"> version=</span><span class="st">&quot;0.1&quot;</span><span class="kw">&gt;</span>
<span class="kw">&lt;name&gt;</span>SmartHome<span class="kw">&lt;/name&gt;</span>
<span class="kw">&lt;icon</span><span class="ot"> src=</span><span class="st">&quot;smarthome.png&quot;</span><span class="kw">/&gt;</span>
@@ -77,7 +95,7 @@ code > span.er { color: #ff0000; font-weight: bold; }
automated house. The user interface is completely done with QML.<span class="kw">&lt;/description&gt;</span>
<span class="kw">&lt;author&gt;</span>Qt team<span class="kw">&lt;/author&gt;</span>
<span class="kw">&lt;license&gt;</span>GPL<span class="kw">&lt;/license&gt;</span>
-<span class="kw">&lt;/widget&gt;</span></code></pre>
+<span class="kw">&lt;/widget&gt;</span></code></pre></div>
<p>The most important items are:</p>
<ul>
<li><p><strong>&lt;widget id=&quot;......&quot;&gt;</strong>: gives the id of the widget. It must be unique.</p></li>
@@ -97,22 +115,22 @@ automated house. The user interface is completely done with QML.<span class="kw"
<p>For all these commands, a tiny help is available with options <strong>-h</strong> or <strong>--help</strong>.</p>
<p>There is no tool for unpacking a widget. For doing such operation, you can use the command <strong>unzip</strong>.</p>
<p>To list the files of a widget:</p>
-<pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="kw">unzip</span> -l WIDGET</code></pre>
+<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="kw">unzip</span> -l WIDGET</code></pre></div>
<p>To extract a widget in some directory:</p>
-<pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="kw">unzip</span> WIDGET -d DIRECTORY</code></pre>
+<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="kw">unzip</span> WIDGET -d DIRECTORY</code></pre></div>
<p><em>Note that DIRECTORY will be created if needed</em>.</p>
<h3 id="signing-a-widget">Signing a widget</h3>
<p>To sign a widget, you need a private key and its certificate.</p>
<p>The tool <strong>wgtpkg-sign</strong> creates or replace a signature file in the directory of the widget BEFORE its packaging.</p>
<p>There are two types of signature files: author and distributor.</p>
<p>Example 1: add an author signature</p>
-<pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="kw">wgtpkg-sign</span> -a -k me.key.pem -c me.cert.pem DIRECTORY</code></pre>
+<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="kw">wgtpkg-sign</span> -a -k me.key.pem -c me.cert.pem DIRECTORY</code></pre></div>
<p>Example 2: add a distributor signature</p>
-<pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="kw">wgtpkg-sign</span> -k authority.key.pem -c authority.cert.pem DIRECTORY</code></pre>
+<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="kw">wgtpkg-sign</span> -k authority.key.pem -c authority.cert.pem DIRECTORY</code></pre></div>
<h3 id="packing-a-widget">Packing a widget</h3>
<p>This operation can be done using the command <strong>zip</strong> but we provide the tool <strong>wgtpkg-pack</strong> that may add checking.</p>
<p>Example:</p>
-<pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="kw">wgtpkg-pack</span> DIRECTORY -o file.wgt</code></pre>
+<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="kw">wgtpkg-pack</span> DIRECTORY -o file.wgt</code></pre></div>
<h3 id="getting-data-about-a-widget-file">Getting data about a widget file</h3>
<p>The command <strong>wgtpkg-info</strong> opens a widget file, reads its <strong>config.xml</strong> file and displays its content in a human readable way.</p>
<h2 id="writing-a-widget">Writing a widget</h2>
diff --git a/doc/writing-config.xml.html b/doc/writing-config.xml.html
new file mode 100644
index 0000000..35c7372
--- /dev/null
+++ b/doc/writing-config.xml.html
@@ -0,0 +1,168 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <meta name="generator" content="pandoc">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
+ <title>Writing the configuration file &quot;config.xml&quot;</title>
+ <style type="text/css">code{white-space: pre;}</style>
+ <style type="text/css">
+div.sourceCode { overflow-x: auto; }
+table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
+ margin: 0; padding: 0; vertical-align: baseline; border: none; }
+table.sourceCode { width: 100%; line-height: 100%; }
+td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
+td.sourceCode { padding-left: 5px; }
+code > span.kw { color: #007020; font-weight: bold; } /* Keyword */
+code > span.dt { color: #902000; } /* DataType */
+code > span.dv { color: #40a070; } /* DecVal */
+code > span.bn { color: #40a070; } /* BaseN */
+code > span.fl { color: #40a070; } /* Float */
+code > span.ch { color: #4070a0; } /* Char */
+code > span.st { color: #4070a0; } /* String */
+code > span.co { color: #60a0b0; font-style: italic; } /* Comment */
+code > span.ot { color: #007020; } /* Other */
+code > span.al { color: #ff0000; font-weight: bold; } /* Alert */
+code > span.fu { color: #06287e; } /* Function */
+code > span.er { color: #ff0000; font-weight: bold; } /* Error */
+code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
+code > span.cn { color: #880000; } /* Constant */
+code > span.sc { color: #4070a0; } /* SpecialChar */
+code > span.vs { color: #4070a0; } /* VerbatimString */
+code > span.ss { color: #bb6688; } /* SpecialString */
+code > span.im { } /* Import */
+code > span.va { color: #19177c; } /* Variable */
+code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
+code > span.op { color: #666666; } /* Operator */
+code > span.bu { } /* BuiltIn */
+code > span.ex { } /* Extension */
+code > span.pp { color: #bc7a00; } /* Preprocessor */
+code > span.at { color: #7d9029; } /* Attribute */
+code > span.do { color: #ba2121; font-style: italic; } /* Documentation */
+code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
+code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
+code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
+ </style>
+ <link rel="stylesheet" href="doc.css">
+ <!--[if lt IE 9]>
+ <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
+ <![endif]-->
+</head>
+<body>
+<header>
+<h1 class="title">Writing the configuration file &quot;config.xml&quot;</h1>
+<h3 class="date">02 septembre 2016</h3>
+</header>
+<nav id="TOC">
+<ul>
+<li><a href="#writing-the-configuration-file-config.xml">Writing the configuration file &quot;config.xml&quot;</a><ul>
+<li><a href="#about-config.xml">About &quot;config.xml&quot;</a></li>
+<li><a href="#example-of-config.xml">Example of &quot;config.xml&quot;</a></li>
+<li><a href="#standard-elements-of-config.xml">Standard elements of &quot;config.xml&quot;</a><ul>
+<li><a href="#the-element-widget">The element widget</a></li>
+<li><a href="#the-element-content">The element content</a></li>
+<li><a href="#the-element-icon">The element icon</a></li>
+</ul></li>
+<li><a href="#known-widget-types-and-content">Known widget types and content</a></li>
+<li><a href="#agl-features">AGL features</a><ul>
+<li><a href="#feature-nameurnaglprovides-binding">feature name=&quot;urn:AGL:provides-binding&quot;</a></li>
+<li><a href="#feature-nameurnaglrequired-permission">feature name=&quot;urn:AGL:required-permission&quot;</a></li>
+<li><a href="#feature-nameurnagl-permission">feature name=&quot;urn:AGL:-permission&quot;</a></li>
+</ul></li>
+</ul></li>
+</ul>
+</nav>
+<h1 id="writing-the-configuration-file-config.xml">Writing the configuration file &quot;config.xml&quot;</h1>
+<h2 id="about-config.xml">About &quot;config.xml&quot;</h2>
+<p>The file <strong>config.xml</strong> describes important data of the application to the framework:</p>
+<ul>
+<li>the unique identifier of the application</li>
+<li>the name of the application</li>
+<li>the type of the application</li>
+<li>the icon of the application</li>
+<li>the permissions linked to the application</li>
+<li>the services and dependancies of the application</li>
+</ul>
+<p>The file MUST be at the root of the widget and MUST be case sensitively name <strong><em>config.xml</em></strong>.</p>
+<p>The file <strong>config.xml</strong> is a XML file described by the document <a href="http://www.w3.org/TR/widgets" title="Packaged Web Apps">widgets</a>.</p>
+<h2 id="example-of-config.xml">Example of &quot;config.xml&quot;</h2>
+<p>Here is the example of the config file for the QML application SmartHome.</p>
+<div class="sourceCode"><pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw">&lt;?xml</span> version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;<span class="kw">?&gt;</span>
+<span class="kw">&lt;widget</span><span class="ot"> xmlns=</span><span class="st">&quot;http://www.w3.org/ns/widgets&quot;</span><span class="ot"> id=</span><span class="st">&quot;smarthome&quot;</span><span class="ot"> version=</span><span class="st">&quot;0.1&quot;</span><span class="kw">&gt;</span>
+ <span class="kw">&lt;name&gt;</span>SmartHome<span class="kw">&lt;/name&gt;</span>
+ <span class="kw">&lt;icon</span><span class="ot"> src=</span><span class="st">&quot;smarthome.png&quot;</span><span class="kw">/&gt;</span>
+ <span class="kw">&lt;content</span><span class="ot"> src=</span><span class="st">&quot;qml/smarthome/smarthome.qml&quot;</span><span class="ot"> type=</span><span class="st">&quot;text/vnd.qt.qml&quot;</span><span class="kw">/&gt;</span>
+ <span class="kw">&lt;description&gt;</span>
+ This is the Smarthome QML demo application.
+ It shows some user interfaces for controlling an automated house.
+ The user interface is completely done with QML.
+ <span class="kw">&lt;/description&gt;</span>
+ <span class="kw">&lt;author&gt;</span>Qt team<span class="kw">&lt;/author&gt;</span>
+ <span class="kw">&lt;license&gt;</span>GPL<span class="kw">&lt;/license&gt;</span>
+<span class="kw">&lt;/widget&gt;</span></code></pre></div>
+<h2 id="standard-elements-of-config.xml">Standard elements of &quot;config.xml&quot;</h2>
+<h3 id="the-element-widget">The element widget</h3>
+<h4 id="the-attribute-id-of-widget">the attribute id of widget</h4>
+<p>The attribute <em>id</em> is mandatory (for version 2.x, blowfish) and must be unique.</p>
+<p>Values for <em>id</em> are any non empty string containing only latin letters, arabic digits, and the three characters '.' (dot), '-' (dash) and '_' (underscore).</p>
+<p>Authors can use a mnemonic id or can pick a unique id using command <strong>uuid</strong> or <strong>uuidgen</strong>.</p>
+<h4 id="the-attribute-version-of-widget">the attribute version of widget</h4>
+<p>The attribute <em>version</em> is mandatory (for version 2.x, blowfish).</p>
+<p>Values for <em>id</em> are any non empty string containing only latin letters, arabic digits, and the three characters '.' (dot), '-' (dash) and '_' (underscore).</p>
+<p>Version values are dot separated fields MAJOR.MINOR.REVISION.</p>
+<h3 id="the-element-content">The element content</h3>
+<p>The element <em>content</em> is mandatory (for version 2.x, blowfish) and must designate a file (subject to localisation) with its attribute <em>src</em>.</p>
+<p>The content designed depends on its type. See below for the known types.</p>
+<h3 id="the-element-icon">The element icon</h3>
+<p>The element <em>icon</em> is mandatory (for version 2.x, blowfish) and must be unique. It must designate an image file with its attribute <em>src</em>.</p>
+<h2 id="known-widget-types-and-content">Known widget types and content</h2>
+<p>The configuration file <strong><em>/etc/afm/afm-launch.conf</em></strong> defines the types of widget known and how to launch it.</p>
+<p>Known types for the type of content are (for version 2.x, blowfish):</p>
+<ul>
+<li><p><strong><em>text/html</em></strong>: HTML application, content.src designates the home page of the application</p></li>
+<li><p><strong><em>application/x-executable</em></strong>: Native application, content.src designates the relative path of the binary</p></li>
+<li><p><strong><em>application/vnd.agl.url</em></strong>: Internet url, content.src designates the url to be used</p></li>
+<li><p><strong><em>application/vnd.agl.service</em></strong>: AGL service defined as a binder, content.src designates the directory of provided binders, http content, if any, must be put in the subdirectory <strong><em>htdocs</em></strong> of the widget</p></li>
+<li><p><strong><em>application/vnd.agl.native</em></strong>: Native application with AGL service defined as a binder, content.src designates the relative path of the binary, bindings, if any must be put in the subdirectory <strong><em>lib</em></strong> of the widget, http content, if any, must be put in the subdirectory <strong><em>htdocs</em></strong> of the widget</p></li>
+<li><p><strong><em>text/vnd.qt.qml</em></strong>, <strong><em>application/vnd.agl.qml</em></strong>: QML application, content.src designate the relative path of the QML root, imports must be put in the subdirectory <strong><em>imports</em></strong> of the widget</p></li>
+<li><p><strong><em>application/vnd.agl.qml.hybrid</em></strong>: QML application with bindings, content.src designate the relative path of the QML root, bindings, if any must be put in the subdirectory <strong><em>lib</em></strong> of the widget, imports must be put in the subdirectory <strong><em>imports</em></strong> of the widget</p></li>
+<li><p><strong><em>application/vnd.agl.html.hybrid</em></strong>: HTML application, content.src designates the home page of the application, bindings, if any must be put in the subdirectory <strong><em>lib</em></strong> of the widget, http content must be put in the subdirectory <strong><em>htdocs</em></strong> of the widget</p></li>
+</ul>
+<h2 id="agl-features">AGL features</h2>
+<p>The AGL framework uses the feature tag for specifying security and binding requirement of the widget.</p>
+<p>The current version of AGL (up to 2.0.1, blowfish) has no fully implemented features.</p>
+<p>The features planned to be implemented are described below.</p>
+<h3 id="feature-nameurnaglprovides-binding">feature name=&quot;urn:AGL:provides-binding&quot;</h3>
+<p>Use this feature for each provided binding of the widget. The parameters are:</p>
+<h5 id="param-namename">param name=&quot;name&quot;</h5>
+<p>REQUIRED</p>
+<p>The value is the string that must match the binding prefix. It must be unique.</p>
+<h5 id="param-namesrc">param name=&quot;src&quot;</h5>
+<p>REQUIRED</p>
+<p>The value is the path of the shared library for the binding.</p>
+<h5 id="param-nametype">param name=&quot;type&quot;</h5>
+<p>REQUIRED</p>
+<p>Currently it must be <strong><em>application/vnd.agl.binding.v1</em></strong>.</p>
+<h5 id="param-namescope">param name=&quot;scope&quot;</h5>
+<p>REQUIRED</p>
+<p>The value indicate the availability of the binidng:</p>
+<ul>
+<li>private: used only by the widget</li>
+<li>public: available to allowed clients as a remote service (requires permission+)</li>
+<li>inline: available to allowed clients inside their binding (unsafe, requires permission+++)</li>
+</ul>
+<h5 id="param-nameneeded-binding">param name=&quot;needed-binding&quot;</h5>
+<p>OPTIONAL</p>
+<p>The value is a space separated list of binding's names that the binding needs.</p>
+<h3 id="feature-nameurnaglrequired-permission">feature name=&quot;urn:AGL:required-permission&quot;</h3>
+<p>Several permission can be listed or none whether no permission is requested for the widget.</p>
+<p>Each required permission must be explicited using a <param> entry.</p>
+<h5 id="param-namerequired-permission-name">param name=[required permission name]</h5>
+<p>The value is either:</p>
+<ul>
+<li>required: the permission is really needed.</li>
+<li>optional: the permission isn't mandatory</li>
+</ul>
+<h3 id="feature-nameurnagl-permission">feature name=&quot;urn:AGL:-permission&quot;</h3>
+</body>
+</html>
diff --git a/doc/writing-config.xml.md b/doc/writing-config.xml.md
new file mode 100644
index 0000000..54172ff
--- /dev/null
+++ b/doc/writing-config.xml.md
@@ -0,0 +1,217 @@
+Writing the configuration file "config.xml"
+===========================================
+
+About "config.xml"
+------------------
+
+The file **config.xml** describes important data of the application
+to the framework:
+
+- the unique identifier of the application
+- the name of the application
+- the type of the application
+- the icon of the application
+- the permissions linked to the application
+- the services and dependancies of the application
+
+The file MUST be at the root of the widget and MUST be case sensitively name
+***config.xml***.
+
+The file **config.xml** is a XML file described by the document
+[widgets].
+
+Example of "config.xml"
+-----------------------
+
+Here is the example of the config file for the QML application SmartHome.
+
+```xml
+<?xml version="1.0" encoding="UTF-8"?>
+<widget xmlns="http://www.w3.org/ns/widgets" id="smarthome" version="0.1">
+ <name>SmartHome</name>
+ <icon src="smarthome.png"/>
+ <content src="qml/smarthome/smarthome.qml" type="text/vnd.qt.qml"/>
+ <description>
+ This is the Smarthome QML demo application.
+ It shows some user interfaces for controlling an automated house.
+ The user interface is completely done with QML.
+ </description>
+ <author>Qt team</author>
+ <license>GPL</license>
+</widget>
+```
+
+Standard elements of "config.xml"
+---------------------------------
+
+### The element widget
+
+#### the attribute id of widget
+
+The attribute *id* is mandatory (for version 2.x, blowfish) and must be unique.
+
+Values for *id* are any non empty string containing only latin letters,
+arabic digits, and the three characters '.' (dot), '-' (dash) and
+'_' (underscore).
+
+Authors can use a mnemonic id or can pick a unique id using
+command **uuid** or **uuidgen**.
+
+#### the attribute version of widget
+
+The attribute *version* is mandatory (for version 2.x, blowfish).
+
+Values for *id* are any non empty string containing only latin letters,
+arabic digits, and the three characters '.' (dot), '-' (dash) and
+'_' (underscore).
+
+Version values are dot separated fields MAJOR.MINOR.REVISION.
+
+### The element content
+
+The element *content* is mandatory (for version 2.x, blowfish) and must designate a file
+(subject to localisation) with its attribute *src*.
+
+The content designed depends on its type. See below for the known types.
+
+### The element icon
+
+The element *icon* is mandatory (for version 2.x, blowfish) and must
+be unique. It must designate an image file with its attribute *src*.
+
+Known widget types and content
+------------------------------
+
+The configuration file ***/etc/afm/afm-launch.conf*** defines the types
+of widget known and how to launch it.
+
+Known types for the type of content are (for version 2.x, blowfish):
+
+- ***text/html***:
+ HTML application,
+ content.src designates the home page of the application
+
+- ***application/x-executable***:
+ Native application,
+ content.src designates the relative path of the binary
+
+- ***application/vnd.agl.url***:
+ Internet url,
+ content.src designates the url to be used
+
+- ***application/vnd.agl.service***:
+ AGL service defined as a binder,
+ content.src designates the directory of provided binders,
+ http content, if any, must be put in the subdirectory ***htdocs*** of the widget
+
+- ***application/vnd.agl.native***:
+ Native application with AGL service defined as a binder,
+ content.src designates the relative path of the binary,
+ bindings, if any must be put in the subdirectory ***lib*** of the widget,
+ http content, if any, must be put in the subdirectory ***htdocs*** of the widget
+
+- ***text/vnd.qt.qml***, ***application/vnd.agl.qml***:
+ QML application,
+ content.src designate the relative path of the QML root,
+ imports must be put in the subdirectory ***imports*** of the widget
+
+- ***application/vnd.agl.qml.hybrid***:
+ QML application with bindings,
+ content.src designate the relative path of the QML root,
+ bindings, if any must be put in the subdirectory ***lib*** of the widget,
+ imports must be put in the subdirectory ***imports*** of the widget
+
+- ***application/vnd.agl.html.hybrid***:
+ HTML application,
+ content.src designates the home page of the application,
+ bindings, if any must be put in the subdirectory ***lib*** of the widget,
+ http content must be put in the subdirectory ***htdocs*** of the widget
+
+
+AGL features
+------------
+
+The AGL framework uses the feature tag for specifying security and binding
+requirement of the widget.
+
+The current version of AGL (up to 2.0.1, blowfish) has no fully implemented
+features.
+
+The features planned to be implemented are described below.
+
+### feature name="urn:AGL:provides-binding"
+
+Use this feature for each provided binding of the widget.
+The parameters are:
+
+#### param name="name"
+
+REQUIRED
+
+The value is the string that must match the binding prefix.
+It must be unique.
+
+#### param name="src"
+
+REQUIRED
+
+The value is the path of the shared library for the binding.
+
+#### param name="type"
+
+REQUIRED
+
+Currently it must be ***application/vnd.agl.binding.v1***.
+
+
+#### param name="scope"
+
+REQUIRED
+
+The value indicate the availability of the binidng:
+
+- private: used only by the widget
+- public: available to allowed clients as a remote service (requires permission+)
+- inline: available to allowed clients inside their binding (unsafe, requires permission+++)
+
+#### param name="needed-binding"
+
+OPTIONAL
+
+The value is a space separated list of binding's names that the binding needs.
+
+### feature name="urn:AGL:required-permissions"
+
+List of the permissions required by the widget.
+
+Each required permission must be explicited using a <param> entry.
+
+#### param name=[required permission name]
+
+The value is either:
+
+- required: the permission is really needed.
+- optional: the permission isn't mandatory
+
+### feature name="urn:AGL:defined-permissions"
+
+Each required permission must be explicited using a <param> entry.
+
+#### param name=[defined permission name]
+
+The value is the level of the defined permission:
+
+- system:
+- platform:
+- partner
+- public:
+
+
+
+
+
+[widgets]: http://www.w3.org/TR/widgets "Packaged Web Apps"
+[widgets-digsig]: http://www.w3.org/TR/widgets-digsig "XML Digital Signatures for Widgets"
+[libxml2]: http://xmlsoft.org/html/index.html "libxml2"
+[app-manifest]: http://www.w3.org/TR/appmanifest "Web App Manifest"
+
diff --git a/src/wgtpkg-install.c b/src/wgtpkg-install.c
index 264606a..7d0c318 100644
--- a/src/wgtpkg-install.c
+++ b/src/wgtpkg-install.c
@@ -56,14 +56,19 @@ static int check_valid_string(const char *value, const char *name)
return -1;
pos = 0;
c = value[pos];
- while(c) {
+ if (c == 0) {
+ ERROR("empty string forbidden in '%s' (temporary constraints)", name);
+ errno = EINVAL;
+ return -1;
+ }
+ do {
if (!isalnum(c) && !strchr(".-_", c)) {
ERROR("forbidden char %c in '%s' -> '%s' (temporary constraints)", c, name, value);
errno = EINVAL;
return -1;
}
c = value[++pos];
- }
+ } while(c);
return 0;
}