From 1e9bd1f86f6f1a575abeb9a09dc03bccad57d228 Mon Sep 17 00:00:00 2001
From: Jan Huwald 
Date: Wed, 4 Apr 2012 16:45:16 +0000
Subject: doc: add services.org (proposal)
diff --git a/doc/services.org b/doc/services.org
new file mode 100644
index 0000000..e5e6d7d
--- /dev/null
+++ b/doc/services.org
@@ -0,0 +1,49 @@
+Services offered by users are to be discovered automatically and
+offered to all users of the mesh. For vendor independence several
+means of discovery and announcement are required. They are connected
+by the unified information storage.
+
+* Service information storage
+  Every mesh node holds a p2ptl (see overview.org) of all currently
+  available services. It is synchronized over the mesh interface.
+
+  It has the following columns (in-order):
+    * location (unique primary key) :: protocol-specific identifier
+        how to reach the resource (e.g. "1.2.3.4:22" for SSH,
+        "https://1.2.3.4/pron" for HTTP, "//lame/os" for SMB, ...)
+    * expiry time :: unix time after which the entry shall be deleted
+    * source :: how the service has been discovered: manual, portscan,
+        dnssd, ssdp
+    * class :: one of storage, internet, game, stream, search, ... to
+        be extended and refined
+    * description :: a human-readable (and typically human-written)
+        description of the service, e.g. "Toms pr0n archive"
+
+  Additional class-specific columns may follow that give
+  machine-readable information about the service:
+** storage
+   * capacity :: no. of bytes or empty if unknown
+   * used_capacity :: no. of bytes or empty if unknown
+   * writable :: true|false
+** internet
+   * external ip ::
+   * upstream :: no. of bytes/second or empty if unknown
+   * downstream :: no. of bytes/second or empty if unknown
+** game
+   * active players :: no. of players or empty if unknown
+** stream
+   none
+** search
+   none
+
+* Service discovery
+** manual Webif entry
+** Port scanning
+** DNS-SD (Zeroconf)
+** SSDP (UPNP)
+* Service announcement
+** Web interface
+** DNS
+   Zeroconf uses the domain advertised via DHCP to lookup local
+   services via DNS in the same way it uses mDNS (see [[http://www.dns-sd.org/ServerStaticSetup.html][HowTo]]). Our
+   service database could thus be announced via DNS for these clients.
-- 
cgit v0.10.1
From 0985bba70a9c5ac55059fe5b74da636a263939d8 Mon Sep 17 00:00:00 2001
From: Jan Huwald 
Date: Wed, 4 Apr 2012 16:47:01 +0000
Subject: doc: add service example p2ptbl
copy this file to node:/tmp/p2ptbl/services to use it as test data.
diff --git a/doc/services.p2ptbl-example b/doc/services.p2ptbl-example
new file mode 100644
index 0000000..668e656
--- /dev/null
+++ b/doc/services.p2ptbl-example
@@ -0,0 +1,6 @@
+ftp://1.2.3.4/	0	2666921306	manual	storage	Hus pr0n	28635863487	34564836	true
+ftp://1.2.3.5/	0	2666921306	manual	storage	klaut_storage	38635863487	204564836
+smb://lame/os/	0	2666921306	manual	storage		38635863487		false
+inet://1.2.3.6	0	2666921306	manual	internet		4.3.2.1	23847	38686
+freeciv://1.2.3.4	0	2666921306	manual	game		12
+quake3://1.2.3.4	0	2666921306	manual	game		11
-- 
cgit v0.10.1
From 65059b17dbd62fccd600599e4f288737bb477a48 Mon Sep 17 00:00:00 2001
From: Jan Huwald 
Date: Wed, 4 Apr 2012 16:49:36 +0000
Subject: www: add services.json
Returns a copy of the services p2ptbl in JSON format.
diff --git a/files/common/www/service/cgi-bin/services.json b/files/common/www/service/cgi-bin/services.json
new file mode 100755
index 0000000..3350efc
--- /dev/null
+++ b/files/common/www/service/cgi-bin/services.json
@@ -0,0 +1,23 @@
+#!/bin/sh -e
+
+. /www/service/cgi-bin/common.sh
+
+echo -e 'Status: 200 OK\r
+Content-Type: application/json\r
+\r
+['
+
+p2ptbl show /tmp/p2ptbl/service \
+       | sed '
+s/^/{"url": "/
+s/\t/", "expire": "/
+s/\t/", "source": "/
+s/\t/", "class": "/
+s/\t/", "desc": "/
+s/\t/", "custom1": "/
+s/\t/", "custom2": "/
+s/\t/", "custom3": "/
+s/$/"},/
+$s/,$//'
+
+echo ']'
-- 
cgit v0.10.1
From befa92c62e739a4b425c17fa4278a4f37fdfcc8d Mon Sep 17 00:00:00 2001
From: Jan Huwald 
Date: Wed, 4 Apr 2012 16:51:48 +0000
Subject: webif: add service listing
Add two service lists:
- the index page has a short list with one item per service class
- the service page lists and links all services in full detail
diff --git a/files/common/www/service/index.html b/files/common/www/service/index.html
index 3c4f14a..7d99224 100644
--- a/files/common/www/service/index.html
+++ b/files/common/www/service/index.html
@@ -53,15 +53,9 @@
       
        Lokale Dienste in
       dieser Wolke:
-	
+	
       
+      
     
     
     
@@ -112,12 +106,22 @@
 
 
 
+