Post on 09-Sep-2018
uPNP and DLNA
uPNP Device Architecture
• defines an architecture for pervasive peer-to-peer network connectivity of intelligent appliances, wireless devices, and PCs of all form factors
• easy-to-use, flexible, standards-based connectivity to ad-hoc or unmanaged networks
• Specifications
– UPnP Device Architecture ( formerly known as DCP Framework )
– zero-configuration
– "invisible" networking
– automatic discovery for a breadth of device categories
• Basis
– Internet protocols such as IP, TCP, UDP, HTTP, and XML.
uPNP Protocol Stack
• ALL MESSAGES are based on the HTTP protocol
• SSDP : Simple Service Discovery Protocol
• GENA : General Event Notification Architecture
• uPNP is based on IP protocols.
• UPnP general device classification
– Controlled devices ( or devices ) : server
– Control Points
• Glossary– Device : logical device.
– Service : logical functional unit. Smallest units of control. (action/ variables)
UPnP Steps
0. Addressing
– DHCP, static IP assignment or AUTO IP.
1. Discovery
– Discovery message format, including URL for description.
– How devices advertise.
– How control points search devices.
2. Description
– Expressed in XML, and can be accessed via HTML using URL.
– Includes device information
– Includes URL for control, eventing and presentation.
– Includes variables to model the state of the service at runtime.
3. Control
– Expressed in XML using SOAP.
– Returns any action-specific values.
– May change the variables.
UPnP Steps
4. Eventing
– Subscription and Update
• Update : by service if variable changes.
• Subscription : by control point to the service.
– Multicast Eventing
• when events which are not relevant to specific UPnP interactions should be delivered to control points to inform users.
• when multiple controlled devices want to inform multiple other control points
• Retransmission.
5. Presentation
– Presentation to User using a Browser.
– URL for presentation is in Description message
– User may access to that URL with a browser and control the device or view device status.
Step0 : Addressing
• All DHCP-compatible device should have IP address.
– UPnP and DLNA is based on IPv4
– IPv6 compatibility is written in annex of UDA
• Addressing
– Should support DHCP.
– Auto-IP : 169.254/16 address range. Link-local address (RFC3927)
– May use static IP address.
Step 1 : DISCOVERY
Step 1 : DISCOVERY
• UPnP Discovery Protocol
– Based on SSDP protocol
– Control point : search for devices
– Device : advertise its service to control points
• Device (server)
– MUST Multicast discovery messages when added to the network.
– Standard multicast address in SSDP : 239.255.255.250
• Control Point (client)
– MAY Multicast discovery messages when added to the network.
– Standard port for SSDP : 1900
• Bonjour, ZeroConfig, SSDP…?
– http://www.zeroconf.org/ZeroconfAndUPnP.html
– http://en.wikipedia.org/wiki/Zeroconf#Service_discovery
Step 1 : DISCOVERY
• SSDP Message Format
– SSDP is in the HTTTP header field.
• SSDP Start-line
• SSDP message header fields
• SSDP header field extensions
• UUID
– DCE variant of Universal Unique Identifiers (UUIDs), The Open group, 1997, Available at: http://www.opengroup.org/onlinepubs/9629399/apdxa.htm.
Step 1 - Advertisement
• NT : Notification Type
– upnp:rootdevice
– uuid:device-UUID
– urn:schemas-upnp-org:device:deviceType:ver
– urn:schemas-upnp-org:service:serviceType:ver
– urn:domain-name:device:deviceType:ver
– urn:domain-name:service:serviceType:ver
• NTS : ssdp:alive
• CACHE-COBTROL : should be greater than 1800.
• USN : Unique Service Name.– uuid:device-UUID::upnp:rootdevice
– uuid:device-UUID
– …etc.
Step 1 - Advertisement
Step 1 - Advertisement
• Device unavailable -- NOTIFY with ssdp:byebye
• Device Update – NOTIFY with ssdp:update
Step 1 - Search
• Search Request : M-SEARCH
• Search Response
Step 2 : Description
• Description : Information about device and service
• Device Description : for physical and logical containers
– Vendor-specific information.
– Service type
– Service name
– URLs (service description, control and eventing for each service)
– URS for presentation (of the aggregate)
• Service Description
– Actions and arguments
– To control a service (action) and get a response (argument)
Device Description
Service Description
scpd : service control protocol description
HTTP
Step 3 : Control
• Based on SOAP protocol.
SOAP 1.1 UPnP Profile
HTTP
Retrieved by description
HTTP
Step 4 : Eventing
• Unicast Eventing
– Subscription model
– Control Point subscribes to a variable of a service.
– Service sends an event when variable changes.
• Multicast Eventing
– Service multicasts an event when variable changes to multicast group.
• Publisher-Subscriber-Receiver
– Publisher : service (source of events)
– Subscriber : control point (destination of events)
– Receiver : control point or controlled device, listener of multicast device
Step 4 : Eventing
Step 4 : Eventing
• Subscriber information Publisher
– Unique subscription identifier
– Delivery URL for event messages
– Event key
– Subscription duration
– HTTP version of subscriber
• Subscriber
– Sends subscription message to a service
• URL for the publisher, service id for the publisher and delivery URL for event messages.
• MAY include duration.
– Subscription : to a Service.
• All the variables of a service will be used for eventing.
• No individual subscription of a variable of a service.
Unicast Eventing
• Publisher
– Send respond to the subscriber : Unique ID and duration
• Initial event message
– ASAP after the subscription is accepted.
– Names and current value of all evented variables.
• Subscription Renewal
– By subscriber
– No delivery URL in its message
Unicast Eventing
Unicast Eventing
Multicast Eventing
• A HTTP-like message : since it is sent via UDP
• On a ONE single UDP payload :
– If big, several UDP message can be sent.
– fragmentation is done by UPnP, not by UDP.
• Can be retransmitted as defined by UPnP
Unicast Event : HTTP
Multicast Event : HTTP
Step 5 : Presentation