Collaboration Bus: A System for Interoperating

Download Report

Transcript Collaboration Bus: A System for Interoperating

Device Servers
Prasun Dewan
Department of Computer Science
University of North Carolina
[email protected]
Issues in Device Servers


Device is just a
server.
So what is
different?
Network
2
Addressing Devices vs.
Traditional Servers



Sever and network is always
around - static address
Centralized heavyweight
scheme acceptable to give
install and give unique
addresses to servers
Client expected to know
traditional server address





imap.cs.unc.edu
With so many dynamic devices
and ad-hoc networks lightweight
decentralized scheme needed
Client may not know or care
about device server address
print to the nearest printer
 turn off all light bulbs

Discovery phase possible
www.cnn.com
 logical name to physical
name can be bound
dynamically
Devices may be dynamically
added on ad-hoc networks dynamic address


Implies later binding and thus
a discovery phase
3
Communicating with Device vs.
Traditional Servers

Client expected to
know exact server
interface
get mail
 send mail


Client may not know exact
server interface
palm computer controlling a
VCR it knows nothing about
 security system composer
substituting Axis camera
with Aibot Robot, which may
not share an interface
 impromptu interoperability
 implies an interface
(capability) discovery phase

4
Communicating with Device vs.
Traditional Servers

Client polls for
traditional server
changes
New mail arrived?
 Cannot track fast
changing
information


Client may wish to notified of
device changes
current channel changed, so
redisplay it
 Implies an eventing
mechanism that is

distributed
 can be dynamically
discovered

5
Deploying Remote User
Interfaces

Run preloaded client
user-interface
program
xmh
 netscape



Because of late binding,
client UI program may not
exist
Implies dynamic userinterface deployment
6
Composing Devices

Traditional servers
not composed into a
single unit


Not the same as
replicas
Composite device may be
composed out of multiple
devices
security system
 CD


How to support composite
and individual device
services.
7
UPnP (Universal Plug and Play)

Formed in 1999 with 200 vendors


Consumer electronics,Home security, Networking, Mobile
devices
Late binding
Dynamic Server discovery
 Dynamic Interface discover
 Dynamic Event discovery
 Dynamic UI Deployment
 Static Service Composition



Language- and OS- Neutral Solution
Avoid trojan horses



Ship data rather than code
Open
Use existing standards
8
UPnP 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
9
UPNP Examples: Installing a
printer
Today

Attach it to server PC

Load device driver

Share printer

Manually bind each
client to printer
Vision

Just connect printer
to network
10
Installing a device store
Today

Attach a new disk
drive to computer
Vision

Just connect drive to
network
11
Intelligent Alarm clock
Today

Set alarm clock



May vary
depending on
weekday or
weekend
Vision

Alarm clock tells PC

It runs script that
checks schedule and
sets thermostat
Set thermostat
Hope meeting not
missed
12
Arriving/leaving home
Today

Turn on entrance light

Change thermostat

Play answering machine
messages

Turn on TV

Set channel to CNN

Raise/lower blinds
depending on
before/after sunset

Turn on other lights

Reverse steps when
turning off light
Vision

Light switch
communicates with
PC, which runs script
and its inverse
13
Arriving/leaving town
Today

Manually change
thermostat

Change water heater

Close/open water valve
 Hold mail

Set vacation message(s)

Inform neighbour(s)

Throw trash
Vision

Push button saying
on vacation


Could do it remotely
Must still throw trash
14
Power outage
Today

Manually set all clocks
Vision

They automatically
synchronize with an
a networked atomic
clock

Script runs
periodically or when
power comes on
15
Home theater
Script to
 Turn on DVD
 Turn on TV
 Set it to DVD channel
 Set stereo to Video mode
 Set stereo volume to theater levels
 Dim lights
16
Ball game
Mobile device used to:
 pick up traffic info on road
 receive commentary at stadium
 track player statistics
 order food
 chat with buddies at game
17
Other apps




Appliance remotely fixed or set
Calendars of family members
synchronized
Product barcode scanned to order new
instance
Presentation displayed on discovered
display devices
18
UPnP Device
Architecture
19
Architecture/Terminology

Components
 Control
Control Point
points
 Controller,
usually client
 Device
 Controlled,
Device
Service
usually server
 An
actual device
might contain
both functions
Control Point
Device
Service
20
Architecture
UPnP Enabled Device
Device
Service 1
Service 2
UPnP Enabled Device
Control Point
Device
Control Point
Service
UPnP Enabled Device
Root Device
Embedded Device
Service
Service
State
Table
Control
Server
Event
Server
Service 1 Service 2
21
Example Configuration
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)
22
Steps to UPnP Networking
3 Control
4 Eventing
5 Presentation
2 Description
1 Discovery
0 Addressing
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
23
UPnP
Protocol
Stack
Standardized Schema
Instances (Types)
URLs, Model, Device #
Vendor-specific API above
Schemas (Prog Lang)
UPnP vendor
UPnP Device Architecture
HTTPU/MU GENA
SSDP
SOAP
HTTP
HTTP
UDP
GENA
Wire protocols
UPnP Forum
TCP
IP
Vendor-specific OS below
Name
Discovery
Capability
Multiple http servers
and Events
Discovery
State Events
Operation
24
Control
Steps to UPnP Networking
3 Control
4 Eventing
5 Presentation
2 Description
1 Discovery
0* Addressing
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
25
0 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
Could use DNS and include DNS Client
26
Overview -ad hoc
UPnP in action - ad hoc
1. DHCP broadcast
(timeout)
2. Assign AutoNet address
3. DNS name multicast
4. Announce service
(timeout - wait for requests)
5. Discover service
7. Response to discover
8. Get_HTTP XML
9. XML content
27
Overview - configured
UPnP in action - configured
1. DHCP broadcast
2. Address from DHCP server
3. Name unicast to DNS server
5. Listener Get_HTTP XML
Server
4. Announce service to listener
6. Directory updated by listener
7. Device specific negotiation
8. LDAP query directory
28
Steps to UPnP Networking
3 Control
4 Eventing
5 Presentation
2 Description
1* Discovery
0 Addressing
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
29
1 Discovery: Pull (Active) vs.
Push (Passive)

Client
Server
Servers could be
dynamically added
 Needs to poll for new
devices


Client
Client (Control point)
could pull info
Server
Server (Device) could
push advertisement
Control points can be
dynamically added
 Needs to continuously
send info, using
network

30
1 Discovery: Pull (Active) vs.
Push (Passive)

Server
Client
SSDP Solution:
Hybrid approach
 Advertisement has
lifetime



Can simulate pure
push model
HTTP over UDP
What if message
gets lost?
 Must send UDP
message 3 times
 Solution over TCP
planned

Server
31
1 Discovery: SSDP Sidebar

What is SSDP?
 IETF
Draft Simple Service Discovery
Protocol

Key design principles
 Administratively-scoped
 Unicast
multicast
responses
 UDP
 Very
simple advertisements
 Very simple search
32
1 Discovery

Control point finds
interesting device




Guarantee of
minimal
capabilities
Simple
Devices
Advertise when
added
 Refresh
advertisements
(cf. lease)
 Cancel
advertisements
when removed

0 get address
1 discover device
Advertise / find
typed devices
(services)



Control points
search as needed
Devices respond
 Control points
filter

33
1 Discovery: Protocol Stack
UPnP vendor
UPnP Forum
UPnP Device Architecture
HTTPMU
(multicast)
GENA
SSDP
HTTPU
(unicast)
SSDP
UDP
IP
34
1 Discovery: Advertising



Who? Device multicasts
When? Added or refresh (cf. lease)
What?
Multicast
address
Port
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 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
35
GENA



Notification method format defined by
GENA
An event delivery scheme over HTTP
Allows subscription
 May
be used later
 Will allow it to be not depend on the “largely
non-existent Internet multicast
infrastructure”
36
Multicast Scope

Entire internet
 Idea

to find local service
Link local
 Does

not support bridged/routed LANS
Local administrative scope
 Relative
address
 239.255.255.250

Relative address vs local scope
 Relative
address allows progressively larger
scopes

Based on physical location?
37
Location vs. USN


Location needed to send messages
USN a unique, location-independent ID
 UUID
is a USN example
 Decentralized
 Allows
assignment
services to move
 Change
IP address
 Change DNS name
38
Byebye message



Sent before device ceases to operate
NTS = ssdp:byebye
NT = service type
39
1 Discovery: Searching



Who? Control point multicasts
When? Looking for device or service
What?
M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
MAN: "ssdp:discover"
MX: seconds to delay response
ST: search target

ST one of





Service type
Device type
Device UUID
upnp:rootdevice
ssdp:all
40
Broadcast message

Can send message to all devices
 ssdp:
all
 Network analysis tool
 Remote control unit
41
1 Discovery: Responding



Who? Device unicasts
When? If ST matches an NT
What?
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
1
time for each NT that matches
 Very
simple matching
42
Network traffic

SSDP traffic on recovery after power outage.
 Control
 to
points will all send discover messages.
find printer
 In
large companies multicast admin domain will be
large
 Can
be entire company
 Need
a way for SSDP to deactivate before network
storms created
 Even with directory services, low-level SSDP may
activate
43
Bandwidth requirements
 TP
= some time period
 DR = # of clients sending discovery messages in TP
 RS = # of devices responding to each discover
message
 AM = average message size
 Bandwidth = (DR* 3 + DR*9*RS)*AM/TP
44
E.g. Network traffic
 100,
000 hosts
 5,000 printers
 Requests evenly distributed over 30 second period
 Message size = 512 bytes
 Bandwidth = 585976 Megabits per second
45
E.g. Network traffic
 1000
hosts
 50 printers
 Requests evenly distributed over 30 second period
 Message size = 512 bytes
 Bandwidth = 59 Megabits per second
46
Steps to UPnP Networking
3 Control
4 Eventing
5 Presentation
2* Description
1 Discovery
0 Addressing
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
47
2 Description

Control point learns
about device
capabilities
UPnP vendor
0 get address
 1 discover device
UPnP Forum



2 retrieve descr


get URL for
description
get URL for
service description
Declare capabilities

Protocol stack
UPnP Device Architecture
HTTP
TCP
IP
48
2 Description

Device description

Type
Physical


container
Logical
container

Functional units
within devices
Service description
Actions
 State variables
 Actual (vs.
designed)
implementation

For each service
• Type
• URL for
description
• URL for control
• URL for eventing
Services

Expressed in XML
49
XML

Like HTML
 Describes

Unlike HTML
 Describes
 Style
 Tags
contents rather than UI
sheets describe UI
are user-defined
 Via

a tree
Schema Language (DDT)
Supported by Web browsers
50
2 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
51
2 Description: Device (phys)
<?xml version="1.0"?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
<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>
<URLBase>base URL for all relative URLs</URLBase>
<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>
52
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>
53
2 Description: Device (other)
<?xml version="1.0"?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
<device>
<URLBase>base URL for all relative URLs</URLBase>
<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>
54
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>
55
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>
56
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>
57
Steps to UPnP Networking
3* Control
4 Eventing
5 Presentation
2 Description
1 Discovery
0 Addressing
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
58
3 Control

Control point invokes
actions on device
0 get address
 1 discover device
 2 retrieve descr

Protocol stack
UPnP vendor

UPnP Device Architecture
get URL for
control
SOAP
3 send actions to
device
HTTP


UPnP Forum
TCP
IP
59
3 Control: SOAP Sidebar

What 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.
60
3 Control: Invoke Action



Who? Control point
When? To invoke action on device
What?
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>
other in args and their values (if any) go here
</u:actionName>
</s:Body>
</s:Envelope>
61
3 Control: Action Result



Who? Device
When? Action completes
What?
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>
other out args and their values (if any) go here
</u:actionNameResponse>
</s:Body>
</s:Envelope>
62
Steps to UPnP Networking
3 Control
4* Eventing
5 Presentation
2 Description
1 Discovery
0 Addressing
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
63
4 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

Protocol stack
UPnP vendor
UPnP Forum
UPnP Device Architecture
HTTP
GENA
TCP
IP


Basic push model
Simple
64
4 Eventing: GENA Sidebar

What is GENA?
 IETF
Draft General Event Notification
Architecture
 "Send and receive notifications using
HTTP over TCP/IP and administrativelyscoped multicast UDP."
 SUBSCRIBE
to notifications
 UNSUBSCRIBE
 NOTIFY
• Of device availability
• Of state variable changes
65
4 Eventing: Subscribing
Who? Control point
 When? Before receiving any events
 What?
SUBSCRIBE
publisher path HTTP/1.1

HOST: publisher host:publisher port
CALLBACK: <delivery URL>
NT: upnp:event
TIMEOUT: Second-requested subscription duration
66
4 Eventing: Subscription
Who? Device
 When? Accepts subscription
 200
What?
HTTP/1.1
OK

SID: uuid:subscription-UUID
TIMEOUT: Second-actual subscription duration
 Device
immediately sends a special,
initial event to control point with the value
of all evented variables
67
4 Eventing: Notify



Who? Device
When? A state variable changes
What?
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>
Other variable names and values (if any) go here
</e:propertyset>
68
Steps to UPnP Networking
3 Control
4 Eventing
5* Presentation
2 Description
1 Discovery
0 Addressing
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
69
5 Presentation

vendor
Control point controls UPnP

Protocol stack
device and/or views UPnP Device Architecture
device status using
HTML UI
HTTP
0 get address
 1 discover device
 2 retrieve descr




get URL for
presentation
TCP
IP
5 load presentation
page
(Don't constrain
implementation)
70
Example Device (Intel
Implementation)
TV Composite
 Control
Service
 Volume
 Power
 ….
 Picture
Service
 Color
 Tint
 Contrast
 ….
71
Example Composition
<?xml version="1.0" ?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
<URLBase>http://192.168.0.4:5431</URLBase>
72
Example Composition
<device>
<deviceType>urn:schemas-upnp- org:device:tvdevice:1</deviceType>
<friendlyName>UPnP Television Emulator</friendlyName>
<manufacturer>TV Manufacturer Name</manufacturer>
<manufacturerURL>http://www.manufacturer.com</manufacturerURL>
<modelDescription>UPnP Television Device Emulator
1.0</modelDescription>
<modelName>TVEmulator</modelName>
<modelNumber>1.0</modelNumber>
<modelURL>http://www.manufacturer.com/TVEmulator/</modelURL>
<serialNumber>123456789001</serialNumber>
<UDN>uuid:Upnp-TVEmulator-1_0-1234567890001</UDN>
<UPC>123456789</UPC>
73
Example Service Composition
<serviceList>
<service>
<serviceType>urn:schemas-upnporg:service:tvcontrol:1</serviceType>
<serviceId>urn:upnp-org:serviceId:tvcontrol1</serviceId>
<controlURL>/upnp/control/tvcontrol1</controlURL>
<eventSubURL>/upnp/event/tvcontrol1</eventSubURL>
<SCPDURL>/tvcontrolSCPD.xml</SCPDURL>
</service>
<service>
<serviceType>urn:schemas-upnporg:service:tvpicture:1</serviceType>
<serviceId>urn:upnp-org:serviceId:tvpicture1</serviceId>
<controlURL>/upnp/control/tvpicture1</controlURL>
<eventSubURL>/upnp/event/tvpicture1</eventSubURL>
<SCPDURL>/tvpictureSCPD.xml</SCPDURL>
</service>
</serviceList>
</device>
74
Example Service
<?xml version="1.0" ?>
<scpd xmlns="urn:schemas-upnp-org:service-1-0">
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
75
Example Action List
<actionList>
<action>
<name>PowerOn</name>
</action>
<action>
<name>SetChannel</name>
<argumentList>
<argument>
<name>Channel</name>
<relatedStateVariable>Channel</relatedStateVariable>
<direction>in</direction>
</argument>
</argumentList>
</action>
….
<actionList>
76
Example Variables
<serviceStateTable>
<stateVariable sendEvents="yes">
<name>Power</name>
<dataType>Boolean</dataType>
<defaultValue>0</defaultValue>
</stateVariable>
<stateVariable sendEvents="yes">
<name>Channel</name>
<dataType>i4</dataType>
<allowedValueRange>
<minimum>1</minimum>
<maximum>100</maximum>
<step>1</step>
</allowedValueRange>
<defaultValue>1</defaultValue>
</stateVariable>
…..
</serviceStateTable>
77
Example Presentation
Described using HTML
78
Example Server Code
Object processMessages (Message message) {
switch (message.kind)
case GET_VAR_REQUEST:
switch ((GetVarMessage) message).varName)
case “Channel”: message.result = getChannel();
…
case ACTION_REQUEST:
actionMessage = (ActionMessage) message.
switch (actionMessage.actionName)
case “setChannel”: setChannel(parseString(actionMessage.params[0]))
…
}
int channel;
int getChannel () { return curentChannel};
void setChannel (int newChannel) {
channel = newChannel;
UPnP.announce(“Channel”, toString(getChannel());
}
...
79
Another Example: Composite
greater than sum of parts
TV Composite
 Simply

combines services
CD Composite
 Adds
services
 Record with fields vs Object with instance
variables
80
CD Example
disc
disc
disc
(empty)
Changer
(empty)
disc
disc
disc tray
disc
(empty)
disc
(empty)
carousel
disc tray door
(closed)
Player
CD
Composite
Audio
Power
•When disc insertion event received play CD
• Play random (CD)
81
Elaborate Scenario

New DVD player connected to network
 Assigns
itself an IP address after looking for
DHCP several times or Auto-IP
 Sends advertisement, possibly multiple times
because UDP

Father brings laptop home
 Assigns

address and sends advertisement
Video remote control started
 Searches
for and displays Video devices
82
Elaborate Scenario

DVD selected by father
 Controller
retrieves description/presentation
URL
 User can choose between using URL or
controller UI





Run invoked on DVD
Run time of current disc can be queried
Clock flashing
Retrieves clock synchronizer from disk server
Clock synchronizer finds clocks and syncs
them
83
Elaborate Scenario




Father prints file
Printer out ink message appears on father’s
and son’s computers
Son fixes it. Needs printer in room to print HW
Disconnects printer
 Bye

Moves printer to room
 IP

bye message sent and seen by father
assignment and advertisement
Mother presses button for mood control
 Lights
get dimmed, shades down, soft music
starts, laptop shuts down
84
Issues raised by UPnP
3 Control
4 Eventing
5 Presentation
2 Description
1 Discovery
0 Addressing
0 Control point and device get addresses (Auto IP)
1 Control point finds interesting device (push/pull multicast,
type)
2 Control point learns about device capabilities (XML)
3 Control point invokes actions on device (SOAP)
4 Control point listens to state changes of device (GENA)
5 Control point controls device and/or views device status
using HTML UI
85
Issues raised by UPnP

Scaling problem of multicast-based discovery
 Auto






Shut off problem
Simple-minded search
Lack of access and concurrency control
Static, manual, procedural service composition
Device-independent UI
No programmer-defined types
High programming and maintenance costs
86
Auto-Shutoff

Auto Shut off problem
Network storm when devices reboot in sync
 Combine address discovery and routing

87
Simple-minded Search Facilities

Choices
 All
 Service
type
 Device Type
 Specific

Complex queries
 Attributes?
88
Lack of Control

Ignores access control.
 prevents
 turning
 prevents
accidents
on neighbor’s TV
intentional sabotage
 opening
garage door to steal
 Classic AC

applicable?
Ignores concurrency control.
 Two
remote users concurrently setting thermostat
 Two users editing VCR settings offline
 Classic CC applicable?
 Mobile CC applicable?
89
Static, Manual, Procedural
Composition

Dynamic collections
 e.g. All
lamps in a room
 All services explicitly statically enumerated in UPnP
 Must create a new description when new service added
to collection
 new

lamp to room
Declarative/automatic composition
 issue
when composite greater than sum of parts
 low-level procedural code to add functionality in UPnP
 play
CD when disc inserted
 set printer output to camera
 distribute multi-media presentation to audio and video
devices
90
Device-Independent UI
Fixed UI for all devices
 may
wish one specific to interactive computer used
 palm
computers and laptops have different form
factors and I/O capabilities
 may wish to show each variable in separate screen.
 the
kind of interactive computer may not be known
when service defined
91
No Programmer-Defined Types

XML 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
92
No Programmer-Defined Types

Only supports predefined types
 state
variables
 action parameters

No way to model dynamic composites
Dynamic
programmerdefined
collection
93
High Programming Cost

Device developer must:
 define
the XML-based external representation of
the device
 translate the client operation-invocation and
variable-access requests to local operationinvocations
 announce variable change notifications

Exporting functionality requires more code than
implementing it in example Intel device
 not

counting UI code
Cost proportional to complexity of type.
 Reason
for not allowing complex types?
94
High Maintenance Cost

Information repeated multiple times
 operation
implementation code
 action
list
 state variable table
 message processing code
 event announcement code

All repetitions must be changed
 tedious
 error-prone

Channel -> Current Channel requires 9 changes!
95
Changed Action List
<actionList>
<action>
<name>PowerOn</name>
</action>
<action>
<name>SetCurrentChannel</name>
<argumentList>
<argument>
<name>CurrentChannel</name>
<relatedStateVariable>CurrentChannel</relatedStateVariable>
<direction>in</direction>
</argument>
</argumentList>
</action>
….
<actionList>
96
Changed State Variable Table
<serviceStateTable>
<stateVariable sendEvents="yes">
<name>Power</name>
<dataType>Boolean</dataType>
<defaultValue>0</defaultValue>
</stateVariable>
<stateVariable sendEvents="yes">
<name>CurrentChannel</name>
<dataType>i4</dataType>
<allowedValueRange>
<minimum>1</minimum>
<maximum>100</maximum>
<step>1</step>
</allowedValueRange>
<defaultValue>1</defaultValue>
</stateVariable>
…..
</serviceStateTable>
97
Changed Server Code
Object processMessages (Message message) {
switch (message.kind)
case GET_VAR_REQUEST:
switch ((GetVarMessage) message).varName)
case “CurrentChannel”: message.result = getCurrentChannel();
…
case ACTION_REQUEST:
actionMessage = (ActionMessage) message.
switch (actionMessage.actionName)
case “setCurrentChannel”:
setCurrentChannel(parseString(actionMessage.params[0]))
…
}
int channel;
int getCurrentChannel () {return channel};
void setCurrentChannel (int newChannel) {
channel = newChannel;
UPnP.announce(“CurrentChannel”, toString(getCurrentChannel());
}
98
Ideal Developer Effort
int getChannel () { return channel};
void setChannel (int newChannel) {
channel = newChannel;
}
...
99
Issues raised by UPnP

Scaling problem of multicast-based discovery
 Auto






Shut off problem
Simple-minded search
Lack of access and concurrency control
Static, manual, procedural service composition
Device-independent UI
No programmer-defined types
High programming and maintenance costs
100