Title: Device Servers
1Device Servers
Prasun Dewan
Department of Computer Science University of
North Carolina dewan_at_unc.edu
2Issues in Device Servers
- Device is just a server.
- So what is different?
Network
3Addressing 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
- 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 - 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
- Implies later binding and thus a discovery phase
4Communicating 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
5Communicating 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
6Deploying Remote User Interfaces
- Run preloaded client user-interface program
- xmh
- netscape
- Because of late binding, client UI program may
not exist - Implies dynamic user-interface deployment
7Composing 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.
8UPnP (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
9UPnP 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
10UPNP 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
11Installing a device store
- Today
- Attach a new disk drive to computer
- Vision
- Just connect drive to network
12Intelligent Alarm clock
- Today
- Set alarm clock
- May vary depending on weekday or weekend
- Set thermostat
- Hope meeting not missed
- Vision
- Alarm clock tells PC
- It runs script that checks schedule and sets
thermostat
13Arriving/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
14Arriving/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
15Power outage
- Today
- Manually set all clocks
- Vision
- They automatically synchronize with an a
networked atomic clock - Script runs periodically or when power comes on
16Home 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
17Ball 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
18Other apps
- Appliance remotely fixed or set
- Calendars of family members synchronized
- Product barcode scanned to order new instance
- Presentation displayed on discovered display
devices
19UPnP Device Architecture
20Architecture/Terminology
- Components
- Control points
- Controller, usually client
- Device
- Controlled,usually server
- An actual devicemight containboth functions
21Architecture
22Example Configuration
23Steps 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
24UPnP Protocol Stack
- Vendor-specific API aboveVendor-specific
OS below
Wire protocols
Multiple http servers
25Steps to UPnP Networking
5 Presentation
4 Eventing
3 Control
- 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
2 Description
1 Discovery
0 Addressing
260 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
27Overview -ad hoc
28Overview - configured
29Steps to UPnP Networking
5 Presentation
4 Eventing
3 Control
- 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
2 Description
1 Discovery
0 Addressing
301 Discovery Pull (Active) vs. Push (Passive)
- Client (Control point) could pull info
- Servers could be dynamically added
- Needs to poll for new devices
- Server (Device) could push advertisement
- Control points can be dynamically added
- Needs to continuously send info, using network
Server
Client
Server
Client
311 Discovery Pull (Active) vs. Push (Passive)
- 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
321 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
331 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
341 Discovery Protocol Stack
351 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 upnprootdevice
NOTIFY HTTP/1.1HOST 239.255.255.2501900
CACHE-CONTROL max-age seconds until
advertisement expiresLOCATION URL for UPnP
description for root device
NT search targetNTS ssdpaliveUSN
advertisement UUID
36GENA
- 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
37Multicast 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?
38Location vs. USN
- Location needed to send messages
- USN a unique, location-independent ID
- UUID is a USN example
- Decentralized assignment
- Allows services to move
- Change IP address
- Change DNS name
39Byebye message
- Sent before device ceases to operate
- NTS ssdpbyebye
- NT service type
401 Discovery Searching
- Who? Control point multicasts
- When? Looking for device or service
- What?
- ST one of
- Service type
- Device type
- Device UUID
- upnprootdevice
- ssdpall
M-SEARCH HTTP/1.1HOST 239.255.255.2501900
MAN "ssdpdiscover"MX seconds to delay response
ST search target
41Broadcast message
- Can send message to all devices
- ssdp all
- Network analysis tool
- Remote control unit
421 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 OKCACHE-CONTROL max-age seconds
until advertisement expires
LOCATION URL for UPnP description for root
deviceST search targetUSN advertisement UUID
43Network traffic
- SSDP traffic on recovery after power outage.
- Control points will all send discover messages.
- to 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
44Bandwidth 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 DR9RS)AM/TP
45E.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
46E.g. Network traffic
- 1000 hosts
- 50 printers
- Requests evenly distributed over 30 second period
- Message size 512 bytes
- Bandwidth 59 Megabits per second
47Steps to UPnP Networking
5 Presentation
4 Eventing
3 Control
- 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
2 Description
1 Discovery
0 Addressing
482 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
492 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
50XML
- Like HTML
- Describes a tree
- Unlike HTML
- Describes contents rather than UI
- Style sheets describe UI
- Tags are user-defined
- Via Schema Language (DDT)
- Supported by Web browsers
512 Description XML Sidebar
- What is XML?
- W3C Recommendation Extensible Markup Language
- "Universal format for structured documents and
data on the Web." - Field names in ltangle bracketsgt
- 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
522 Description Device (phys)
lt?xml version"1.0"?gtltroot xmlns"urnschemas-upn
p-orgdevice-1-0"gt ltURLBasegtbase URL for all
relative URLslt/URLBasegt ltdevicegt
ltfriendlyNamegtshort user-friendly
titlelt/friendlyNamegt ltmanufacturergtmanufacture
r namelt/manufacturergt ltmanufacturerURLgtURL to
manufacturer sitelt/manufacturerURLgt
ltmodelDescriptiongtlong user-friendly
titlelt/modelDescriptiongt ltmodelNamegtmodel
namelt/modelNamegt ltmodelNumbergtmodel
numberlt/modelNumbergt ltmodelURLgtURL to model
sitelt/modelURLgt ltserialNumbergtmanufacturer's
serial numberlt/serialNumbergt
ltUDNgtuuidUUIDlt/UDNgt ltUPCgtUniversal Product
Codelt/UPCgt ltdeviceTypegturnschemas-upnp-orgde
vicedeviceTypelt/deviceTypegt
ltserviceListgt ltservicegt
ltserviceTypegturnschemas-upnp-orgserviceserviceT
ypevlt/serviceTypegt ltserviceIdgturnupnp-or
gserviceIdserviceIDlt/serviceIdgt
ltSCPDURLgtURL to service descriptionlt/SCPDURLgt
ltcontrolURLgtURL for controllt/controlURLgt
lteventSubURLgtURL for eventinglt/eventSubURLgt
lt/servicegt Declarations for other
services (if any) go here lt/serviceListgt
ltdeviceListgtDescription of embedded devices (if
any) go herelt/deviceListgt lticonListgt
lticongt ltmimetypegtimage/formatlt/mimetypegt
ltwidthgthorizontal pixelslt/widthgt
ltheightgtvertical pixelslt/heightgt
ltdepthgtcolor depthlt/depthgt lturlgtURL to
iconlt/urlgt lt/icongt XML to declare
other icons, if any, go here lt/iconListgt
ltpresentationURLgtURL for presentationlt/presentatio
nURLgt lt/devicegt ltspecVersiongt
ltmajorgt1lt/majorgt ltminorgt0lt/minorgt
lt/specVersiongtlt/rootgt
532 Description Device (logical)
lt?xml version"1.0"?gtltroot xmlns"urnschemas-upn
p-orgdevice-1-0"gt ltURLBasegtbase URL for all
relative URLslt/URLBasegt ltdevicegt
ltfriendlyNamegtshort user-friendly
titlelt/friendlyNamegt ltmanufacturergtmanufacture
r namelt/manufacturergt ltmanufacturerURLgtURL to
manufacturer sitelt/manufacturerURLgt
ltmodelDescriptiongtlong user-friendly
titlelt/modelDescriptiongt ltmodelNamegtmodel
namelt/modelNamegt ltmodelNumbergtmodel
numberlt/modelNumbergt ltmodelURLgtURL to model
sitelt/modelURLgt ltserialNumbergtmanufacturer's
serial numberlt/serialNumbergt
ltUDNgtuuidUUIDlt/UDNgt ltUPCgtUniversal Product
Codelt/UPCgt ltdeviceTypegturnschemas-upnp-orgde
vicedeviceType vlt/deviceTypegt
ltserviceListgt ltservicegt
ltserviceTypegturnschemas-upnp-orgserviceserviceT
ypevlt/serviceTypegt ltserviceIdgturnupnp-or
gserviceIdserviceIDlt/serviceIdgt
ltSCPDURLgtURL to service descriptionlt/SCPDURLgt
ltcontrolURLgtURL for controllt/controlURLgt
lteventSubURLgtURL for eventinglt/eventSubURLgt
lt/servicegt Declarations for other
services (if any) go here lt/serviceListgt
ltdeviceListgtDescription of embedded devices (if
any) go herelt/deviceListgt lticonListgt
lticongt ltmimetypegtimage/formatlt/mimetypegt
ltwidthgthorizontal pixelslt/widthgt
ltheightgtvertical pixelslt/heightgt
ltdepthgtcolor depthlt/depthgt lturlgtURL to
iconlt/urlgt lt/icongt XML to declare
other icons, if any, go here lt/iconListgt
ltpresentationURLgtURL for presentationlt/presentatio
nURLgt lt/devicegt ltspecVersiongt
ltmajorgt1lt/majorgt ltminorgt0lt/minorgt
lt/specVersiongtlt/rootgt
542 Description Device (other)
lt?xml version"1.0"?gtltroot xmlns"urnschemas-upn
p-orgdevice-1-0"gt ltURLBasegtbase URL for all
relative URLslt/URLBasegt ltdevicegt
ltfriendlyNamegtshort user-friendly
titlelt/friendlyNamegt ltmanufacturergtmanufacture
r namelt/manufacturergt ltmanufacturerURLgtURL to
manufacturer sitelt/manufacturerURLgt
ltmodelDescriptiongtlong user-friendly
titlelt/modelDescriptiongt ltmodelNamegtmodel
namelt/modelNamegt ltmodelNumbergtmodel
numberlt/modelNumbergt ltmodelURLgtURL to model
sitelt/modelURLgt ltserialNumbergtmanufacturer's
serial numberlt/serialNumbergt
ltUDNgtuuidUUIDlt/UDNgt ltUPCgtUniversal Product
Codelt/UPCgt ltdeviceTypegturnschemas-upnp-orgdev
icedeviceTypelt/deviceTypegt
ltserviceListgt ltservicegt
ltserviceTypegturnschemas-upnp-orgserviceserviceT
ypevlt/serviceTypegt ltserviceIdgturnupnp-or
gserviceIdserviceIDlt/serviceIdgt
ltSCPDURLgtURL to service descriptionlt/SCPDURLgt
ltcontrolURLgtURL for controllt/controlURLgt
lteventSubURLgtURL for eventinglt/eventSubURLgt
lt/servicegt Declarations for other
services (if any) go here lt/serviceListgt
ltdeviceListgtDescription of embedded devices (if
any) go herelt/deviceListgt lticonListgt
lticongt ltmimetypegtimage/formatlt/mimetypegt
ltwidthgthorizontal pixelslt/widthgt
ltheightgtvertical pixelslt/heightgt
ltdepthgtcolor depthlt/depthgt lturlgtURL to
iconlt/urlgt lt/icongt XML to declare
other icons, if any, go here lt/iconListgt
ltpresentationURLgtURL for presentationlt/presentatio
nURLgt lt/devicegt ltspecVersiongt
ltmajorgt1lt/majorgt ltminorgt0lt/minorgt
lt/specVersiongtlt/rootgt
552 Description Service (actns)
lt?xml version"1.0"?gtltscpd xmlns"urnschemas-upn
p-orgservice-1-0"gt ltactionListgt
ltactiongt ltnamegtactionNamelt/namegt
ltargumentListgt ltargumentgt
ltnamegtformalParameterNamelt/namegt
ltdirectiongtin xor outlt/directiongt
ltretval /gt ltrelatedStateVariablegtstateVa
riableNamelt/relatedStateVariablegt
lt/argumentgt Declarations for other
arguments (if any) go here
lt/argumentListgt lt/actiongt Declarations
for other actions (if any) go here
lt/actionListgt ltserviceStateTablegt
ltstateVariable sendEventsyes xor nogt
ltnamegtvariableNamelt/namegt
ltdataTypegtvariable datatypelt/dataTypegt
ltdefaultValuegtdefault valuelt/defaultValuegt
ltallowedValueRangegt ltminimumgtminimum
valuelt/minimumgt ltmaximumgtmaximum
valuelt/maximumgt ltstepgtincrement
valuelt/stepgt lt/allowedValueRangegt
lt/stateVariablegt ltstateVariable
sendEventsyes xor nogt
ltnamegtvariableNamelt/namegt
ltdataTypegtvariable data typelt/dataTypegt
ltdefaultValuegtdefault valuelt/defaultValuegt
ltallowedValueListgt ltallowedValuegtsome
valuelt/allowedValuegt ltallowedValuegtsome
valuelt/allowedValuegt lt/allowedValueListgt
lt/stateVariablegt Declarations for other
state variables (if any) go here
lt/serviceStateTablegt ltspecVersiongt
ltmajorgt1lt/majorgt ltminorgt0lt/minorgt
lt/specVersiongtlt/scpdgt
562 Description Service (vars)
lt?xml version"1.0"?gtltscpd xmlns"urnschemas-upn
p-orgservice-1-0"gt ltactionListgt
ltactiongt ltnamegtactionNamelt/namegt
ltargumentListgt ltargumentgt
ltnamegtformalParameterNamelt/namegt
ltdirectiongtin xor outlt/directiongt
ltretval /gt ltrelatedStateVariablegtstateVa
riableNamelt/relatedStateVariablegt
lt/argumentgt Declarations for other
arguments (if any) go here
lt/argumentListgt lt/actiongt Declarations
for other actions (if any) go here
lt/actionListgt ltserviceStateTablegt
ltstateVariable sendEventsyes xor nogt
ltnamegtvariableNamelt/namegt
ltdataTypegtvariable datatypelt/dataTypegt
ltdefaultValuegtdefault valuelt/defaultValuegt
ltallowedValueRangegt ltminimumgtminimum
valuelt/minimumgt ltmaximumgtmaximum
valuelt/maximumgt ltstepgtincrement
valuelt/stepgt lt/allowedValueRangegt
lt/stateVariablegt ltstateVariable
sendEventsyes xor nogt
ltnamegtvariableNamelt/namegt
ltdataTypegtvariable data typelt/dataTypegt
ltdefaultValuegtdefault valuelt/defaultValuegt
ltallowedValueListgt ltallowedValuegtsome
valuelt/allowedValuegt ltallowedValuegtsome
valuelt/allowedValuegt lt/allowedValueListgt
lt/stateVariablegt Declarations for other
state variables (if any) go here
lt/serviceStateTablegt ltspecVersiongt
ltmajorgt1lt/majorgt ltminorgt0lt/minorgt
lt/specVersiongtlt/scpdgt
572 Description Service (vars)
lt?xml version"1.0"?gtltscpd xmlns"urnschemas-upn
p-orgservice-1-0"gt ltactionListgt
ltactiongt ltnamegtactionNamelt/namegt
ltargumentListgt ltargumentgt
ltnamegtformalParameterNamelt/namegt
ltdirectiongtin xor outlt/directiongt
ltretval /gt ltrelatedStateVariablegtstateVa
riableNamelt/relatedStateVariablegt
lt/argumentgt Declarations for other
arguments (if any) go here
lt/argumentListgt lt/actiongt Declarations
for other actions (if any) go here
lt/actionListgt ltserviceStateTablegt
ltstateVariable sendEventsyes xor nogt
ltnamegtvariableNamelt/namegt
ltdataTypegtvariable datatypelt/dataTypegt
ltdefaultValuegtdefault valuelt/defaultValuegt
ltallowedValueRangegt ltminimumgtminimum
valuelt/minimumgt ltmaximumgtmaximum
valuelt/maximumgt ltstepgtincrement
valuelt/stepgt lt/allowedValueRangegt
lt/stateVariablegt ltstateVariable
sendEventsyes xor nogt
ltnamegtvariableNamelt/namegt
ltdataTypegtvariable data typelt/dataTypegt
ltdefaultValuegtdefault valuelt/defaultValuegt
ltallowedValueListgt ltallowedValuegtsome
valuelt/allowedValuegt ltallowedValuegtsome
valuelt/allowedValuegt lt/allowedValueListgt
lt/stateVariablegt Declarations for other
state variables (if any) go here
lt/serviceStateTablegt ltspecVersiongt
ltmajorgt1lt/majorgt ltminorgt0lt/minorgt
lt/specVersiongtlt/scpdgt
58Steps to UPnP Networking
5 Presentation
4 Eventing
3 Control
- 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
2 Description
1 Discovery
0 Addressing
593 Control
- Control point invokes actions on device
- 0 get address
- 1 discover device
- 2 retrieve descr
- get URL for control
- 3 send actions to device
603 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.
613 Control Invoke Action
- Who? Control point
- When? To invoke action on device
- What?
POST path of control URL HTTP/1.1HOST host of
control URLport of control URLCONTENT-TYPE
text/xml charset"utf-8"SOAPACTION
"urnschemas-upnp-orgserviceserviceTypevaction
Name"
ltsEnvelope xmlnss"http//schemas.xmlsoap.org/so
ap/envelope/" sencodingStyle"http//schemas.
xmlsoap.org/soap/encoding/"gt ltsBodygt
lt/sBodygtlt/sEnvelopegt
ltuactionName xmlnsu"urnschemas-upnp-orgse
rviceserviceTypev"gt ltargumentNamegtin arg
valuelt/argumentNamegt other in args and
their values (if any) go here lt/uactionNamegt
623 Control Action Result
- Who? Device
- When? Action completes
- What?
HTTP/1.1 200 OKCONTENT-TYPE text/xml
charset"utf-8" ltsEnvelope xmlnss"http//schem
as.xmlsoap.org/soap/envelope/"
sencodingStyle"http//schemas.xmlsoap.org/soap/e
ncoding/"gt ltsBodygt lt/sBodygtlt/sEnvelop
egt
ltuactionNameResponse
xmlnsu"urnschemas-upnp-orgserviceserviceType
v"gt ltargumentNamegtout arg
valuelt/argumentNamegt other out args and
their values (if any) go here
lt/uactionNameResponsegt
63Steps to UPnP Networking
5 Presentation
4 Eventing
3 Control
- 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
2 Description
1 Discovery
0 Addressing
644 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
- Basic push model
- Simple
654 Eventing GENA Sidebar
- What is GENA?
- IETF Draft General Event Notification
Architecture - "Send and receive notifications using HTTP over
TCP/IP and administratively-scoped multicast
UDP." - SUBSCRIBE to notifications
- UNSUBSCRIBE
- NOTIFY
- Of device availability
- Of state variable changes
664 Eventing Subscribing
- Who? Control point
- When? Before receiving any events
- What?
SUBSCRIBE publisher path HTTP/1.1HOST publisher
hostpublisher port
CALLBACK ltdelivery URLgtNT upnpeventTIMEOUT
Second-requested subscription duration
674 Eventing Subscription
- Who? Device
- When? Accepts subscription
- What?
- Device immediately sends a special, initial event
to control point with the value of all evented
variables
HTTP/1.1 200 OKSID uuidsubscription-UUID
TIMEOUT Second-actual subscription duration
684 Eventing Notify
- Who? Device
- When? A state variable changes
- What?
NOTIFY delivery path HTTP/1.1HOST delivery
hostdelivery portCONTENT-TYPE
text/xml
NT upnpeventNTS upnppropchange
SID uuidsubscription-UUIDSEQ event key
ltepropertyset xmlnse"urnschemas-upnp-orgevent
-1-0"gt ltepropertygt ltvariableNamegtnew
valuelt/variableNamegt lt/epropertygt Other
variable names and values (if any) go
herelt/epropertysetgt
69Steps to UPnP Networking
5 Presentation
4 Eventing
3 Control
- 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
2 Description
1 Discovery
0 Addressing
705 Presentation
- Control point controls device and/or views device
status using HTML UI - 0 get address
- 1 discover device
- 2 retrieve descr
- get URL for presentation
- 5 load presentation page
- (Don't constrain implementation)
71Example Device (Intel Implementation)
- TV Composite
- Control Service
- Volume
- Power
- .
- Picture Service
- Color
- Tint
- Contrast
- .
72Example Composition
lt?xml version"1.0" ?gt ltroot
xmlns"urnschemas-upnp-orgdevice-1-0"gt
ltspecVersiongt ltmajorgt1lt/majorgt
ltminorgt0lt/minorgt lt/specVersiongt
ltURLBasegthttp//192.168.0.45431lt/URLBasegt
73Example Composition
ltdevicegt ltdeviceTypegturnschemas-upnp-
orgdevicetvdevice1lt/deviceTypegt
ltfriendlyNamegtUPnP Television Emulatorlt/friendlyNa
megt ltmanufacturergtTV Manufacturer
Namelt/manufacturergt ltmanufacturerURLgthttp/
/www.manufacturer.comlt/manufacturerURLgt
ltmodelDescriptiongtUPnP Television Device Emulator
1.0lt/modelDescriptiongt ltmodelNamegtTVEmulato
rlt/modelNamegt ltmodelNumbergt1.0lt/modelNumber
gt ltmodelURLgthttp//www.manufacturer.com/TV
Emulator/lt/modelURLgt ltserialNumbergt12345678
9001lt/serialNumbergt ltUDNgtuuidUpnp-TVEmulat
or-1_0-1234567890001lt/UDNgt
ltUPCgt123456789lt/UPCgt
74Example Service Composition
ltserviceListgt ltservicegt
ltserviceTypegturnschemas-upnp-orgservicetvcontro
l1lt/serviceTypegt ltserviceIdgturnupnp-org
serviceIdtvcontrol1lt/serviceIdgt
ltcontrolURLgt/upnp/control/tvcontrol1lt/controlURLgt
lteventSubURLgt/upnp/event/tvcontrol1lt/eve
ntSubURLgt ltSCPDURLgt/tvcontrolSCPD.xmllt/S
CPDURLgt lt/servicegt ltservicegt
ltserviceTypegturnschemas-upnp-orgservicetvpictur
e1lt/serviceTypegt ltserviceIdgturnupnp-or
gserviceIdtvpicture1lt/serviceIdgt
ltcontrolURLgt/upnp/control/tvpicture1lt/controlURLgt
lteventSubURLgt/upnp/event/tvpicture1lt/even
tSubURLgt ltSCPDURLgt/tvpictureSCPD.xmllt/SCP
DURLgt lt/servicegt lt/serviceListgt lt/devicegt
75Example Service
lt?xml version"1.0" ?gt ltscpd xmlns"urnschemas-u
pnp-orgservice-1-0"gt ltspecVersiongt
ltmajorgt1lt/majorgt ltminorgt0lt/minorgt
lt/specVersiongt
76Example Action List
ltactionListgt ltactiongt
ltnamegtPowerOnlt/namegt lt/actiongt
ltactiongt ltnamegtSetChannellt/namegt
ltargumentListgt ltargumentgt
ltnamegtChannellt/namegt ltrelatedStateVariable
gtChannellt/relatedStateVariablegt
ltdirectiongtinlt/directiongt
lt/argumentgt
lt/argumentListgt lt/actiongt
. ltactionListgt
77Example Variables
ltserviceStateTablegt ltstateVariable
sendEvents"yes"gt
ltnamegtPowerlt/namegt
ltdataTypegtBooleanlt/dataTypegt
ltdefaultValuegt0lt/defaultValuegt
lt/stateVariablegt ltstateVariable
sendEvents"yes"gt
ltnamegtChannellt/namegt
ltdataTypegti4lt/dataTypegt
ltallowedValueRangegt
ltminimumgt1lt/minimumgt
ltmaximumgt100lt/maximumgt
ltstepgt1lt/stepgt
lt/allowedValueRangegt
ltdefaultValuegt1lt/defaultValuegt
lt/stateVariablegt .. lt/serviceStateTablegt
78Example Presentation
Described using HTML
79Example 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.params0))
int channel int getChannel () return
curentChannel void setChannel (int newChannel)
channel newChannel
UPnP.announce(Channel, toString(getChannel())
...
80Another Example Composite greater than sum of
parts
- TV Composite
- Simply combines services
- CD Composite
- Adds services
- Record with fields vs Object with instance
variables
81CD Example
- When disc insertion event received play CD
- Play random (CD)
82Elaborate 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
83Elaborate 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
84Elaborate Scenario
- Father prints file
- Printer out ink message appears on fathers and
sons computers - Son fixes it. Needs printer in room to print HW
- Disconnects printer
- Bye bye message sent and seen by father
- Moves printer to room
- IP assignment and advertisement
- Mother presses button for mood control
- Lights get dimmed, shades down, soft music
starts, laptop shuts down
85Issues raised by UPnP
- 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
86Issues 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
87Auto-Shutoff
- Auto Shut off problem
- Network storm when devices reboot in sync
- Combine address discovery and routing
88Simple-minded Search Facilities
- Choices
- All
- Service type
- Device Type
- Specific
- Complex queries
- Attributes?
89Lack of Control
- Ignores access control.
- prevents accidents
- turning on neighbors TV
- prevents 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?
90Static, 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
91Device-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
92No 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
93No Programmer-Defined Types
- Only supports predefined types
- state variables
- action parameters
- No way to model dynamic composites
94High 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
operation-invocations - 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?
95High 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 -gt Current Channel requires 9 changes!
96Changed Action List
ltactionListgt ltactiongt
ltnamegtPowerOnlt/namegt lt/actiongt
ltactiongt ltnamegtSetCurrentChannellt/namegt
ltargumentListgt
ltargumentgt ltnamegtCurrentChannellt/namegt
ltrelatedStateVariabl
egtCurrentChannellt/relatedStateVariablegt
ltdirectiongtinlt/directiongt
lt/argumentgt
lt/argumentListgt lt/actiongt
. ltactionListgt
97Changed State Variable Table
ltserviceStateTablegt ltstateVariable
sendEvents"yes"gt
ltnamegtPowerlt/namegt
ltdataTypegtBooleanlt/dataTypegt
ltdefaultValuegt0lt/defaultValuegt
lt/stateVariablegt ltstateVariable
sendEvents"yes"gt
ltnamegtCurrentChannellt/namegt
ltdataTypegti4lt/dataTypegt
ltallowedValueRangegt
ltminimumgt1lt/minimumgt
ltmaximumgt100lt/maximumgt
ltstepgt1lt/stepgt
lt/allowedValueRangegt
ltdefaultValuegt1lt/defaultValuegt
lt/stateVariablegt .. lt/serviceStateTablegt
98Changed 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.params0)) int
channel int getCurrentChannel () return
channel void setCurrentChannel (int newChannel)
channel newChannel
UPnP.announce(CurrentChannel,
toString(getCurrentChannel()) ...
99Ideal Developer Effort
int getChannel () return channel void
setChannel (int newChannel) channel
newChannel ...
100Issues 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