Universal Plug And Play UPnP

Download Report

Transcript Universal Plug And Play UPnP

Universal Plug And Play
UPnP
Universal Plug And Play
Myungho Choi
© Realtime Embedded Systems Laboratory
Inha University
© 2002, Myungho Choi, RESL, Inha University
Page : 1
Universal Plug And Play
Contents
•
•
•
•
•
•
Introduction
Components of a UPnP Network
UPnP protocol Overview
How UPnP Works
Summary
Reference
© 2002, Myungho Choi, RESL, Inha University
Page : 2
Universal Plug And Play
Introduction
• Home Network Purpose
– PC를 비롯한 가정내의 정보가전기기들을 하나의 네트워크로
통합하여 일원적으로 관리
– 미들웨어 관련 기술
 UPnP
• MS, Compaq, Intel, Philips…
 Jini
• Sun
 HAVI
• Samsung, Sony, Philips, Sun…
• 가정내 AV기기를 접속하는 기술
© 2002, Myungho Choi, RESL, Inha University
Page : 3
Universal Plug And Play
Introduction
• Designed to support zero-configuration
• Easy to Use, Standard Based, Flexible
– Smooth Integration with Legacy Systems, non-IP Network,
and Peripheral Devices
A Mixed-Media, Multiple-Vendor Network
© 2002, Myungho Choi, RESL, Inha University
Page : 4
Universal Plug And Play
Introduction
• Fundamental Principles
– Open Protocols
 Use Internet open protocol model
– Independent of any particular physical medium
– Flexible Platform for APIs and Tools
 Language- and OS- neutral
– Take Advantage of the Web
Proximity Services using the Browser
© 2002, Myungho Choi, RESL, Inha University
Page : 5
Universal Plug And Play
Components of a UPnP Network
UPnP Enabled Device
Device
Service 1
Service 2
UPnP Enabled Device
Control Point
UPnP Control Points,
Devices, and Services
Device
Control Point
Service
UPnP Enabled Device
Root Device
Embedded Device
Service
Service
State
Table
© 2002, Myungho Choi, RESL, Inha University
Service 1
Service 2
Control
Server
Event
Server
Page : 6
Universal Plug And Play
Components of a UPnP Network
• Devices
– Container of services and nested devices
– Different sets of services and embedded devices
 Standardization on the set of services that a particular device
type will provide
– All of abovementioned information is captured in an XML
device description document that the device must host
– The device description also lists the properties associated
with the device
 ex> device name, icons…
© 2002, Myungho Choi, RESL, Inha University
Page : 7
Universal Plug And Play
Components of a UPnP Network
• Services
– The smallest unit of control
– Expose actions and models its state with state variables
– Similar to the device description, this information is part of
an XML service description standardized
– Device may contain multiple services
– Consist of a state table, a control server and an event server
© 2002, Myungho Choi, RESL, Inha University
Page : 8
Universal Plug And Play
Components of a UPnP Network
• Control Points
– Controller capable of discovering and controlling other
devices
– Devices will incorporate control point functionality (and viceversa) to enable true peer-to-peer networking
© 2002, Myungho Choi, RESL, Inha University
Page : 9
Universal Plug And Play
UPnP protocol Overview
• Using open, standard protocols such as TCP/IP, HTTP
and XML
• Other technologies can participate in the UPnP
network through a UPnP bridge or proxy
Control Point
(Pocket PC)
Control Point
(Remote Control)
IP Network
Native Device
(UPnP VCR)
UPnP Bridge
Native Device
(UPnP Alarm Clock)
Lightweight Device
(LonWorks
Thermostat)
Non-IP Bus/
Networks
Non-UPnP Device
(X-10 Light)
A Bridged UPnP Network
© 2002, Myungho Choi, RESL, Inha University
Page : 10
Universal Plug And Play
UPnP protocol Overview
UPnP Vendor Defined
UPnP Forum Working Committee Defined
UPnP Device Architecture Defined
SSDP
HTTPMU GENA
(Discovery)
SSDP
HTTPU
(Discovery)
UDP
SOAP
(Control)
HTTP
HTTP
(Description)
GENA
(Events)
TCP
IP
Vendor Specific Operating System Below
The UPnP Protocol Stack
© 2002, Myungho Choi, RESL, Inha University
Page : 11
Universal Plug And Play
How UPnP Works
•
•
•
•
•
•
Addressing
Discovery
Description
Control
Eventing
Presentation
3 Control
4 Eventing
5 Presentation
2 Description
1 Discovery
0 Addressing
© 2002, Myungho Choi, RESL, Inha University
Page : 12
Universal Plug And Play
How UPnP Works
• Addressing
– Each device must have a Dynamic Host Configuration
Protocol (DHCP) client
 If no DHCP server is available, the device must use AUTO-IP to
get an address
– A device may have a friendly name for a device
 In that case, a device may include a DNS client and may
support dynamic DNS registration for its own name to address
mapping
– What steps does it take?
 Pick an address
 Check to see if it is used (ARP)
 Periodically check for DHCP server
© 2002, Myungho Choi, RESL, Inha University
Page : 13
Universal Plug And Play
How UPnP Works
• Discovery
– Handled by SSDP
– When a device is added to the network, SSDP allows that
device to advertise its services to control points on the
network
– When a control point is added to the network, SSDP allows
that control point to search for devices of interest on the
network
 Discovery uses a multicast variant of HTTP (HTTPMU) for
device advertisements and control point searches
 Discovery uses a unicast variant of HTTP (HTTPU) for
responses to searches.
© 2002, Myungho Choi, RESL, Inha University
Page : 14
Universal Plug And Play
How UPnP Works
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
M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
MAN: "ssdp:discover"
MX: seconds to delay response
ST: search target
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
© 2002, Myungho Choi, RESL, Inha University
Advertising
Searching
Responding
Page : 15
Universal Plug And Play
How UPnP Works
• Description
– Including vendor-specific, manufacturer information
– Including a list of any embedded devices or services, as well
as URLs for control, eventing, and presentation
– Expressed in XML
© 2002, Myungho Choi, RESL, Inha University
Page : 16
Universal Plug And Play
How UPnP Works
<?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>
© 2002, Myungho Choi, RESL, Inha University
Description
Page : 17
Universal Plug And Play
How UPnP Works
• Control
– To learn more about the service, a control point must
retrieve a detailed UPnP description for each service
– To control a device, a control point sends an action request
to a device’s service
– Control messages are also expressed in XML using SOAP
– In response to the control message, the service returns
action specific values or fault codes
© 2002, Myungho Choi, RESL, Inha University
Page : 18
Universal Plug And Play
How UPnP Works
POST path of control URL HTTP/1.1
HOST: host of control URL:port of control URL
CONTENT-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>
<u:actionName xmlns:u="urn:schemas-upnp-org:service:serviceType:v">
<argumentName>in arg value</argumentName>
Invoke Action
other in args and their values (if any) go here
</u:actionName>
</s:Body>
</s:Envelope>
HTTP/1.1 200 OK
CONTENT-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>
<u:actionNameResponse
xmlns:u="urn:schemas-upnp-org:service:serviceType:v">
<argumentName>out arg value</argumentName>
Action Result
other out args and their values (if any) go here
</u:actionNameResponse>
</s:Body>
</s:Envelope>
© 2002, Myungho Choi, RESL, Inha University
Page : 19
Universal Plug And Play
How UPnP Works
• Eventing
– The service publishes updates when state of device changes,
and a control point may subscribe to receive this information
– The service publishes updates by sending event messages
 Event messages contain the names of one of more state
variables and the current value of those variables
 Event messages are also expressed in XML and formatted using
GENA
© 2002, Myungho Choi, RESL, Inha University
Page : 20
Universal Plug And Play
How UPnP Works
SUBSCRIBE publisher path HTTP/1.1
HOST: publisher host:publisher port
CALLBACK: <delivery URL>
NT: upnp:event
TIMEOUT: Second-requested subscription duration
HTTP/1.1 200 OK
SID: uuid:subscription-UUID
TIMEOUT: Second-actual subscription duration
NOTIFY delivery path HTTP/1.1
HOST: delivery host:delivery port
CONTENT-TYPE: text/xml
NT: upnp:event
NTS: upnp:propchange
SID: uuid:subscription-UUID
SEQ: event key
<e:propertyset xmlns:e="urn:schemas-upnp-org:event-1-0">
<e:property>
<variableName>new value</variableName>
</e:property>
Subscribing
Subscription
Notify
Other variable names and values (if any) go here
</e:propertyset>
© 2002, Myungho Choi, RESL, Inha University
Page : 21
Universal Plug And Play
How UPnP Works
• Presentation
– Control point controls device and/or views device status
using HTML UI
– Requires getting an address, discovery, and description
(Does not require control or eventing)
© 2002, Myungho Choi, RESL, Inha University
Page : 22
Universal Plug And Play
Summary
• UPnP is
–
–
–
–
Based on the proven approach of Internet protocols
Tailored by a Forum for device (service) types
That are API, OS, physical network neutral
For discovery, description, control, eventing, and
presentation (simple HTML UI)
© 2002, Myungho Choi, RESL, Inha University
Page : 23
Universal Plug And Play
Reference
• http://www.upnp.org
• http://www.w3.org/XML/
• http://www.ietf.org
© 2002, Myungho Choi, RESL, Inha University
Page : 24