7/31/2019 UPnP Device Architecture Generic 20000710
1/40
UPnP Device Architecture
7/31/2019 UPnP Device Architecture Generic 20000710
2/40
Networking is easy, exceptAd hoc networks don't have
resources just for the sake of thenetwork
E.g., DHCP, DNS, directory,
Network is unreliableNodes added / removed unpredictably
Programs need to talk to programs
But software is heterogeneousOne size doesn't fit all
Must upgrade system piece at a time
7/31/2019 UPnP Device Architecture Generic 20000710
3/40
UPnP 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 capabilities3. Agree on meaning / format of data
Choose substrate of proven protocols
Define device (service) specific protocols in a
Forum
7/31/2019 UPnP Device Architecture Generic 20000710
4/40
UPnP TacticsStart simple
Build in only universal things thateverybody needs (and can live with)
Add as needed
Minimize requirementsBasic IP network connectivity
Common HTTP protocol stack
Leverage existing standardsHTTP, XML
7/31/2019 UPnP Device Architecture Generic 20000710
5/40
GoalsDescribe the protocols for
communication betweenControl points
Controller, usually client
DeviceControlled,
usually server
An actual device
might containboth functions
Device
Service
Control Point
Control Point
Device
Service
7/31/2019 UPnP Device Architecture Generic 20000710
6/40
Steps 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 devicestatus using HTML UI
0 Addressing
1 Discovery
2 Description
5 Presentation
4 Eventing
3 Control
7/31/2019 UPnP Device Architecture Generic 20000710
7/40
Vendor-specific API above
Vendor-specific OS below
UPnP Protocol Stack
Vendor-
specific
physicalnet
UPnP Device Architecture
UDP
IP
HTTPU/MU GENA SSDP SOAP
HTTP
HTTP GENA
TCP
UPnP Forum
UPnP vendor
7/31/2019 UPnP Device Architecture Generic 20000710
8/40
Steps 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 devicestatus using HTML UI
0* Addressing
1 Discovery
2 Description
5 Presentation4 Eventing3 Control
7/31/2019 UPnP Device Architecture Generic 20000710
9/40
7/31/2019 UPnP Device Architecture Generic 20000710
10/40
7/31/2019 UPnP Device Architecture Generic 20000710
11/40
1 Discovery Control point
finds interestingdevice
0 get address
1 discover device
Advertise / findtyped devices(services)
Guarantee ofminimalcapabilities
Simple
Devices
Advertise whenadded
Refreshadvertisements(cf. lease)
Canceladvertisementswhen removed
Control pointssearch as needed
Devices respond
Control pointsfilter
7/31/2019 UPnP Device Architecture Generic 20000710
12/40
1 Discovery: Protocol Stack
UPnP vendor
UPnP Forum
UPnP Device Architecture
UDP
IP
HTTPMU
(multicast)GENA SSDP HTTPU
(unicast)SSDP
7/31/2019 UPnP Device Architecture Generic 20000710
13/40
1 Discovery: SSDP SidebarWhat is SSDP?
IETF Draft Simple Service DiscoveryProtocol
Key design principles
Administratively-scoped multicastUnicast responses
UDP
Very simple advertisements
Very simple search
7/31/2019 UPnP Device Architecture Generic 20000710
14/40
1 Discovery: AdvertisingWho? 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:rootdevice
NOTIFY* HTTP/1.1HOST:239.255.255.250:1900
CACHE-CONTROL: max-age =seconds until advertisement expiresLOCATION:URL for UPnP description for root deviceNT:search targetNTS:ssdp:aliveUSN:advertisement UUID
7/31/2019 UPnP Device Architecture Generic 20000710
15/40
1 Discovery: SearchingWho? Control point multicasts
When? Looking for device or serviceWhat?
ST one of
Service type Device type
Device UUID
upnp:rootdevice
ssdp:all
M-SEARCH * HTTP/1.1
HOST:239.255.255.250:1900
MAN:"ssdp:discover"
MX:seconds to delay responseST:search target
7/31/2019 UPnP Device Architecture Generic 20000710
16/40
1 Discovery: RespondingWho? Device unicasts
When? If ST matches an NTWhat?
1 time for each NT that matches
Very simple matching
HTTP/1.1 200 OK
CACHE-CONTROL: max-age =seconds until advertisement expires
LOCATION:URL for UPnP description for root device
ST: search targetUSN: advertisement UUID
7/31/2019 UPnP Device Architecture Generic 20000710
17/40
Steps 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 devicestatus using HTML UI
0 Addressing
1 Discovery
2* Description
5 Presentation4 Eventing3 Control
7/31/2019 UPnP Device Architecture Generic 20000710
18/40
2 Description Control point
learns about
device capabilities 0 get address
1 discover device
get URL for
description 2 retrieve descr
get URL forservicedescription
Declarecapabilities
Protocol stack
UPnP vendor
UPnP Forum
UPnP Device Architecture
IP
HTTP
TCP
7/31/2019 UPnP Device Architecture Generic 20000710
19/40
2 Description Device description
Type
Physical container
Logical container
For each service
Type
URL fordescription
URL for control
URL foreventing
UI Icons
URL forpresentation
Services
Functional unitswithin devices
Servicedescription
ActionsState variables
Actual (vs.designed)implementation
Expressed in XML
7/31/2019 UPnP Device Architecture Generic 20000710
20/40
2 Description: XML Sidebar What is XML?
W3C Recommendation Extensible Markup Language
"Universal format for structured documents and data onthe Web."
Field names in
Field values between names
Defines 24 data typesui1, 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
7/31/2019 UPnP Device Architecture Generic 20000710
21/40
2 Description: Device (phys)
base URL forall relative URLs
short user-friendly titlemanufacturer nameURL to manufacturer sitelong user-friendly titlemodel name
model numberURL to model sitemanufacturer's serial numberuuid:UUID
Universal Product Codeurn:schemas-upnp-org :device:deviceType
urn:schemas-upnp-org:service :serviceType:v
urn:upnp-org:serviceId :serviceIDURL to service descriptionURL forcontrolURL foreventing
Declarationsforotherservices (if any)go here
Descriptionof embeddeddevices (if any)go here
image/formathorizontal pixelsvertical pixelscolordepthURL to icon
XML to declare othericons, if any, go here
URL forpresentation
10
7/31/2019 UPnP Device Architecture Generic 20000710
22/40
2 Description: Device (logical)
base URL for all relative URLs
short user-friendly titlemanufacturernameURL to manufacturersitelong user-friendlytitl emodel namemodel numberURL to modelsitemanufacturer's serial numberuuid:UUIDUniversalProduct Code
urn:schemas-upnp-org:device:deviceType:v
urn:schemas-upnp-org:service:serviceType:vurn:upnp-org:serviceId:serviceIDURL to service descriptionURL for control
URL for eventingDeclarations for other services (if any) go here
Description of embedded devices (if any) go here
image/formathorizontal pixelsvertical pixelscolordepthURL to icon
XML to declare othericons, if any, go here
URL forpresentation
10
7/31/2019 UPnP Device Architecture Generic 20000710
23/40
2 Description: Device (other)
base URL forall relative URLs
short user-friendly titlemanufacturernameURL to manufacturersitelong user-friendlytitl emodel namemodel numberURL to modelsitemanufacturer's serial numberuuid:UUIDUniversalProduct Codeurn:schemas-upnp-org :device:deviceType
urn:schemas-upnp-org:service :serviceType:v
urn:upnp-org:serviceId :serviceIDURL to service descriptionURL forcontrolURL foreventing
Declarationsforotherservices (if any)go here
Descriptionof embeddeddevices (if any)go here
image/formathorizontal pixelsvertical pixelscolor depthURL to icon
XML to declare other icons, if any, go here
URL for presentation
10
D i i S i ( )
7/31/2019 UPnP Device Architecture Generic 20000710
24/40
2 Description: Service (actns)
actionName
formalParameterName
inxoroutstateVariableName
Declarations for other arguments (if any) go here
Declarations for other actions (if any) go here
variableNamevariable datatypedefault valueminimum valuemaximum valueincrement value
variableNamevariable data typedefault valuesome valuesome value
Declarations forother state variables(if any)go here
10
2 D i i S i ( )
7/31/2019 UPnP Device Architecture Generic 20000710
25/40
2 Description: Service (vars)
actionName
formalParameterNameinxoroutstateVariableName
Declarationsforother arguments(if any)go here
Declarations forotheractions (if any)go here
variableNamevariable datatypedefault value
minimum value
maximum valueincrement value
variableNamevariable data typedefault valuesome valuesome value
Declarations forother state variables(if any)go here
10
2 D i i S i ( )
7/31/2019 UPnP Device Architecture Generic 20000710
26/40
2 Description: Service (vars)
actionName
formalParameterNameinxoroutstateVariableName
Declarationsforother arguments(if any)go here
Declarations forotheractions (if any)go here
variableNamevariable datatypedefault valueminimum valuemaximum valueincrement value
variableNamevariable data typedefault value
some valuesome value
Declarations for other state variables (if any) go here
10
7/31/2019 UPnP Device Architecture Generic 20000710
27/40
3 C t l
7/31/2019 UPnP Device Architecture Generic 20000710
28/40
3 Control Control point
invokes actions ondevice 0 get address
1 discover device
2 retrieve descrget URL for
control
3 send actions todevice
Protocol stack
UPnP vendor
UPnP Forum
UPnP Device Architecture
IP
SOAP
HTTP
TCP
3 C t l SOAP Sid b
7/31/2019 UPnP Device Architecture Generic 20000710
29/40
3 Control: SOAP SidebarWhat is SOAP?
IETF Draft Simple Object AccessProtocol
"Lightweight, XML-based protocol forexchange of information in a
decentralized, distributed environment."Envelope: defines a framework for
describing what is in a message andhow to process it.
Convention: represent remoteprocedure calls and responses.
3 C t l I k A ti
7/31/2019 UPnP Device Architecture Generic 20000710
30/40
3 Control: Invoke Action Who? Control point
When? To invoke action on device
What?
POSTpath of control URLHTTP/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"
in arg valueother in argsand their values (if any) go here
3 C t l A ti R lt
7/31/2019 UPnP Device Architecture Generic 20000710
31/40
3 Control: Action Result Who? Device
When? Action completes
What?
HTTP/1.1 200 OK
CONTENT-TYPE: text/xml; charset="utf-8"
out arg valueother out argsand their values (if any) go here
St t UP P N t ki
7/31/2019 UPnP Device Architecture Generic 20000710
32/40
Steps 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 devicestatus using HTML UI
0 Addressing
1 Discovery
2 Description
5 Presentation4* Eventing3 Control
4 E ti
7/31/2019 UPnP Device Architecture Generic 20000710
33/40
4 Eventing Control point
listens to statechanges of device 0 get address
1 discover device
2 retrieve descrget URL for
eventing
4 subscribe toevents from device
Basic push model
Simple
Protocol stack
UPnP vendor
UPnP Forum
UPnP Device Architecture
IP
HTTP GENA
TCP
4 E ti GENA Sid b
7/31/2019 UPnP Device Architecture Generic 20000710
34/40
4 Eventing: GENA SidebarWhat is GENA?
IETF Draft General Event NotificationArchitecture
"Send and receive notifications usingHTTP over TCP/IP and administratively-
scoped multicast UDP."SUBSCRIBE to notifications
UNSUBSCRIBE
NOTIFYOf device availability
Of state variable changes
4 E ti S b ibi
7/31/2019 UPnP Device Architecture Generic 20000710
35/40
4 Eventing: SubscribingWho? Control point
When? Before receiving any eventsWhat?
SUBSCRIBEpublisher pathHTTP/1.1
HOST:publisher host:publisher portCALLBACK: NT:upnp:eventTIMEOUT: Second-requested subscription duration
4 E enting S bscription
7/31/2019 UPnP Device Architecture Generic 20000710
36/40
4 Eventing: SubscriptionWho? Device
When? Accepts subscriptionWhat?
Device immediately sends a special,initial event to control point with thevalue of all evented variables
HTTP/1.1 200 OK
SID: uuid:subscription-UUIDTIMEOUT: Second-actual subscription duration
4 Eventing Notify
7/31/2019 UPnP Device Architecture Generic 20000710
37/40
4 Eventing: NotifyWho? Device
When? A state variable changesWhat?
NOTIFYdelivery pathHTTP/1.1HOST:delivery host:delivery port
CONTENT-TYPE: text/xmlNT:upnp:eventNTS:upnp:propchangeSID: uuid:subscription-UUIDSEQ: event key
new valueOther variable names and values (if any) go here
Steps to UPnP Networking
7/31/2019 UPnP Device Architecture Generic 20000710
38/40
Steps 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 devicestatus using HTML UI
0 Addressing
1 Discovery
2 Description
5* Presentation4 Eventing3 Control
5 Presentation
7/31/2019 UPnP Device Architecture Generic 20000710
39/40
5 Presentation Control point
controls device
and/or viewsdevice statususing HTML UI 0 get address
1 discover device 2 retrieve descr
get URL forpresentation
5 load presentation
page
(Don't constrainimplementation)
Protocol stack
UPnP vendor
UPnP Device Architecture
IP
HTTP
TCP
Summary
7/31/2019 UPnP Device Architecture Generic 20000710
40/40
Summary 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]
http://www.upnp.org/mailto:[email protected]:[email protected]://www.upnp.org/Top Related