40
UPnP Device Architecture

UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

Embed Size (px)

Citation preview

Page 1: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

UPnP Device ArchitectureUPnP Device Architecture

Page 2: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

Networking is easy, except…Networking is easy, except…Ad hoc networks don't have

resources just for the sake of the networkE.g., DHCP, DNS, directory, …

Network is unreliableNodes added / removed unpredictably

Programs need to talk to programsBut software is heterogeneousOne size doesn't fit all

Must upgrade system piece at a time

Page 3: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

UPnP StrategyUPnP Strategy1. Just send data over the network

(No executables) Minimize version issues Minimize security issues

2. Keep implementation private Be agnostic re: programming language, OS Update implementation w/o affecting interop

Improve performance Reduce footprint Improve capabilities

3. Agree on meaning / format of data Choose substrate of proven protocols Define device (service) specific protocols in a

Forum

Page 4: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

UPnP TacticsUPnP TacticsStart simple

Build in only universal things that everybody needs (and can live with)

Add as neededMinimize requirements

Basic IP network connectivityCommon HTTP protocol stack

Leverage existing standardsHTTP, XML

Page 5: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

GoalsGoalsDescribe the protocols for

communication betweenControl points

Controller, usually clientDevice

Controlled,usually server

An actual devicemight containboth functions

DeviceDeviceDeviceDevice

ServiceServiceServiceService

Control PointControl PointControl PointControl Point

Control PointControl PointControl PointControl Point

DeviceDeviceDeviceDevice

ServiceServiceServiceService

Page 6: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

Steps to UPnP NetworkingSteps to UPnP Networking

0 Control point and device get addresses

1 Control point finds interesting device

2 Control point learns about device capabilities

3 Control point invokes actions on device

4 Control point listens to state changes of device

5 Control point controls device and/or views device status using HTML UI

0 Addressing0 Addressing

1 Discovery1 Discovery

2 Description2 Description

5 Presentation5 Presentation4 Eventing4 Eventing3 Control3 Control

Page 7: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

Vendor-specific API above

Vendor-specific OS below

UPnP Protocol StackUPnP Protocol Stack

Ven

do

r-sp

ecif

ic p

hys

ical

net

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

Page 8: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

Steps to UPnP NetworkingSteps to UPnP Networking

0* Control point and device get addresses

1 Control point finds interesting device

2 Control point learns about device capabilities

3 Control point invokes actions on device

4 Control point listens to state changes of device

5 Control point controls device and/or views device status using HTML UI

0* Addressing0* Addressing

1 Discovery1 Discovery

2 Description2 Description

5 Presentation5 Presentation4 Eventing4 Eventing3 Control3 Control

Page 9: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

0 Addressing0 AddressingControl point and device get address

Use a DHCP serverElse use Auto IP

What is Auto IP?IETF Draft Automatically Choosing an IP

Address in an Ad-Hoc IPv4 NetworkWhat steps does it take?

Pick an address in 169.254/16 rangeCheck to see if it is used (ARP)Periodically check for DHCP server

Page 10: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

Steps to UPnP NetworkingSteps to UPnP Networking

0 Control point and device get addresses

1* Control point finds interesting device

2 Control point learns about device capabilities

3 Control point invokes actions on device

4 Control point listens to state changes of device

5 Control point controls device and/or views device status using HTML UI

0 Addressing0 Addressing

1* Discovery1* Discovery

2 Description2 Description

5 Presentation5 Presentation4 Eventing4 Eventing3 Control3 Control

Page 11: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

1 Discovery1 Discovery Control point

finds interesting device

0 get address 1 discover device

Advertise / find typed devices (services)

Guarantee of minimal capabilities

Simple

DevicesAdvertise when

addedRefresh

advertisements (cf. lease)

Cancel advertisements when removed

Control points search as needed

Devices respondControl points

filter

Page 12: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

1 Discovery: Protocol Stack1 Discovery: Protocol Stack

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

Page 13: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

1 Discovery: SSDP Sidebar1 Discovery: SSDP SidebarWhat is SSDP?

IETF Draft Simple Service Discovery Protocol

Key design principlesAdministratively-scoped multicastUnicast responsesUDPVery simple advertisementsVery simple search

Page 14: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

1 Discovery: Advertising1 Discovery: Advertising Who? Device multicasts When? Added or refresh (cf. lease) What?

1 time / service type with NT == service type 1 time / device type with NT == device type 1 time / device with NT == device UUID 1 time with NT == upnp:rootdeviceupnp: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

Page 15: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

1 Discovery: Searching1 Discovery: Searching Who? Control point multicasts When? Looking for device or service What?

ST one of Service type Device type Device 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:1900MAN: "ssdp:discover"MX: seconds to delay responseST: search target

Page 16: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

1 Discovery: Responding1 Discovery: RespondingWho? Device unicastsWhen? If ST matches an NTWhat?

1 time for each NT that matches

Very simple matching

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

Page 17: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

Steps to UPnP NetworkingSteps to UPnP Networking

0 Control point and device get addresses

1 Control point finds interesting device

2* Control point learns about device capabilities

3 Control point invokes actions on device

4 Control point listens to state changes of device

5 Control point controls device and/or views device status using HTML UI

0 Addressing0 Addressing

1 Discovery1 Discovery

2* Description2* Description

5 Presentation5 Presentation4 Eventing4 Eventing3 Control3 Control

Page 18: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

2 Description2 Description Control point

learns about device capabilities 0 get address 1 discover device

get URL for description

2 retrieve descrget URL for

service description

Declare capabilities

Protocol stack

UPnP vendorUPnP vendorUPnP vendorUPnP vendor

UPnP ForumUPnP ForumUPnP ForumUPnP Forum

UPnP Device ArchitectureUPnP Device ArchitectureUPnP Device ArchitectureUPnP Device Architecture

IPIPIPIP

HTTPHTTPHTTPHTTP

TCPTCPTCPTCP

Page 19: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

2 Description2 Description Device description

Type Physical container Logical container

For each service Type URL for

description URL for control URL for

eventing UI

Icons URL for

presentation

Services Functional units

within devices

Service description Actions State variables Actual (vs.

designed) implementation

Expressed in XML

Page 20: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

2 Description: XML Sidebar2 Description: XML Sidebar What is XML?

W3C Recommendation Extensible Markup Language "Universal format for structured documents and data on

the Web." Field names in <angle brackets> Field values between names

Defines 24 data types 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

Page 21: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

2 Description: Device (phys)2 Description: Device (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>

Page 22: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

2 Description: Device (logical)2 Description: Device (logical)<?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>

Page 23: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

2 Description: Device (other)2 Description: Device (other)<?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>

Page 24: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

2 Description: Service (actns)2 Description: Service (actns)<?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>

Page 25: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

2 Description: Service (vars)2 Description: Service (vars)<?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>

Page 26: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

2 Description: Service (vars)2 Description: Service (vars)<?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>

Page 27: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

Steps to UPnP NetworkingSteps to UPnP Networking

0 Control point and device get addresses

1 Control point finds interesting device

2 Control point learns about device capabilities

3* Control point invokes actions on device

4 Control point listens to state changes of device

5 Control point controls device and/or views device status using HTML UI

0 Addressing0 Addressing

1 Discovery1 Discovery

2 Description2 Description

5 Presentation5 Presentation4 Eventing4 Eventing3* Control3* Control

Page 28: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

3 Control3 Control Control point

invokes actions on device 0 get address 1 discover device 2 retrieve descr

get URL for control

3 send actions to device

Protocol stack

UPnP vendorUPnP vendorUPnP vendorUPnP vendor

UPnP ForumUPnP ForumUPnP ForumUPnP Forum

UPnP Device ArchitectureUPnP Device ArchitectureUPnP Device ArchitectureUPnP Device Architecture

IPIPIPIP

SOAPSOAPSOAPSOAP

HTTPHTTPHTTPHTTP

TCPTCPTCPTCP

Page 29: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

3 Control: SOAP Sidebar3 Control: SOAP SidebarWhat is SOAP?

IETF Draft Simple Object Access Protocol

"Lightweight, XML-based protocol for exchange of information in a decentralized, distributed environment."Envelope: defines a framework for

describing what is in a message and how to process it.

Convention: represent remote procedure calls and responses.

Page 30: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

3 Control: Invoke Action3 Control: Invoke Action Who? Control point When? To invoke action on device What?

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>

Page 31: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

3 Control: Action Result3 Control: Action Result Who? Device When? Action completes What?

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>

Page 32: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

Steps to UPnP NetworkingSteps to UPnP Networking

0 Control point and device get addresses

1 Control point finds interesting device

2 Control point learns about device capabilities

3 Control point invokes actions on device

4* Control point listens to state changes of device

5 Control point controls device and/or views device status using HTML UI

0 Addressing0 Addressing

1 Discovery1 Discovery

2 Description2 Description

5 Presentation5 Presentation4* Eventing4* Eventing3 Control3 Control

Page 33: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

4 Eventing4 Eventing Control point

listens to state changes of device 0 get address 1 discover device 2 retrieve descr

get URL for eventing

4 subscribe to events from device

Basic push model Simple

Protocol stack

UPnP vendorUPnP vendorUPnP vendorUPnP vendor

UPnP ForumUPnP ForumUPnP ForumUPnP Forum

UPnP Device ArchitectureUPnP Device ArchitectureUPnP Device ArchitectureUPnP Device Architecture

IPIPIPIP

HTTPHTTPHTTPHTTPGENAGENAGENAGENA

TCPTCPTCPTCP

Page 34: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

4 Eventing: GENA Sidebar4 Eventing: GENA SidebarWhat is GENA?

IETF Draft General Event Notification Architecture

"Send and receive notifications using HTTP over TCP/IP and administratively-scoped multicast UDP."SUBSCRIBE to notificationsUNSUBSCRIBENOTIFY

Of device availabilityOf state variable changes

Page 35: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

4 Eventing: Subscribing4 Eventing: SubscribingWho? Control pointWhen? Before receiving any eventsWhat?

SUBSCRIBE publisher path HTTP/1.1HOST: publisher host:publisher port

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

Page 36: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

4 Eventing: Subscription4 Eventing: SubscriptionWho? DeviceWhen? Accepts subscriptionWhat?

Device immediately sends a special, initial event to control point with the value of all evented variables

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

Page 37: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

4 Eventing: Notify4 Eventing: Notify Who? Device When? A state variable changes What?

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>

Page 38: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

Steps to UPnP NetworkingSteps to UPnP Networking

0 Control point and device get addresses

1 Control point finds interesting device

2 Control point learns about device capabilities

3 Control point invokes actions on device

4 Control point listens to state changes of device

5* Control point controls device and/or views device status using HTML UI

0 Addressing0 Addressing

1 Discovery1 Discovery

2 Description2 Description

5* Presentation5* Presentation4 Eventing4 Eventing3 Control3 Control

Page 39: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

5 Presentation5 Presentation Control point

controls device and/or views device status using HTML UI 0 get address 1 discover device 2 retrieve descr

get URL for presentation

5 load presentation page

(Don't constrain implementation)

Protocol stack

UPnP vendorUPnP vendorUPnP vendorUPnP vendor

UPnP Device ArchitectureUPnP Device ArchitectureUPnP Device ArchitectureUPnP Device Architecture

IPIPIPIP

HTTPHTTPHTTPHTTP

TCPTCPTCPTCP

Page 40: UPnP Device Architecture. Networking is easy, except… Ad hoc networks don't have resources just for the sake of the network E.g., DHCP, DNS, directory,

SummarySummary UPnP says

1. Just send data

2. Keep implementation private

3. Agree on content / format of data

UPnP is Web-based protocols Tailored by a Forum for device (service) types That are API, OS, physical network neutral For discovery, description, control, eventing (And simple HTML UI too)

For more information Resources: http://www.upnp.org Questions? mailto:[email protected]