1k likes | 1.22k Views
Device Servers. Prasun Dewan. Department of Computer Science University of North Carolina dewan@unc.edu. Issues in Device Servers. Device is just a server. So what is different?. Network. Sever and network is always around - static address
E N D
Device Servers Prasun Dewan Department of Computer Science University of North Carolina dewan@unc.edu
Issues in Device Servers • Device is just a server. • So what is different? Network
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 Addressing Devices 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 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 Communicating with Device vs. Traditional Servers
Run preloaded client user-interface program xmh netscape Because of late binding, client UI program may not exist Implies dynamic user-interface deployment Deploying Remote User Interfaces
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. Composing Devices
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
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
Today Attach it to server PC Load device driver Share printer Manually bind each client to printer Vision Just connect printer to network UPNP Examples: Installing a printer
Today Attach a new disk drive to computer Vision Just connect drive to network Installing a device store
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 Intelligent Alarm clock
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 Arriving/leaving home
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 Arriving/leaving town
Today Manually set all clocks Vision They automatically synchronize with an a networked atomic clock Script runs periodically or when power comes on Power outage
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
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
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
Control Point Device Service Control Point Device Service Architecture/Terminology • Components • Control points • Controller, usually client • Device • Controlled,usually server • An actual devicemight containboth functions
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 1 Service 2 Control Service Server State Event Table Server Architecture
3 Control 4 Eventing 5 Presentation 2 Description 1 Discovery 0 Addressing 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 device status using HTML UI
Standardized Schema Instances (Types) URLs, Model, Device # Schemas (Prog Lang) UPnP vendor UPnP Forum UPnP Device Architecture HTTPU/MU SOAP HTTP GENA SSDP GENA HTTP UDP TCP IP Name Discovery and Events State Events Capability Discovery Operation Control UPnP Protocol Stack Vendor-specific API aboveVendor-specific OS below Wire protocols Multiple http servers
Steps to UPnP Networking 3 Control 4 Eventing 5 Presentation 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
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
Steps to UPnP Networking 3 Control 4 Eventing 5 Presentation 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
1 Discovery: Pull (Active) vs. Push (Passive) Server Client • 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
Client Server 1 Discovery: Pull (Active) vs. Push (Passive) Server • 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
1 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
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 1 Discovery
UPnP vendor UPnP Forum UPnP Device Architecture HTTPMU(multicast) HTTPU(unicast) GENA SSDP SSDP UDP IP 1 Discovery: Protocol Stack
Multicast address Port 1 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 == 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 device NT:search targetNTS:ssdp:aliveUSN:advertisement UUID
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”
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?
Location 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
Byebye message • Sent before device ceases to operate • NTS = ssdp:byebye • NT = service type
1 Discovery: Searching • Who? Control point multicasts • When? Looking for device or service • What? • ST one of • Service type • Device type • Device UUID • upnp:rootdevice • ssdp:all M-SEARCH * HTTP/1.1HOST:239.255.255.250:1900 MAN:"ssdp:discover"MX:seconds to delay response ST:search target
Broadcast message • Can send message to all devices • ssdp: all • Network analysis tool • Remote control unit
1 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
Network 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
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
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
E.g. Network traffic • 1000 hosts • 50 printers • Requests evenly distributed over 30 second period • Message size = 512 bytes • Bandwidth = 59 Megabits per second
Steps to UPnP Networking 3 Control 4 Eventing 5 Presentation 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
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 Protocol stack UPnP vendor UPnP Forum UPnP Device Architecture HTTP TCP IP 2 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 2 Description
XML • 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