Software ubiquitärer Systeme - ess.cs.tu-dortmund.de · IPIP HTTPHTTP TCPTCP. 04.3 – Universal...

Preview:

Citation preview

11

Software ubiquitärer SystemeUniversal Plug and Play

Olaf SpinczykArbeitsgruppe Eingebettete Systemsoftware

Lehrstuhl für Informatik 12TU Dortmund Olaf.Spinczyk@tu-dortmund.dehttp://ess.cs.uni-dortmund.de/~os/

http://ess.cs.tu-dortmund.de/DE/Teaching/SS2012/SuS/

04.3 – Universal Plug and Play 22

Inhalt● Komplexe UbiComp Middleware

● Universal Plug and Play (UPnP)● Anwendungsszenarien

● Struktur

● Grundlegende Protokolle

● Demo● Ausblick zu UPnP● Zusammenfassung

HardwareHardware

BetriebssystemBetriebssystem

MiddlewareMiddleware

DatenhaltungDatenhaltung

Anwendung/ProgrammierungAnwendung/Programmierung

04.3 – Universal Plug and Play 33

Inhalt● Komplexe UbiComp Middleware

● Universal Plug and Play (UPnP)● Anwendungsszenarien

● Struktur

● Grundlegende Protokolle

● Demo● Ausblick zu UPnP● Zusammenfassung

04.3 – Universal Plug and Play 44

Komplexe UbiComp Middleware● Einfache Middleware (letzte VL – OSEK/COM+NM)

● Leichtgewichtig, asynchrone Kommunikation, kontextgewahr

● Knoten erscheinen und verschwinden im laufenden Betrieb

● Voraussetzung: In sich geschlossenes und homogenes Netz- z.B. statische Nummerierung der Knoten für OSEK/NM

● Komplexe Middleware (diese VL – UPnP)

● Unterstützung offener Netze (potentiell auch ad-hoc Netze)● Interoperabilität zwischen Geräten beliebiger Hersteller

● Interoperabilität mit PCs undEinbindung ubiquitärer Systeme in das Internet

● Unabhängigkeit von Programmiersprache,Betriebssystem und Netzwerktyp

➔ Nicht ganz so leichtgewichtig

04.3 – Universal Plug and Play 55

Inhalt● Komplexe UbiComp Middleware

● Universal Plug and Play (UPnP)● Anwendungsszenarien

● Struktur

● Grundlegende Protokolle

● Demo● Ausblick zu UPnP● Zusammenfassung

04.3 – Universal Plug and Play 66

UPnP Forum: http://upnp.org/ ● Gegründet 1999

● Etwa 950 Mitglieder (2011)

● Firmen und Personen aus diversen Ländern

● Definiert und publiziert die für UPnP nötigen Spezifikationen

● Ziel: „Enable the emergence of easily connected devices and to simplify the implementation of networks in the home and corporate environments.“

● UPnP ist die Technologie hinter DLNA● „Digital Living Network Alliance“● Unterstützt von diversen Geräten im Unterhaltungsbereich

04.3 – Universal Plug and Play 77

UPnP: Szenarien [1]● „The new printer“

● Drucker im Heimnetz werdenautomatisch erkannt und könnenumgehend benutzt werden.

● „Out of storage space again“● Mobile Speichermedien (USB-

Platte, Digitale Videokamera)werden automatisch einge-bunden und gesteuert.

● „The master switch“● Diverse Geräte werden auf einmal an oder aus geschaltet, wenn

man z.B. von der Arbeit kommt.

● „It's always freezing when I wake up“● Wecker und Heizung über Skripte steuerbar● Ereignisse können verknüpft werden

● ...

04.3 – Universal Plug and Play 88

UPnP: Strategie (1)● Auschließlich Austausch von Daten (kein Code)

● Minimiert Kompatibiltätsprobleme

● Reduziert Sicherheitsprobleme

● Vereinbarungen bzgl. Bedeutung und Format von Daten● Basis bilden bewährte und verbreitete Protokolle

● Gerätespezifische bzw. dienstspezifische Protokollewerden vom UPnP Forum definiert

● Die Implementierung der Geräte selbst ist privat● UPnP ist unabhängig von Programmiersprache und Betriebssystem

● Ermöglicht Aktualisierung der Implementierung ohne Kommunikationspartner ebenfalls aktualisieren zu müssen

04.3 – Universal Plug and Play 99

UPnP: Strategie (2)● Taktisches Vorgehen

● „Start simple“ → ähnelt dem familienbasierten Systementwurf

- Integration universeller Eigenschaften, die jeder benötigt

- Erweiterungen, wenn Bedarf besteht

● „Minimize requirements“

- Grundlegende Fähigkeiten von IP-Netzwerken

- Ausnutzung des verbreiteten HTTP-Protokollstapels

● „Leverage existing standard“

- HTTP, XML, SOAP

04.3 – Universal Plug and Play 1010

UPnP: Inhalt [2]● Beschreibung der Kommunikationsprotokolle zwischen ...

● Control Point

- Geräte, die Dienste (Services)anderer Geräte nutzen können

● Device

- Geräte, die Dienste bereitstellen

● Tatsächliche Geräte könnenbeide logischen Funktionenbeinhalten

DeviceDeviceDeviceDevice

ServiceServiceServiceService

Control PointControl PointControl PointControl Point

Control PointControl PointControl PointControl Point

DeviceDeviceDeviceDevice

ServiceServiceServiceService

04.3 – Universal Plug and Play 1111

UPnP: Devices● Container für Services und Nested Devices

● Ein Videorekorder könnte z.B. einen Tape-Transport-Service, einen Tuner-Service und einen Clock-Service anbieten.

● Selbstbeschreibend

● Ein XML-Dokument im Device Description Format beschreibt Services und Nested Devices und kann im laufenden Betrieb ausgelesen werden.

- zudem weitere Infos wie Name und Icon

● Zwecks Interoperabilität definiert das UPnP Forum Device-Klassen.

- Internet Gateway Device, Printer Enhanced, MediaServer and MediaRenderer, Quality of Service, Printer Device and Print Basic Service, Basic Device, WLAN Access Point Device, Digital Security Camera, Device Security and Security Console, HVAC, Lighting Controls, Remote UI Client and Server, Scanner (External Activity, Feeder, Scan, Scanner)

04.3 – Universal Plug and Play 1212

UPnP: Services● Kleinste Einheit eines UPnP-Netzes

● Verfügt über einen Zustand (state variables) undZugriffoperationen (actions)● Beim Clock-Service unseres Videorekorders:

- current_time: aktuelle Uhrzeit (state variable)

- set_time, get_time: Zugriffsoperationen (actions)

● Kann Interessenten bei Zustandsänderungen (events) informieren

● Ist selbstbeschreibend● XML Dokument im Service Description Format.

● Ein Zeiger (URL) zu den Service Descriptions befindet sich in der Device Description.

04.3 – Universal Plug and Play 1313

UPnP: Control Points● Haben die Fähigkeit Geräte aufzuspüren und zu steuern.

● Nach dem Aufspüren:● Abfrage der Gerätebeschreibung inkl. der Liste der URLs der

Dienstbeschreibungen.

● Einlesen interessanter Dienstbeschreibungen.

● Verwendung der Actions eines Dienstes, um dessen Zustand zu verändern.

● Eintragen als Abonnent von Ereignissen des Dienstes.

● Den Vorgang des Suchens nach Dienstennennt man auch „Service Discovery“.

04.3 – Universal Plug and Play 1414

UPnP: Struktur

UPnP Enabled Device

UPnP Enabled Device

UPnP Enabled Device

Control Point

Device

Root Device

Embedded Device

Device

Service

Service 2Service 1

Service

Service 2Service 1

Control Point

Service

StateTable

ControlServer

EventServer

04.3 – Universal Plug and Play 1515

Schritte beim UPnP-Networking

0. Control Point und Gerät erhalten eine Adresse1. Control Point spürt interessantes Gerät auf2. Control Point erfährt die Gerätefähigkeiten3. Control Point benutzt die Actions des Geräts4. Control Point wartet auf Zustandsänderungen5. Control Point benutzt die URL einer Konfigurationsseite

und stellt diese dem Benutzer zur Verfügung

0 Addressing0 Addressing

1 Discovery1 Discovery

2 Description2 Description

5 Presentation5 Presentation4 Eventing4 Eventing3 Control3 Control

04.3 – Universal Plug and Play 1616

UPnP: Protokollstapel

UPnP Device ArchitectureUPnP Device ArchitectureUPnP Device ArchitectureUPnP Device Architecture

UDPUDPUDPUDP

IPIPIPIP

HTTPU/MUHTTPU/MUHTTPU/MUHTTPU/MUGENAGENAGENAGENA SSDPSSDPSSDPSSDP SOAPSOAPSOAPSOAP

HTTPHTTPHTTPHTTP

HTTPHTTPHTTPHTTPGENAGENAGENAGENA

TCPTCPTCPTCP

UPnP ForumUPnP ForumUPnP ForumUPnP Forum

UPnP vendorUPnP vendorUPnP vendorUPnP vendor

04.3 – Universal Plug and Play 1717

Schritte beim UPnP-Networking

0. Control Point und Gerät erhalten eine Adresse1. Control Point spürt interessantes Gerät auf2. Control Point erfährt die Gerätefähigkeiten3. Control Point benutzt die Actions des Geräts4. Control Point wartet auf Zustandsänderungen5. Control Point benutzt die URL einer Konfigurationsseite

und stellt diese dem Benutzer zur Verfügung

0* Addressing0* Addressing

1 Discovery1 Discovery

2 Description2 Description

5 Presentation5 Presentation4 Eventing4 Eventing3 Control3 Control

04.3 – Universal Plug and Play 1818

0 Addressing● Control Point und Gerät erhalten eine Adresse

● Entweder mit Hilfe von DHCP

● oder durch Auto-IP

● Was ist Auto-IP?● IETF Draft Automatically Choosing an IP Address

in an Ad-Hoc IPv4 Network

● Microsoft: Automatic Private IP Addressing (APIPA)

● Schritte von Auto-IP● Auswahl einer beliebigen IP-Adresse im 169.254/16 Bereich

● Prüfung, ob diese Adresse bereits in Benutzung ist (ARP)

● Ggf. wiederholen

● Trotzdem periodische DHCP-Anfragen

04.3 – Universal Plug and Play 1919

Schritte beim UPnP-Networking

0. Control Point und Gerät erhalten eine Adresse1. Control Point spürt interessantes Gerät auf2. Control Point erfährt die Gerätefähigkeiten3. Control Point benutzt die Actions des Geräts4. Control Point wartet auf Zustandsänderungen5. Control Point benutzt die URL einer Konfigurationsseite

und stellt diese dem Benutzer zur Verfügung

0 Addressing0 Addressing

1* Discovery1* Discovery

2 Description2 Description

5 Presentation5 Presentation4 Eventing4 Eventing3 Control3 Control

04.3 – Universal Plug and Play 2020

1 Discovery● Control Point findet

interessantes Gerät● 0 Adresse ermitteln

● 1 Gerät erforschen

● Möglichkeit nach Geräte-/Servicetypen zu suchen● Garantierte Minimalfähigkeiten

● Sehr einfaches Protokoll● Geräte

- Machen sich selbst beim Einschalten/Anschließen bekannt.

- Erneuern die Bekanntmachung regelmäßig

- Melden sich ab, wenn sie entfernt werden.

● Control Points- Suchen bei Bedarf

- Geräte antworten

- Control Points filtern passende Geräte heraus

04.3 – Universal Plug and Play 2121

1 Discovery: Protokollstapel

UPnP vendorUPnP vendorUPnP vendorUPnP vendor

UPnP ForumUPnP ForumUPnP ForumUPnP Forum

UPnP Device ArchitectureUPnP Device ArchitectureUPnP Device ArchitectureUPnP Device Architecture

UDPUDPUDPUDP

IPIPIPIP

HTTPMUHTTPMU(multicast)(multicast)

HTTPMUHTTPMU(multicast)(multicast) GENAGENAGENAGENA SSDPSSDPSSDPSSDP HTTPUHTTPU

(unicast)(unicast)HTTPUHTTPU(unicast)(unicast) SSDPSSDPSSDPSSDP

04.3 – Universal Plug and Play 2222

1 Discovery: SSDP● IETF Draft Simple Service Discovery Protocol● Entwurfsprinzipien

● UDP● Nutzung von Multicasts für Suche und Bekanntmachung● Nutzung von Unicasts für Antworten● Sehr einfaches Verfahren

04.3 – Universal Plug and Play 2323

1 Discovery: Bekanntmachung● Wer? Gerät sendet HTTP-Multicast per UDP● Wann? Geräteaktivierung oder -erneuerung● Was?

● 1 mal pro Diensttyp mit NT == Diensttyp● 1 mal pro Gerätetyp mit NT == Gerätetyp● 1 mal pro Gerät mit NT == Geräte-UUID● 1 mal mit NT == upnp:rootdevice

NOTIFY * HTTP/1.1HOST: 239.255.255.250:1900

NOTIFY * HTTP/1.1HOST: 239.255.255.250:1900CACHE-CONTROL: max-age = seconds until advertisement expiresLOCATION: URL for UPnP description for root deviceNT: search targetNTS: ssdp:aliveUSN: advertisement UUID

04.3 – Universal Plug and Play 2424

1 Discovery: Suche● Wer? Control Point sendet Multicast● Wann? Suche nach einem Gerät oder Dienst● Was?

● ST kann Folgendes sein ...- Diensttyp

- Gerätetyp

- Geräte-UUID

- upnp:rootdeviceupnp:rootdevice

- ssdp:allssdp:all

M-SEARCH * HTTP/1.1HOST: 239.255.255.250:1900

M-SEARCH * HTTP/1.1HOST: 239.255.255.250:1900

MAN: "ssdp:discover"MX: seconds to delay responseST: search target

04.3 – Universal Plug and Play 2525

1 Discovery: Antwort● Wer? Gerät antwortet per Unicast● Wann? Wenn ST zum gesuchten NT passt.● Was?

● einmal pro passendem NT

HTTP/1.1 200 OKCACHE-CONTROL: max-age = seconds until advertisement expires

HTTP/1.1 200 OKCACHE-CONTROL: max-age = seconds until advertisement expiresLOCATION: URL for UPnP description for root deviceST: search targetUSN: advertisement UUID

04.3 – Universal Plug and Play 2626

Schritte beim UPnP-Networking

0. Control Point und Gerät erhalten eine Adresse1. Control Point spürt interessantes Gerät auf2. Control Point erfährt die Gerätefähigkeiten3. Control Point benutzt die Actions des Geräts4. Control Point wartet auf Zustandsänderungen5. Control Point benutzt die URL einer Konfigurationsseite

und stellt diese dem Benutzer zur Verfügung

0 Addressing0 Addressing

1 Discovery1 Discovery

2* Description2* Description

5 Presentation5 Presentation4 Eventing4 Eventing3 Control3 Control

04.3 – Universal Plug and Play 2727

2 Description● Control Point erfährt die

Gerätefähigkeiten● 0 Adresse ermitteln● 1 Gerät erforschen

- hole URL der Beschreibung

● 2 Hole Gerätebeschreibung- hole URL der

Dienstbeschreibung

● Gerätefähigkeiten werden zuvor von den Geräten deklariert.

● Protokollstapel

UPnP vendorUPnP vendorUPnP vendorUPnP vendor

UPnP ForumUPnP ForumUPnP ForumUPnP Forum

UPnP Device ArchitectureUPnP Device ArchitectureUPnP Device ArchitectureUPnP Device Architecture

IPIPIPIP

HTTPHTTPHTTPHTTP

TCPTCPTCPTCP

04.3 – Universal Plug and Play 2828

2 Description● Geräte

● Typ● Physikalische Beschreibung

- Hersteller, Modell, ...

● Logische Beschreibung- Für jeden Dienst

- Typ

- URL der Beschreibung

- URL für Steuerung

- URL für Ereignisse

● Benutzerschnittstelle- Icons

- URL für Browser-basierte interaktive Konfigurierung

● Dienste(Funktionseinheiten innerhalb der Geräte)

● Aktionen● Zustandvariablen

● Alle Beschreibungenin XML

● Herstellern ist freigestellt, beliebige Erweiterungen zu implementieren

04.3 – Universal Plug and Play 2929

2 Description: XML● Was ist XML?

● W3C Recommendation Extensible Markup Language● "Universal format for structured documents and data on the Web."

- Feldnamen in <Spitzen Klammern>

- Feldwerte zwischen den Namen

● Definiert 24 Datentypen- ui1, ui2, ui4, i1, i2, i4, int

- r4, r8, number, fixed.14.4, float

- char, string

- date, dateTime, dateTime.tz, time, time.tz

- boolean

- bin.base64, bin.hex

- uri

- uuid

04.3 – Universal Plug and Play 3030

2 Description: Geräte (phys.)

<?xml version="1.0"?><root xmlns="urn:schemas-upnp-org:device-1-0"> <URLBase>base URL for all relative URLs</URLBase>

<device> <friendlyName>short user-friendly title</friendlyName> <manufacturer>manufacturer name</manufacturer> <manufacturerURL>URL to manufacturer site</manufacturerURL> <modelDescription>long user-friendly title</modelDescription> <modelName>model name</modelName> <modelNumber>model number</modelNumber> <modelURL>URL to model site</modelURL> <serialNumber>manufacturer's serial number</serialNumber> <UDN>uuid:UUID</UDN> <UPC>Universal Product Code</UPC> <deviceType>urn:schemas-upnp-org:device:deviceType</deviceType> <serviceList> <service> <serviceType>urn:schemas-upnp-org:service:serviceType:v</serviceType> <serviceId>urn:upnp-org:serviceId:serviceID</serviceId> <SCPDURL>URL to service description</SCPDURL> <controlURL>URL for control</controlURL> <eventSubURL>URL for eventing</eventSubURL> </service> Declarations for other services (if any) go here </serviceList> <deviceList>Description of embedded devices (if any) go here</deviceList> <iconList> <icon> <mimetype>image/format</mimetype> <width>horizontal pixels</width> <height>vertical pixels</height> <depth>color depth</depth> <url>URL to icon</url> </icon> XML to declare other icons, if any, go here </iconList> <presentationURL>URL for presentation</presentationURL>

</device> <specVersion> <major>1</major> <minor>0</minor> </specVersion>

</root>

<?xml version="1.0"?><root xmlns="urn:schemas-upnp-org:device-1-0"> <URLBase>base URL for all relative URLs</URLBase>

<device> <friendlyName>short user-friendly title</friendlyName> <manufacturer>manufacturer name</manufacturer> <manufacturerURL>URL to manufacturer site</manufacturerURL> <modelDescription>long user-friendly title</modelDescription> <modelName>model name</modelName> <modelNumber>model number</modelNumber> <modelURL>URL to model site</modelURL> <serialNumber>manufacturer's serial number</serialNumber> <UDN>uuid:UUID</UDN> <UPC>Universal Product Code</UPC> <deviceType>urn:schemas-upnp-org:device:deviceType</deviceType> <serviceList> <service> <serviceType>urn:schemas-upnp-org:service:serviceType:v</serviceType> <serviceId>urn:upnp-org:serviceId:serviceID</serviceId> <SCPDURL>URL to service description</SCPDURL> <controlURL>URL for control</controlURL> <eventSubURL>URL for eventing</eventSubURL> </service> Declarations for other services (if any) go here </serviceList> <deviceList>Description of embedded devices (if any) go here</deviceList> <iconList> <icon> <mimetype>image/format</mimetype> <width>horizontal pixels</width> <height>vertical pixels</height> <depth>color depth</depth> <url>URL to icon</url> </icon> XML to declare other icons, if any, go here </iconList> <presentationURL>URL for presentation</presentationURL>

</device> <specVersion> <major>1</major> <minor>0</minor> </specVersion>

</root>

04.3 – Universal Plug and Play 3131

2 Description: Geräte (log. Beschr.)<?xml version="1.0"?>

<root xmlns="urn:schemas-upnp-org:device-1-0"> <URLBase>base URL for all relative URLs</URLBase> <device> <friendlyName>short user-friendly title</friendlyName> <manufacturer>manufacturer name</manufacturer> <manufacturerURL>URL to manufacturer site</manufacturerURL> <modelDescription>long user-friendly title</modelDescription> <modelName>model name</modelName> <modelNumber>model number</modelNumber> <modelURL>URL to model site</modelURL> <serialNumber>manufacturer's serial number</serialNumber> <UDN>uuid:UUID</UDN> <UPC>Universal Product Code</UPC>

<deviceType>urn:schemas-upnp-org:device:deviceType :v</deviceType> <serviceList> <service> <serviceType>urn:schemas-upnp-org:service:serviceType:v</serviceType> <serviceId>urn:upnp-org:serviceId:serviceID</serviceId> <SCPDURL>URL to service description</SCPDURL> <controlURL>URL for control</controlURL> <eventSubURL>URL for eventing</eventSubURL> </service> Declarations for other services (if any) go here </serviceList> <deviceList>Description of embedded devices (if any) go here</deviceList> <iconList> <icon> <mimetype>image/format</mimetype> <width>horizontal pixels</width> <height>vertical pixels</height> <depth>color depth</depth> <url>URL to icon</url> </icon> XML to declare other icons, if any, go here </iconList> <presentationURL>URL for presentation</presentationURL>

</device> <specVersion> <major>1</major> <minor>0</minor> </specVersion>

</root>

<?xml version="1.0"?>

<root xmlns="urn:schemas-upnp-org:device-1-0"> <URLBase>base URL for all relative URLs</URLBase> <device> <friendlyName>short user-friendly title</friendlyName> <manufacturer>manufacturer name</manufacturer> <manufacturerURL>URL to manufacturer site</manufacturerURL> <modelDescription>long user-friendly title</modelDescription> <modelName>model name</modelName> <modelNumber>model number</modelNumber> <modelURL>URL to model site</modelURL> <serialNumber>manufacturer's serial number</serialNumber> <UDN>uuid:UUID</UDN> <UPC>Universal Product Code</UPC>

<deviceType>urn:schemas-upnp-org:device:deviceType :v</deviceType> <serviceList> <service> <serviceType>urn:schemas-upnp-org:service:serviceType:v</serviceType> <serviceId>urn:upnp-org:serviceId:serviceID</serviceId> <SCPDURL>URL to service description</SCPDURL> <controlURL>URL for control</controlURL> <eventSubURL>URL for eventing</eventSubURL> </service> Declarations for other services (if any) go here </serviceList> <deviceList>Description of embedded devices (if any) go here</deviceList> <iconList> <icon> <mimetype>image/format</mimetype> <width>horizontal pixels</width> <height>vertical pixels</height> <depth>color depth</depth> <url>URL to icon</url> </icon> XML to declare other icons, if any, go here </iconList> <presentationURL>URL for presentation</presentationURL>

</device> <specVersion> <major>1</major> <minor>0</minor> </specVersion>

</root>

04.3 – Universal Plug and Play 3232

2 Description: Geräte (Benutzerschn.)<?xml version="1.0"?>

<root xmlns="urn:schemas-upnp-org:device-1-0"> <URLBase>base URL for all relative URLs</URLBase>

<device> <friendlyName>short user-friendly title</friendlyName> <manufacturer>manufacturer name</manufacturer> <manufacturerURL>URL to manufacturer site</manufacturerURL> <modelDescription>long user-friendly title</modelDescription> <modelName>model name</modelName> <modelNumber>model number</modelNumber> <modelURL>URL to model site</modelURL> <serialNumber>manufacturer's serial number</serialNumber> <UDN>uuid:UUID</UDN> <UPC>Universal Product Code</UPC> <deviceType>urn:schemas-upnp-org:device:deviceType</deviceType> <serviceList> <service> <serviceType>urn:schemas-upnp-org:service:serviceType:v</serviceType> <serviceId>urn:upnp-org:serviceId:serviceID</serviceId> <SCPDURL>URL to service description</SCPDURL> <controlURL>URL for control</controlURL> <eventSubURL>URL for eventing</eventSubURL> </service> Declarations for other services (if any) go here </serviceList> <deviceList>Description of embedded devices (if any) go here</deviceList>

<iconList> <icon> <mimetype>image/format</mimetype> <width>horizontal pixels</width> <height>vertical pixels</height> <depth>color depth</depth> <url>URL to icon</url> </icon> XML to declare other icons, if any, go here </iconList> <presentationURL>URL for presentation</presentationURL> </device> <specVersion> <major>1</major> <minor>0</minor> </specVersion></root>

<?xml version="1.0"?>

<root xmlns="urn:schemas-upnp-org:device-1-0"> <URLBase>base URL for all relative URLs</URLBase>

<device> <friendlyName>short user-friendly title</friendlyName> <manufacturer>manufacturer name</manufacturer> <manufacturerURL>URL to manufacturer site</manufacturerURL> <modelDescription>long user-friendly title</modelDescription> <modelName>model name</modelName> <modelNumber>model number</modelNumber> <modelURL>URL to model site</modelURL> <serialNumber>manufacturer's serial number</serialNumber> <UDN>uuid:UUID</UDN> <UPC>Universal Product Code</UPC> <deviceType>urn:schemas-upnp-org:device:deviceType</deviceType> <serviceList> <service> <serviceType>urn:schemas-upnp-org:service:serviceType:v</serviceType> <serviceId>urn:upnp-org:serviceId:serviceID</serviceId> <SCPDURL>URL to service description</SCPDURL> <controlURL>URL for control</controlURL> <eventSubURL>URL for eventing</eventSubURL> </service> Declarations for other services (if any) go here </serviceList> <deviceList>Description of embedded devices (if any) go here</deviceList>

<iconList> <icon> <mimetype>image/format</mimetype> <width>horizontal pixels</width> <height>vertical pixels</height> <depth>color depth</depth> <url>URL to icon</url> </icon> XML to declare other icons, if any, go here </iconList> <presentationURL>URL for presentation</presentationURL> </device> <specVersion> <major>1</major> <minor>0</minor> </specVersion></root>

04.3 – Universal Plug and Play 3333

2 Description: Dienst (Aktionen)

<?xml version="1.0"?><scpd xmlns="urn:schemas-upnp-org:service-1-0"> <actionList> <action> <name>actionName</name> <argumentList> <argument> <name>formalParameterName</name> <direction>in xor out</direction> <retval /> <relatedStateVariable>stateVariableName</relatedStateVariable> </argument> Declarations for other arguments (if any) go here </argumentList> </action> Declarations for other actions (if any) go here </actionList> <serviceStateTable> <stateVariable sendEvents=“yes” xor “no”> <name>variableName</name> <dataType>variable datatype</dataType> <defaultValue>default value</defaultValue> <allowedValueRange> <minimum>minimum value</minimum> <maximum>maximum value</maximum> <step>increment value</step> </allowedValueRange> </stateVariable> <stateVariable sendEvents=“yes” xor “no”> <name>variableName</name> <dataType>variable data type</dataType> <defaultValue>default value</defaultValue> <allowedValueList> <allowedValue>some value</allowedValue> <allowedValue>some value</allowedValue> </allowedValueList> </stateVariable> Declarations for other state variables (if any) go here </serviceStateTable> <specVersion> <major>1</major> <minor>0</minor> </specVersion>

</scpd>

<?xml version="1.0"?><scpd xmlns="urn:schemas-upnp-org:service-1-0"> <actionList> <action> <name>actionName</name> <argumentList> <argument> <name>formalParameterName</name> <direction>in xor out</direction> <retval /> <relatedStateVariable>stateVariableName</relatedStateVariable> </argument> Declarations for other arguments (if any) go here </argumentList> </action> Declarations for other actions (if any) go here </actionList> <serviceStateTable> <stateVariable sendEvents=“yes” xor “no”> <name>variableName</name> <dataType>variable datatype</dataType> <defaultValue>default value</defaultValue> <allowedValueRange> <minimum>minimum value</minimum> <maximum>maximum value</maximum> <step>increment value</step> </allowedValueRange> </stateVariable> <stateVariable sendEvents=“yes” xor “no”> <name>variableName</name> <dataType>variable data type</dataType> <defaultValue>default value</defaultValue> <allowedValueList> <allowedValue>some value</allowedValue> <allowedValue>some value</allowedValue> </allowedValueList> </stateVariable> Declarations for other state variables (if any) go here </serviceStateTable> <specVersion> <major>1</major> <minor>0</minor> </specVersion>

</scpd>

04.3 – Universal Plug and Play 3434

2 Description: Dienst (Variablen)

<?xml version="1.0"?><scpd xmlns="urn:schemas-upnp-org:service-1-0"> <actionList> <action> <name>actionName</name> <argumentList> <argument> <name>formalParameterName</name> <direction>in xor out</direction> <retval /> <relatedStateVariable>stateVariableName</relatedStateVariable> </argument> Declarations for other arguments (if any) go here </argumentList> </action> Declarations for other actions (if any) go here </actionList>

<serviceStateTable> <stateVariable sendEvents=“yes” xor “no”> <name>variableName</name> <dataType>variable datatype</dataType> <defaultValue>default value</defaultValue> <allowedValueRange> <minimum>minimum value</minimum> <maximum>maximum value</maximum> <step>increment value</step> </allowedValueRange> </stateVariable> <stateVariable sendEvents=“yes” xor “no”> <name>variableName</name> <dataType>variable data type</dataType> <defaultValue>default value</defaultValue> <allowedValueList> <allowedValue>some value</allowedValue> <allowedValue>some value</allowedValue> </allowedValueList> </stateVariable> Declarations for other state variables (if any) go here

</serviceStateTable> <specVersion> <major>1</major> <minor>0</minor> </specVersion>

</scpd>

<?xml version="1.0"?><scpd xmlns="urn:schemas-upnp-org:service-1-0"> <actionList> <action> <name>actionName</name> <argumentList> <argument> <name>formalParameterName</name> <direction>in xor out</direction> <retval /> <relatedStateVariable>stateVariableName</relatedStateVariable> </argument> Declarations for other arguments (if any) go here </argumentList> </action> Declarations for other actions (if any) go here </actionList>

<serviceStateTable> <stateVariable sendEvents=“yes” xor “no”> <name>variableName</name> <dataType>variable datatype</dataType> <defaultValue>default value</defaultValue> <allowedValueRange> <minimum>minimum value</minimum> <maximum>maximum value</maximum> <step>increment value</step> </allowedValueRange> </stateVariable> <stateVariable sendEvents=“yes” xor “no”> <name>variableName</name> <dataType>variable data type</dataType> <defaultValue>default value</defaultValue> <allowedValueList> <allowedValue>some value</allowedValue> <allowedValue>some value</allowedValue> </allowedValueList> </stateVariable> Declarations for other state variables (if any) go here

</serviceStateTable> <specVersion> <major>1</major> <minor>0</minor> </specVersion>

</scpd>

04.3 – Universal Plug and Play 3535

2 Description: Dienst (Variablen)

<?xml version="1.0"?><scpd xmlns="urn:schemas-upnp-org:service-1-0"> <actionList> <action> <name>actionName</name> <argumentList> <argument> <name>formalParameterName</name> <direction>in xor out</direction> <retval /> <relatedStateVariable>stateVariableName</relatedStateVariable> </argument> Declarations for other arguments (if any) go here </argumentList> </action> Declarations for other actions (if any) go here </actionList>

<serviceStateTable> <stateVariable sendEvents=“yes” xor “no”> <name>variableName</name> <dataType>variable datatype</dataType> <defaultValue>default value</defaultValue> <allowedValueRange> <minimum>minimum value</minimum> <maximum>maximum value</maximum> <step>increment value</step> </allowedValueRange> </stateVariable>

<stateVariable sendEvents=“yes” xor “no”> <name>variableName</name> <dataType>variable data type</dataType> <defaultValue>default value</defaultValue> <allowedValueList> <allowedValue>some value</allowedValue> <allowedValue>some value</allowedValue> </allowedValueList> </stateVariable> Declarations for other state variables (if any) go here </serviceStateTable> <specVersion> <major>1</major> <minor>0</minor> </specVersion>

</scpd>

<?xml version="1.0"?><scpd xmlns="urn:schemas-upnp-org:service-1-0"> <actionList> <action> <name>actionName</name> <argumentList> <argument> <name>formalParameterName</name> <direction>in xor out</direction> <retval /> <relatedStateVariable>stateVariableName</relatedStateVariable> </argument> Declarations for other arguments (if any) go here </argumentList> </action> Declarations for other actions (if any) go here </actionList>

<serviceStateTable> <stateVariable sendEvents=“yes” xor “no”> <name>variableName</name> <dataType>variable datatype</dataType> <defaultValue>default value</defaultValue> <allowedValueRange> <minimum>minimum value</minimum> <maximum>maximum value</maximum> <step>increment value</step> </allowedValueRange> </stateVariable>

<stateVariable sendEvents=“yes” xor “no”> <name>variableName</name> <dataType>variable data type</dataType> <defaultValue>default value</defaultValue> <allowedValueList> <allowedValue>some value</allowedValue> <allowedValue>some value</allowedValue> </allowedValueList> </stateVariable> Declarations for other state variables (if any) go here </serviceStateTable> <specVersion> <major>1</major> <minor>0</minor> </specVersion>

</scpd>

04.3 – Universal Plug and Play 3636

Schritte beim UPnP-Networking

0. Control Point und Gerät erhalten eine Adresse1. Control Point spürt interessantes Gerät auf2. Control Point erfährt die Gerätefähigkeiten3. Control Point benutzt die Actions des Geräts4. Control Point wartet auf Zustandsänderungen5. Control Point benutzt die URL einer Konfigurationsseite

und stellt diese dem Benutzer zur Verfügung

0 Addressing0 Addressing

1 Discovery1 Discovery

2 Description2 Description

5 Presentation5 Presentation4 Eventing4 Eventing3* Control3* Control

04.3 – Universal Plug and Play 3737

3 Control● Control Point benutzt die

Actions des Geräts● 0 Adresse ermitteln

● 1 Gerät erforschen

● 2 Hole Gerätebeschreibung

- hole URL der Dienstbeschreibung

● 3 Sende Actions an das Gerät

● Protokollstapel

UPnP vendorUPnP vendorUPnP vendorUPnP vendor

UPnP ForumUPnP ForumUPnP ForumUPnP Forum

UPnP Device ArchitectureUPnP Device ArchitectureUPnP Device ArchitectureUPnP Device Architecture

IPIPIPIP

SOAPSOAPSOAPSOAP

HTTPHTTPHTTPHTTP

TCPTCPTCPTCP

04.3 – Universal Plug and Play 3838

3 Control: SOAP● Was ist SOAP?

● IETF Draft Simple Object Access Protocol

● "Lightweight, XML-based protocol for exchange of information in a decentralized, distributed environment."

- Definiert einer Rahmen für XML-Nachrichten (Envelope)

- Wird insbesondere für XML-basierte RPCs benutzt.

04.3 – Universal Plug and Play 3939

3 Control: Action aufrufen● Wer? Control Point● Wann? Um eine Action eines Geräts aufzurufen● Was?

POST path of control URL HTTP/1.1HOST: host of control URL:port of control URLCONTENT-TYPE: text/xml; charset="utf-8"SOAPACTION: "urn:schemas-upnp-org:service:serviceType:v#actionName"

POST path of control URL HTTP/1.1HOST: host of control URL:port of control URLCONTENT-TYPE: text/xml; charset="utf-8"SOAPACTION: "urn:schemas-upnp-org:service:serviceType:v#actionName"

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <s:Body>

</s:Body></s:Envelope>

<u:actionName xmlns:u="urn:schemas-upnp-org:service:serviceType:v"> <argumentName>in arg value</argumentName> other in args and their values (if any) go here </u:actionName>

04.3 – Universal Plug and Play 4040

3 Control: Action Resultat● Wer? Gerät● Wann? Action durchgeführt● Was?

HTTP/1.1 200 OKCONTENT-TYPE: text/xml; charset="utf-8"

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <s:Body>

</s:Body></s:Envelope>

HTTP/1.1 200 OKCONTENT-TYPE: text/xml; charset="utf-8"

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <s:Body>

</s:Body></s:Envelope>

<u:actionNameResponse xmlns:u="urn:schemas-upnp-org:service:serviceType:v"> <argumentName>out arg value</argumentName> other out args and their values (if any) go here </u:actionNameResponse>

04.3 – Universal Plug and Play 4141

Schritte beim UPnP-Networking

0. Control Point und Gerät erhalten eine Adresse1. Control Point spürt interessantes Gerät auf2. Control Point erfährt die Gerätefähigkeiten3. Control Point benutzt die Actions des Geräts4. Control Point wartet auf Zustandsänderungen5. Control Point benutzt die URL einer Konfigurationsseite

und stellt diese dem Benutzer zur Verfügung

0 Addressing0 Addressing

1 Discovery1 Discovery

2 Description2 Description

5 Presentation5 Presentation4* Eventing4* Eventing3 Control3 Control

04.3 – Universal Plug and Play 4242

4 Eventing● Control Point wartet auf

Zustandsänderungen● 0 Adresse ermitteln● 1 Gerät erforschen● 2 Hole Gerätebeschreibung

- hole URL der Dienstbeschreibung

● 4 Abonniere Ereignisse des Geräts

● Einfaches „Push Model“

● Protokollstapel

UPnP vendorUPnP vendorUPnP vendorUPnP vendor

UPnP ForumUPnP ForumUPnP ForumUPnP Forum

UPnP Device ArchitectureUPnP Device ArchitectureUPnP Device ArchitectureUPnP Device Architecture

IPIPIPIP

HTTPHTTPHTTPHTTPGENAGENAGENAGENA

TCPTCPTCPTCP

04.3 – Universal Plug and Play 4343

4 Eventing: GENA● Was ist GENA?

● IETF Draft General Event Notification Architecture● "Send and receive notifications using HTTP over TCP/IP and

administratively-scoped multicast UDP."- SUBSCRIBE

- Sich als Abonnent registrieren

- UNSUBSCRIBE- Sich abmelden

- NOTIFY- Signalisierung einer Geräteverfügbarkeit

- Signalisierung einer Zustandsänderung

● Das Publisher/Subscriber-Modell ist generell für ubiquitäre Systeme vorteilhaft, da eine lose Kopplung von Sender und Empfänger erreicht wird.● Das klassische Client/Server-Modell führt zu einer engen Kopplung.

04.3 – Universal Plug and Play 4444

4 Eventing: Abonnieren (subscribing)● Wer? Control Point● Wann? Voraussetzung für den Empfang von Ereignissen● Was?

SUBSCRIBE publisher path HTTP/1.1HOST: publisher host:publisher portSUBSCRIBE publisher path HTTP/1.1HOST: publisher host:publisher portCALLBACK: <delivery URL>NT: upnp:eventTIMEOUT: Second-requested subscription duration

04.3 – Universal Plug and Play 4545

4 Eventing: Abonnement akzeptiert● Wer? Gerät● Wann? Abonnement wird akzeptiert● Was?

● Das Gerät antwortet sofort mit einem speziellen initialen Event, das die Werte aller beobachteten Variablen enthält.

HTTP/1.1 200 OKSID: uuid:subscription-UUID TIMEOUT: Second-actual subscription duration

HTTP/1.1 200 OKSID: uuid:subscription-UUID TIMEOUT: Second-actual subscription duration

04.3 – Universal Plug and Play 4646

4 Eventing: Benachrichtigung (notify)● Wer? Das Gerät● Wann? Eine Zustandsvariable wurde geändert.● Was?

NOTIFY delivery path HTTP/1.1HOST: delivery host:delivery portCONTENT-TYPE: text/xml

NOTIFY delivery path HTTP/1.1HOST: delivery host:delivery portCONTENT-TYPE: text/xmlNT: upnp:eventNTS: upnp:propchangeSID: uuid:subscription-UUIDSEQ: event key

<e:propertyset xmlns:e="urn:schemas-upnp-org:event-1-0"> <e:property> <variableName>new value</variableName> </e:property> Other variable names and values (if any) go here</e:propertyset>

04.3 – Universal Plug and Play 4747

Schritte beim UPnP-Networking

0. Control Point und Gerät erhalten eine Adresse1. Control Point spürt interessantes Gerät auf2. Control Point erfährt die Gerätefähigkeiten3. Control Point benutzt die Actions des Geräts4. Control Point wartet auf Zustandsänderungen5. Control Point benutzt die URL einer Konfigurationsseite

und stellt diese dem Benutzer zur Verfügung

0 Addressing0 Addressing

1 Discovery1 Discovery

2 Description2 Description

5* Presentation5* Presentation4 Eventing4 Eventing3 Control3 Control

04.3 – Universal Plug and Play 4848

5 Presentation● Control Point benutzt die

URL einer Konfigurations-seite und stellt diese dem Benutzer zur Verfügung● 0 Adresse ermitteln● 1 Gerät erforschen● 2 Hole Gerätebeschreibung

- hole URL der Dienstbeschreibung

● 5 Lade Präsentationsseite

● Mehr ist hier nicht festgelegt, um die Hersteller nicht einzuschränken

● Protokollstapel

UPnP vendorUPnP vendorUPnP vendorUPnP vendor

UPnP Device ArchitectureUPnP Device ArchitectureUPnP Device ArchitectureUPnP Device Architecture

IPIPIPIP

HTTPHTTPHTTPHTTP

TCPTCPTCPTCP

04.3 – Universal Plug and Play 4949

Inhalt● Komplexe UbiComp Middleware

● Universal Plug and Play (UPnP)● Anwendungsszenarien

● Struktur

● Grundlegende Protokolle

● Demo● Ausblick zu UPnP● Zusammenfassung

04.3 – Universal Plug and Play 5050

Inhalt● Komplexe UbiComp Middleware

● Universal Plug and Play (UPnP)● Anwendungsszenarien

● Struktur

● Grundlegende Protokolle

● Demo● Ausblick zu UPnP● Zusammenfassung

04.3 – Universal Plug and Play 5151

UPnP Nachfolger: DPWS(„Device Profile for Web Services“)

● Verfolgt zusätzlich folgende Ziele:

● Nutzung von Web Service-Technologien

- Services werden mittels WSDL beschrieben

● Integration von ubiquitären Geräten in Geschäftsprozesse

● Erhöhte Sicherheit

● DPWS wurde von Microsoft vorgeschlagen (2004)

● und in Windows Vista und Windows Embedded implementiert

04.3 – Universal Plug and Play 5252

Inhalt● Komplexe UbiComp Middleware

● Universal Plug and Play (UPnP)● Anwendungsszenarien

● Struktur

● Grundlegende Protokolle

● Demo● Ausblick zu UPnP● Zusammenfassung

04.3 – Universal Plug and Play 5353

Zusammenfassung: UPnP ...● ist eine komplexe Middleware für ubiquitäre Systeme

● unterstützt …● die Suche nach Diensten im Netz (Service Discovery)

● die Beschreibung von Geräten und Diensten mittels XML

● die Steuerung von Diensten durch Actions (mittels SOAP)

● das Abonnieren von Ereignissen (mittels GENA)

● ist programmiersprachen- und betriebssystemunabhängig

● hat einen vergleichsweise hohen Ressourcenverbrauch● benutzt diverse Internet-Protokolle

● basiert auf XML als Standardaustauschformat und SOAP

● adressierte anfangs nicht das Thema Sicherheit

04.3 – Universal Plug and Play 5454

Literatur[1] Microsoft Corporation, White Paper: Understanding Universal

Plug and Play, 06/2000.[2] UPnP Forum, UPnP Device Architecture 1.0, 2003.

Recommended