[Kde-hardware-devel] UPnP support in KDE

Fabrizio Montesi fmontesi at italianasoftware.com
Sun Aug 24 15:11:13 CEST 2008


On Sunday 24 August 2008 01:49:10 Armijn Hemel wrote:
> On Sun, 2008-08-24 at 01:34 +0200, Fabrizio Montesi wrote:
> > > 1) The possibility to use JOLIE also for the UPnP stuff. After all
> >
> > it's
> >
> > > more or less a protocol which allows to expose services on the
> >
> > network.
> >
> > > JOLIE deals just fine with other protocols of this kind, it would
> >
> > really
> >
> > > only be a matter of adding the support for yet another protocol to
> >
> > JOLIE
> >
> > > (epsilon how to handle the devices quirks).
> >
> > /me hears the magic word and jumps into the discussion ;)
> >
> > After a fast look the UPnP specs look like a set of mixes of http,
> > soap and
> > xml to handle its different tasks (discovery, control, etc.).
> HTTP-U (HTTP over UDP) is used for sending announcements to a multicast
> address and to devices, SOAP is used for sending control packets, HTTP
> is used for sending subscriptions and unsubscriptions and HTTP is also
> used for receiving state changes. It is quite a mix of protocols :-)
So, a typical workflow would be like the following:
1 - look for available services;
2 - select the service you want;
3 - invoke actions on that service;
4 - optional: keep an eye for state changes from that service.

Right?

That would translate in the following JOLIE pseudo-code (example):
// Set the search parameters, like "I want a device supporting the full IGD 
profile"
searchParams = ...;
// Give me all the IGD services available. Discoverer is a service that will 
use HTTP-U
getAvailableServices at Discoverer( searchParams )( result );
// Use the first one found
IGD << result.service[0];
// Call actions
GetTotalBytesSent at IGD()( bytes )

> >  As such, it would
> > be possible to reuse a lot of code from the HTTP, HTTP/XML and
> > HTTP/SOAP
> > implementations already present in JOLIE.
> > Protocol quirk fixes are not new to JOLIE (HTTP hell ...), either.
>
> Things I have found so far is that certain devices will only accept SOAP
> if the XML namespaces are the same as in Windows XP/Vista, that certain
> parameters have to have content (and where a single space will not
> suffice), and so on (I am trying to document it).
>
> Can you set that stuff in JOLIE?

Yes, JOLIE protocols support a range of parameters (which we can extend 
without problems) in order to deal with such fine tunings. These parameters can 
be applied per-conversation (like "use always this SOAP namespace when i 
communicate with this service") or per-message (like "use this SOAP namespace 
in this particular message exchange).
The parameters can be read/written both in the JOLIE code or in the protocol 
Java implementation, so what we need to decide is:

1 - Do we solve these quirks in the protocol implementation?
2 - Do we solve these quirks in the JOLIE program?

The first option would mean that the JOLIE programmer using UPnP doesn't need 
to care about said quirks, which is good. Intuitively, it is the way to go, 
considering that in case a programmer would need to use a device unsupported 
by our "protocol quirk fixes" he/she could still set the necessary parameters 
from the JOLIE code.


More information about the Kde-hardware-devel mailing list