UPnP Device ArchitectureUPnP Device Architecture
Networking is easy, except…Networking is easy, except…
Ad hoc networks don't have
resources just for the sake of the
network
E.g., DHCP, DNS, directory, …
Network is unreliable
Nodes added / removed unpredictably
Programs need to talk to programs
But software is heterogeneous
One size doesn't fit all
Must upgrade system piece at a time
UPnP StrategyUPnP Strategy
1. 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
UPnP TacticsUPnP Tactics
Start simple
Build in only universal things that
everybody needs (and can live with)
Add as needed
Minimize requirements
Basic IP network connectivity
Common HTTP protocol stack
Leverage existing standards
HTTP, XML
GoalsGoals
Describe the protocols for
communication between
Control points
Controller, usually client
Device
Controlled,
usually server
An actual device
might contain
both functions
DeviceDeviceDevice
ServiceServiceService
Control PointControl PointControl Point
Control PointControl PointControl Point
DeviceDeviceDevice
ServiceServiceService
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
Vendor-specific API above
Vendor-specific OS below
UPnP Protocol StackUPnP Protocol Stack
V
e
n
d
o
r
-
s
p
e
c
i
f
i
c
p
h
y
s
i
c
a
l
n
e
t
UPnP Device ArchitectureUPnP Device ArchitectureUPnP Device Architecture
UDPUDPUDP
IPIPIP
HTTPU/MUHTTPU/MUHTTPU/MU GENAGENAGENA SSDPSSDPSSDP SOAPSOAPSOAP
HTTPHTTPHTTP
HTTPHTTPHTTP GENAGENAGENA
TCPTCPTCP
UPnP ForumUPnP ForumUPnP Forum
UPnP vendorUPnP vendorUPnP vendor
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
0 Addressing0 Addressing
Control point and device get address
Use a DHCP server
Else use Auto IP
What is Auto IP?
IETF Draft Automatically Choosing an IP
Address in an Ad-Hoc IPv4 Network
What steps does it take?
Pick an address in 169.254/16 range
Check to see if it is used (ARP)
Periodically check for DHCP server
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
1 Discovery1 Discovery
Control point
finds interesting
device
0 get address
1 discover device
Advertise / find
typed devices
(services)
Guarantee of
minimal
capabilities
Simple
Devices
Advertise when
added
Refresh
advertisements
(cf. lease)
Cancel
advertisements
when removed
Control points
search as needed
Devices respond
Control points
filter
1 Discovery: Protocol Stack1 Discovery: Protocol Stack
UPnP vendorUPnP vendorUPnP vendor
UPnP ForumUPnP ForumUPnP Forum
UPnP Device ArchitectureUPnP Device ArchitectureUPnP Device Architecture
UDPUDPUDP
IPIPIP
HTTPMU
(multicast)
HTTPMUHTTPMU
(multicast)(multicast) GENA
GENAGENA SSDPSSDPSSDP HTTPU
(unicast)
HTTPUHTTPU
(unicast)(unicast) SSDP
SSDPSSDP
1 Discovery: SSDP Sidebar1 Discovery: SSDP Sidebar
What is SSDP?
IETF Draft Simple Service Discovery
Protocol
Key design principles
Administratively-scoped multicast
Unicast responses
UDP
Very simple advertisements
Very simple search
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.1
HOST: 239.255.255.250:1900
NOTIFY * HTTP/1.1
HOST: 239.255.255.250:1900
CACHE-CONTROL: max-age = seconds until advertisement expires
LOCATION: URL for UPnP description for root device
NT: search target
NTS: ssdp:alive
USN: advertisement UUID
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.1
HOST: 239.255.255.250:1900
M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
MAN: "ssdp:discover"
MX: seconds to delay response
ST: search target
1 Discovery: Responding1 Discovery: Responding
Who? Device unicasts
When? If ST matches an NT
What?
1 time for each NT that matches
Very simple matching
HTTP/1.1 200 OK
CACHE-CONTROL: max-age = seconds until advertisement expires
HTTP/1.1 200 OK
CACHE-CONTROL: max-age = seconds until advertisement expires
LOCATION: URL for UPnP description for root device
ST: search target
USN: advertisement UUID
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
2 Description2 Description
Control point
learns about
device capabilities
0 get address
1 discover device
get URL for
description
2 retrieve descr
get URL for
service
description
Declare
capabilities
Protocol stack
UPnP vendorUPnP vendorUPnP vendor
UPnP ForumUPnP ForumUPnP Forum
UPnP Device ArchitectureUPnP Device ArchitectureUPnP Device Architecture
IPIPIP
HTTPHTTPHTTP
TCPTCPTCP
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
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
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
2 Description: Device (phys)2 Description: Device (phys)
base URL for all relative URLs
short user-friendly title
manufacturer name
URL to manufacturer site
long user-friendly title
model name
model number
URL to model site
manufacturer's serial number
uuid:UUID
Universal Product Code
urn:schemas-upnp-org:device:deviceType
urn:schemas-upnp-org:service:serviceType:v
urn:upnp-org:serviceId:serviceID
URL to service description
URL for control
URL for eventing
Declarations for other services (if any) go here
Description of embedded devices (if any) go here
image/format
horizontal pixels
vertical pixels
color depth
URL to icon
XML to declare other icons, if any, go here
URL for presentation
1 0
base URL for all relative URLs
short user-friendly title
manufacturer name
URL to manufacturer site
long user-friendly title
model name
model number
URL to model site
manufacturer's serial number
uuid:UUID
Universal Product Code
urn:schemas-upnp-org:device:deviceType
urn:schemas-upnp-org:service:serviceType:v
urn:upnp-org:serviceId:serviceID
URL to service description
URL for control
URL for eventing
Declarations for other services (if any) go here
Description of embedded devices (if any) go here
image/format
horizontal pixels
vertical pixels
color depth
URL to icon
XML to declare other icons, if any, go here
URL for presentation
1 0
2 Description: Device (logical)2 Description: Device (logical)
base URL for all relative URLs
short user-friendly title
manufacturer name
URL to manufacturer site
long user-friendly title
model name
model number
URL to model site
manufacturer's serial number
uuid:UUID
Universal Product Code
urn:schemas-upnp-org:device:deviceType :v
urn:schemas-upnp-org:service:serviceType:v
urn:upnp-org:serviceId:serviceID
URL to service description
URL for control
URL for eventing
Declarations for other services (if any) go here
Description of embedded devices (if any) go here
image/format
horizontal pixels
vertical pixels
color depth
URL to icon
XML to declare other icons, if any, go here
URL for presentation
1 0
base URL for all relative URLs
short user-friendly title
manufacturer name
URL to manufacturer site
long user-friendly title
model name
model number
URL to model site
manufacturer's serial number
uuid:UUID
Universal Product Code
urn:schemas-upnp-org:device:deviceType :v
urn:schemas-upnp-org:service:serviceType:v
urn:upnp-org:serviceId:serviceID
URL to service description
URL for control
URL for eventing
Declarations for other services (if any) go here
Description of embedded devices (if any) go here
image/format
horizontal pixels
vertical pixels
color depth
URL to icon
XML to declare other icons, if any, go here
URL for presentation
1 0
2 Description: Device (other)2 Description: Device (other)
base URL for all relative URLs
short user-friendly title
manufacturer name
URL to manufacturer site
long user-friendly title
model name
model number
URL to model site
manufacturer's serial number
uuid:UUID
Universal Product Code
urn:schemas-upnp-org:device:deviceType
urn:schemas-upnp-org:service:serviceType:v
urn:upnp-org:serviceId:serviceID
URL to service description
URL for control
URL for eventing
Declarations for other services (if any) go here
Description of embedded devices (if any) go here
image/format
horizontal pixels
vertical pixels
color depth
URL to icon
XML to declare other icons, if any, go here
URL for presentation
1 0
base URL for all relative URLs
short user-friendly title
manufacturer name
URL to manufacturer site
long user-friendly title
model name
model number
URL to model site
manufacturer's serial number
uuid:UUID
Universal Product Code
urn:schemas-upnp-org:device:deviceType
urn:schemas-upnp-org:service:serviceType:v
urn:upnp-org:serviceId:serviceID
URL to service description
URL for control
URL for eventing
Declarations for other services (if any) go here
Description of embedded devices (if any) go here
image/format
horizontal pixels
vertical pixels
color depth
URL to icon
XML to declare other icons, if any, go here
URL for presentation
1 0
2 Description: Service (actns)2 Description: Service (actns)
actionName
formalParameterName
in xor out
stateVariableName
Declarations for other arguments (if any) go here
Declarations for other actions (if any) go here
variableName
variable datatype
default value
minimum value
maximum value
increment value
variableName
variable data type
default value
some value
some value
Declarations for other state variables (if any) go here
1 0
actionName
formalParameterName
in xor out
stateVariableName
Declarations for other arguments (if any) go here
Declarations for other actions (if any) go here
variableName
variable datatype
default value
minimum value
maximum value
increment value
variableName
variable data type
default value
some value
some value
Declarations for other state variables (if any) go here
1 0
2 Description: Service (vars)2 Description: Service (vars)
actionName<