狠狠撸

狠狠撸Share a Scribd company logo
Wen Liao
UPnP 1.0 簡介
台北市
Disclaimer
投影片資料為作者整理資料及個人意見,沒有經
過嚴謹確認,請讀者自行斟酌
测试环境
测试环境
测试环境
UPnP 1.0 簡介
测试环境
關於UPnP
● Universal Plug and Play
○ 一種網路通訊協定
○ 目的:萬用遙控器
■ 不用安裝Driver
■ 不用安裝指定的軟體
■ 適用於所有支援UPnP的設備
萬用遙控器??
http://en.wikipedia.org/wiki/File:Remote_controls.JPG
萬用遙控器要處理的問題
● 以家電的遙控器比喻
○ 每個家電按鈕不同,功能不同,使用方式不同
■ 就算同一種家電,不同廠牌,甚至同廠牌不同型號
一樣有相同的問題
○ 要怎麼知道現在有那幾台設備可以用?
■ A牌電風扇
■ B牌播放器
■ C牌電燈
○ 要怎麼知道設備狀態?
每個家電按鈕不同,功能不同,使用方式
不同
● 大家講好規矩
● 主導者:UPnP forum
■ 很多大頭
○ 規範Device control protocols
■ AV
■ 電燈控制
■ 印表機
■ …
要怎麼知道現在有那幾台設備可以用?
● 遙控器大喊一聲看誰答話
● 設備有事沒事跟大家說我還活著,以及提供的
服務
要怎麼知道設備狀態?
● 遙控器直接問
● 遙控器告訴設備說哪些狀態更動的時候要跟
我說,如
○ 播放器更動播放內容
○ ...
觀念
● 整個控制可以分成兩個角色
○ 遙控器
○ 設備
● 遙控器的按鈕,可以看成呼叫服務
○ 將溫度設定成25度
○ 切到下一個頻道
● 接樓上,所以這是一個遠端呼叫的概念。洋人
的話就是remote procedure call,簡稱RPC
进入正题
正名
● Control point
○ 你的遙控器啦
● Device
○ 被遙控的東西
UPnP Networks Steps
Addressing
Discover
Description
Event
Presentation
http://upnp.org/sdcps-and-certification/standards/device-architecture-documents/
Control
什麼鬼?请讲中文好嘛?
講中文:Control point篇
● 知道自己在那邊。(跳過Auto IP,一言難盡)
● 先知道自己是啥,以媒體播放器(media
render)為例
○ 問看看網路上有沒有媒體播放器,有的請發聲
○ 當然不是問完以後就沒事,搞不好上線後十三分鐘後
有另外一個媒體播放器上線,你也得知道吧?
● 從剛才報數的媒體播放器中知道他有提供哪
些服務。
● 開工如訂閱媒體播放器的播放狀態、播放影
片,調整音量等
● Presentation呢?沒這東西(煙)
講中文:Device篇
● 知道自己在那邊。(跳過Auto IP,一言難盡)
● 先知道自己是啥,以媒體播放器(media
render)為例
○ 定期公佈,告訴大家,我是是媒體播放器唷。以下是我
的服務...
○ 有人來問你是不是媒體播放器要回答我是
● 開工如處理播放影片,調整音量,接受訂閱
event當trigger時通知control point等
● Presentation呢?看實作,有的話,你可以用瀏
覽器連上去更改一些設定
名詞
● HTTP
○ Hypertext Transfer Protocol
● HTTPU
○ U就是UDP
● HTTPMU
○ M是Multicast
○ U還是UDP
● HTTPD
○ Daemon ,就是web server
名詞
● SSDP
○ Simple Service Discovery Protocol
● SOAP
○ Simple Object Access protocol
● GENA
○ General Event Notification Architecture
無聊的方塊圖
TCP
IP
UDP
HTTP HTTPU HTTPMU
SOAP GENA HTTPD SSDP
UPnP Device Architecture
Device Control Protocols
APP/Libraries
http://upnp.org/sdcps-and-certification/standards/device-architecture-documents/
無聊的方塊圖
TCP
IP
UDP
HTTP HTTPU HTTPMU
SOAP GENA HTTPD SSDP
UPnP Device Architecture
Device Control Protocols
APP/Libraries
使用XML描述呼叫
遠端服務以及回傳
的結果
http://upnp.org/sdcps-and-certification/standards/device-architecture-documents/
無聊的方塊圖
TCP
IP
UDP
HTTP HTTPU HTTPMU
SOAP GENA HTTPD SSDP
UPnP Device Architecture
Device Control Protocols
APP/Libraries
註冊要監聽的event以
及當event被觸發回傳
使用的通訊協定
http://upnp.org/sdcps-and-certification/standards/device-architecture-documents/
無聊的方塊圖
TCP
IP
UDP
HTTP HTTPU HTTPMU
SOAP GENA HTTPD SSDP
UPnP Device Architecture
Device Control Protocols
APP/Libraries
Device有設定Presentation
URL的話總要有個提供網
頁的web server吧?
http://upnp.org/sdcps-and-certification/standards/device-architecture-documents/
無聊的方塊圖
TCP
IP
UDP
HTTP HTTPU HTTPMU
SOAP GENA HTTPD SSDP
UPnP Device Architecture
Device Control Protocols
APP/Libraries
通知大家
● Control point:
○ 哪邊有「我要的服務」的device?有的話
該一聲
● Device
○ 我還沒死
○ 我要閃人了
http://upnp.org/sdcps-and-certification/standards/device-architecture-documents/
無聊的方塊圖
TCP
IP
UDP
HTTP HTTPU HTTPMU
SOAP GENA HTTPD SSDP
UPnP Device Architecture
Device Control Protocols
APP/Libraries
Device 回應 control
point的詢問
http://upnp.org/sdcps-and-certification/standards/device-architecture-documents/
沒fu? 來看範例
Step 1:
Control point 找到
Device
場景一:Device
自行宣傳
UPnP 1.0 簡介
6個封包?那6個?
● UPnP規範,device 自我宣傳要有
○ 3個root device
○ 任意個embedded device (不討論)
○ 任意個service
來看封包:
淺紅底文字的是發送端封包
內容
Notification type
Device advertisement: root device (1)
Notification sub type
Unique service name
Root device description
URL!
Device advertisement: root device (2)
UUID
Device advertisement: root device (3)
device type
Device advertisement: AVT service
Device advertisement: CM service
Device advertisement: RCS service
場景二:Control point自
己問
UPnP 1.0 簡介
UPnP 1.0 簡介
Control point
Device
先看Control Point封包
等待秒數
Search type:
這邊全找,也可以指定
特定type
插花:指名MediaServer和
MediaRender坐檯 (各一個封包)
再看Device response
Device response順序和
自我宣傳差別只有NT換
成ST以及沒有NTS描述
● NT: Notification type
● ST: Service type
● NTS: Notification sub type
Service type
Device response: root device (1)
Device response: root device (2)
Device response: root device (3)
Device response: AVT service
Device response: CM service
Device response: RCS service
場景三:Device 離線
基本上就是把場景一的keep alive換成
byebye。另外有規範要送超過兩次以避
免漏掉。
Device offline: root device (1)
Device offline: root device (2)
Device offline: root device (3)
Device offline: AVT Service
Device offline: CM Service
Device offline: RCS Service
Step 2:
Control point
取得 顿别惫颈肠别资讯
很簡單,前面的封包都
有Location URL。
用瀏覽器開一下吧
UPnP 架構版號Device 描述
UPnP 架構版本
Device描述
● 設備類型
● 產品資訊
● 辨別UUID
● 提供服務
● ….
提供Icon給control point使用
UPnP 1.0 簡介
提供的服務:AVT, CM, RCS
服務提供的資訊
Type 和ID使用UPnP
定的標準要遵守規範
服務提供的資訊
真正描述提供服務的
地方
服務提供的資訊
你要送命令的URL
服務提供的資訊
c
訂閱要監聽event的
URL
有Action name和paramter,像不像
function call啊?
開啟scpd.xml URL
來看封包:
淺紅底文字的是發送端封包
內容
淺藍底文字的是接收端
封包內容
Control point取得 Location URL
HTTP GET
HTTP Response
Device description
Control point取得AVT的服務描述
HTTP GET
HTTP Response
Device description
device
服
務
視
覺
化
Step 3:
Control point 控制
Device
以GetTransportInfo為例
參數 Instance ID
回傳目前
state、status和
播放速度
按下這個送出request
後的畫面
來看封包:
淺紅底文字的是發送端封包
內容
淺藍底文字的是接收端
封包內容
看封包時間:Contronl point的action
Post到描述XML指定的control URL
Action name
參數: Instance ID:0
看封包時間:Device repsonse
回傳state為Stop
回傳狀態為OK
播放速度為1
Step 3:
Control point 取得
Device event資訊
直接看封包:
淺紅底文字的是發送端封包
內容
淺藍底文字的是接收端
封包內容
Control point 訂閱監聽事件
告訴Device event要往那
邊送
Subscription ID
還記得EventSubURL嗎?
Device 送出event,Control point回應
Subscription ID和上
頁相同
資料變動
Device 停止播放送出event,Control
point回應
資料變動
Subscription ID和上
頁相同
Control point可以放棄註冊
還記得EventSubURL嗎?
要unsubscribe的 ID
總結
● UPnP 提供預先定義好的規範,讓不同的是設
備不需要驅動程式,特殊軟體就可以透過網路
操作
● UPnP透過SSDP讓control point能夠找出網路
的Device
● UPnP透過GENA讓control point能夠被動接受
device送出來的事件
參考資料
● UPnP Forum 文件
○ 包含MediaRender
Ad

Recommended

Intel DPDK Step by Step instructions
Intel DPDK Step by Step instructions
Hisaki Ohara
?
贵笔骋础のトレンドをまとめてみた
贵笔骋础のトレンドをまとめてみた
Takefumi MIYOSHI
?
A Technical Introduction to WiredTiger
A Technical Introduction to WiredTiger
MongoDB
?
仮想化环境におけるパケットフォワーディング
仮想化环境におけるパケットフォワーディング
Takuya ASADA
?
DPDK in Containers Hands-on Lab
DPDK in Containers Hands-on Lab
Michelle Holley
?
Filesystem Comparison: NFS vs GFS2 vs OCFS2
Filesystem Comparison: NFS vs GFS2 vs OCFS2
Giuseppe Paterno'
?
Build an High-Performance and High-Durable Block Storage Service Based on Ceph
Build an High-Performance and High-Durable Block Storage Service Based on Ceph
Rongze Zhu
?
Dpdk performance
Dpdk performance
Stephen Hemminger
?
Boosting I/O Performance with KVM io_uring
Boosting I/O Performance with KVM io_uring
ShapeBlue
?
IPC in Microkernel Systems, Capabilities
IPC in Microkernel Systems, Capabilities
Martin Děck?
?
肠辞苍迟补颈苍别谤诲の概要と最近の机能
肠辞苍迟补颈苍别谤诲の概要と最近の机能
Kohei Tokunaga
?
Deep Dive In To Redis Replication: Vishy Kasar
Deep Dive In To Redis Replication: Vishy Kasar
Redis Labs
?
HKG18-411 - Introduction to OpenAMP which is an open source solution for hete...
HKG18-411 - Introduction to OpenAMP which is an open source solution for hete...
Linaro
?
[KubeCon NA 2020] containerd: Rootless Containers 2020
[KubeCon NA 2020] containerd: Rootless Containers 2020
Akihiro Suda
?
IETF111 RATS: Remote Attestation ProcedureS 報告
IETF111 RATS: Remote Attestation ProcedureS 報告
Kuniyasu Suzaki
?
Spider HA 20100922(DTT#7)
Spider HA 20100922(DTT#7)
Kentoku
?
virtio
virtio
zhaobrian
?
InnoDB Architecture and Performance Optimization, Peter Zaitsev
InnoDB Architecture and Performance Optimization, Peter Zaitsev
Fuenteovejuna
?
Hyper vを理解する
Hyper vを理解する
Naoki Abe
?
コンテナセキュリティにおける権限制御(OCHaCafe5 #3 Kubernetes のセキュリティ 発表資料)
コンテナセキュリティにおける権限制御(OCHaCafe5 #3 Kubernetes のセキュリティ 発表資料)
NTT DATA Technology & Innovation
?
骋辞肠辞苍2017:骋辞のロギング周りの考察
骋辞肠辞苍2017:骋辞のロギング周りの考察
貴仁 大和屋
?
Transparent sharding with Spider: what's new and getting started
Transparent sharding with Spider: what's new and getting started
MariaDB plc
?
Faster packet processing in Linux: XDP
Faster packet processing in Linux: XDP
Daniel T. Lee
?
Dpdk applications
Dpdk applications
Vipin Varghese
?
nftables: the Next Generation Firewall in Linux
nftables: the Next Generation Firewall in Linux
Tomofumi Hayashi
?
Debug dpdk process bottleneck & painpoints
Debug dpdk process bottleneck & painpoints
Vipin Varghese
?
MongoDB WiredTiger Internals: Journey To Transactions
MongoDB WiredTiger Internals: Journey To Transactions
Mydbops
?
Intel dpdk Tutorial
Intel dpdk Tutorial
Saifuddin Kaijar
?
GNU AS簡介
GNU AS簡介
Wen Liao
?
GNU ld的linker script簡介
GNU ld的linker script簡介
Wen Liao
?

More Related Content

What's hot (20)

Boosting I/O Performance with KVM io_uring
Boosting I/O Performance with KVM io_uring
ShapeBlue
?
IPC in Microkernel Systems, Capabilities
IPC in Microkernel Systems, Capabilities
Martin Děck?
?
肠辞苍迟补颈苍别谤诲の概要と最近の机能
肠辞苍迟补颈苍别谤诲の概要と最近の机能
Kohei Tokunaga
?
Deep Dive In To Redis Replication: Vishy Kasar
Deep Dive In To Redis Replication: Vishy Kasar
Redis Labs
?
HKG18-411 - Introduction to OpenAMP which is an open source solution for hete...
HKG18-411 - Introduction to OpenAMP which is an open source solution for hete...
Linaro
?
[KubeCon NA 2020] containerd: Rootless Containers 2020
[KubeCon NA 2020] containerd: Rootless Containers 2020
Akihiro Suda
?
IETF111 RATS: Remote Attestation ProcedureS 報告
IETF111 RATS: Remote Attestation ProcedureS 報告
Kuniyasu Suzaki
?
Spider HA 20100922(DTT#7)
Spider HA 20100922(DTT#7)
Kentoku
?
virtio
virtio
zhaobrian
?
InnoDB Architecture and Performance Optimization, Peter Zaitsev
InnoDB Architecture and Performance Optimization, Peter Zaitsev
Fuenteovejuna
?
Hyper vを理解する
Hyper vを理解する
Naoki Abe
?
コンテナセキュリティにおける権限制御(OCHaCafe5 #3 Kubernetes のセキュリティ 発表資料)
コンテナセキュリティにおける権限制御(OCHaCafe5 #3 Kubernetes のセキュリティ 発表資料)
NTT DATA Technology & Innovation
?
骋辞肠辞苍2017:骋辞のロギング周りの考察
骋辞肠辞苍2017:骋辞のロギング周りの考察
貴仁 大和屋
?
Transparent sharding with Spider: what's new and getting started
Transparent sharding with Spider: what's new and getting started
MariaDB plc
?
Faster packet processing in Linux: XDP
Faster packet processing in Linux: XDP
Daniel T. Lee
?
Dpdk applications
Dpdk applications
Vipin Varghese
?
nftables: the Next Generation Firewall in Linux
nftables: the Next Generation Firewall in Linux
Tomofumi Hayashi
?
Debug dpdk process bottleneck & painpoints
Debug dpdk process bottleneck & painpoints
Vipin Varghese
?
MongoDB WiredTiger Internals: Journey To Transactions
MongoDB WiredTiger Internals: Journey To Transactions
Mydbops
?
Intel dpdk Tutorial
Intel dpdk Tutorial
Saifuddin Kaijar
?
Boosting I/O Performance with KVM io_uring
Boosting I/O Performance with KVM io_uring
ShapeBlue
?
IPC in Microkernel Systems, Capabilities
IPC in Microkernel Systems, Capabilities
Martin Děck?
?
肠辞苍迟补颈苍别谤诲の概要と最近の机能
肠辞苍迟补颈苍别谤诲の概要と最近の机能
Kohei Tokunaga
?
Deep Dive In To Redis Replication: Vishy Kasar
Deep Dive In To Redis Replication: Vishy Kasar
Redis Labs
?
HKG18-411 - Introduction to OpenAMP which is an open source solution for hete...
HKG18-411 - Introduction to OpenAMP which is an open source solution for hete...
Linaro
?
[KubeCon NA 2020] containerd: Rootless Containers 2020
[KubeCon NA 2020] containerd: Rootless Containers 2020
Akihiro Suda
?
IETF111 RATS: Remote Attestation ProcedureS 報告
IETF111 RATS: Remote Attestation ProcedureS 報告
Kuniyasu Suzaki
?
Spider HA 20100922(DTT#7)
Spider HA 20100922(DTT#7)
Kentoku
?
InnoDB Architecture and Performance Optimization, Peter Zaitsev
InnoDB Architecture and Performance Optimization, Peter Zaitsev
Fuenteovejuna
?
Hyper vを理解する
Hyper vを理解する
Naoki Abe
?
コンテナセキュリティにおける権限制御(OCHaCafe5 #3 Kubernetes のセキュリティ 発表資料)
コンテナセキュリティにおける権限制御(OCHaCafe5 #3 Kubernetes のセキュリティ 発表資料)
NTT DATA Technology & Innovation
?
骋辞肠辞苍2017:骋辞のロギング周りの考察
骋辞肠辞苍2017:骋辞のロギング周りの考察
貴仁 大和屋
?
Transparent sharding with Spider: what's new and getting started
Transparent sharding with Spider: what's new and getting started
MariaDB plc
?
Faster packet processing in Linux: XDP
Faster packet processing in Linux: XDP
Daniel T. Lee
?
nftables: the Next Generation Firewall in Linux
nftables: the Next Generation Firewall in Linux
Tomofumi Hayashi
?
Debug dpdk process bottleneck & painpoints
Debug dpdk process bottleneck & painpoints
Vipin Varghese
?
MongoDB WiredTiger Internals: Journey To Transactions
MongoDB WiredTiger Internals: Journey To Transactions
Mydbops
?

Viewers also liked (20)

GNU AS簡介
GNU AS簡介
Wen Liao
?
GNU ld的linker script簡介
GNU ld的linker script簡介
Wen Liao
?
Hello world在那邊?背景說明
Hello world在那邊?背景說明
Wen Liao
?
GNU Make, Autotools, CMake 簡介
GNU Make, Autotools, CMake 簡介
Wen Liao
?
from Source to Binary: How GNU Toolchain Works
from Source to Binary: How GNU Toolchain Works
National Cheng Kung University
?
Trace 程式碼之皮
Trace 程式碼之皮
Wen Liao
?
How A Compiler Works: GNU Toolchain
How A Compiler Works: GNU Toolchain
National Cheng Kung University
?
From Home Enabled Personal Media To Instant Personal Media Sharing
From Home Enabled Personal Media To Instant Personal Media Sharing
guest829cce0
?
康軒中自二下Ppt經典款ch5 3實驗
康軒中自二下Ppt經典款ch5 3實驗
fbw41598
?
康軒中自二下Ppt經典款ch5 2
康軒中自二下Ppt經典款ch5 2
fbw41598
?
康軒中自二下Ppt經典款ch1 1
康軒中自二下Ppt經典款ch1 1
fbw41598
?
Guide to GStreamer Application Development Manual: CH1 to CH10
Guide to GStreamer Application Development Manual: CH1 to CH10
Wen Liao
?
Testing in python 2.7.3
Testing in python 2.7.3
Wen Liao
?
康轩中自二下笔辫迟经典款肠丑5重点整理
康轩中自二下笔辫迟经典款肠丑5重点整理
fbw41598
?
What Can Compilers Do for Us?
What Can Compilers Do for Us?
National Cheng Kung University
?
GNU gettext簡介 - 以C語言為範例
GNU gettext簡介 - 以C語言為範例
Wen Liao
?
康轩中自二下笔辫迟经典款肠丑6科普阅读耻辫
康轩中自二下笔辫迟经典款肠丑6科普阅读耻辫
fbw41598
?
故事:自由軟體和 Richard Stallman
故事:自由軟體和 Richard Stallman
Wen Liao
?
康轩中自二下笔辫迟经典款肠丑6重点整理
康轩中自二下笔辫迟经典款肠丑6重点整理
fbw41598
?
A Brief Introduction to Regular Expression with Python 2.7.3 Standard Library
A Brief Introduction to Regular Expression with Python 2.7.3 Standard Library
Wen Liao
?
GNU ld的linker script簡介
GNU ld的linker script簡介
Wen Liao
?
Hello world在那邊?背景說明
Hello world在那邊?背景說明
Wen Liao
?
GNU Make, Autotools, CMake 簡介
GNU Make, Autotools, CMake 簡介
Wen Liao
?
Trace 程式碼之皮
Trace 程式碼之皮
Wen Liao
?
From Home Enabled Personal Media To Instant Personal Media Sharing
From Home Enabled Personal Media To Instant Personal Media Sharing
guest829cce0
?
康軒中自二下Ppt經典款ch5 3實驗
康軒中自二下Ppt經典款ch5 3實驗
fbw41598
?
康軒中自二下Ppt經典款ch5 2
康軒中自二下Ppt經典款ch5 2
fbw41598
?
康軒中自二下Ppt經典款ch1 1
康軒中自二下Ppt經典款ch1 1
fbw41598
?
Guide to GStreamer Application Development Manual: CH1 to CH10
Guide to GStreamer Application Development Manual: CH1 to CH10
Wen Liao
?
Testing in python 2.7.3
Testing in python 2.7.3
Wen Liao
?
康轩中自二下笔辫迟经典款肠丑5重点整理
康轩中自二下笔辫迟经典款肠丑5重点整理
fbw41598
?
GNU gettext簡介 - 以C語言為範例
GNU gettext簡介 - 以C語言為範例
Wen Liao
?
康轩中自二下笔辫迟经典款肠丑6科普阅读耻辫
康轩中自二下笔辫迟经典款肠丑6科普阅读耻辫
fbw41598
?
故事:自由軟體和 Richard Stallman
故事:自由軟體和 Richard Stallman
Wen Liao
?
康轩中自二下笔辫迟经典款肠丑6重点整理
康轩中自二下笔辫迟经典款肠丑6重点整理
fbw41598
?
A Brief Introduction to Regular Expression with Python 2.7.3 Standard Library
A Brief Introduction to Regular Expression with Python 2.7.3 Standard Library
Wen Liao
?
Ad

More from Wen Liao (8)

Hello world 的一生
Hello world 的一生
Wen Liao
?
Notes on oracle solaris 11.3 linkers and libraries guide chapter one
Notes on oracle solaris 11.3 linkers and libraries guide chapter one
Wen Liao
?
開放街圖 自助旅行的好幫手
開放街圖 自助旅行的好幫手
Wen Liao
?
A successful git branching model 導讀
A successful git branching model 導讀
Wen Liao
?
浅谈顿别产颈补苍套件打包
浅谈顿别产颈补苍套件打包
Wen Liao
?
从组装软体中谈谈软体发展管理
从组装软体中谈谈软体发展管理
Wen Liao
?
软体组装心得分享
软体组装心得分享
Wen Liao
?
Introduce to Linux command line
Introduce to Linux command line
Wen Liao
?
Hello world 的一生
Hello world 的一生
Wen Liao
?
Notes on oracle solaris 11.3 linkers and libraries guide chapter one
Notes on oracle solaris 11.3 linkers and libraries guide chapter one
Wen Liao
?
開放街圖 自助旅行的好幫手
開放街圖 自助旅行的好幫手
Wen Liao
?
A successful git branching model 導讀
A successful git branching model 導讀
Wen Liao
?
浅谈顿别产颈补苍套件打包
浅谈顿别产颈补苍套件打包
Wen Liao
?
从组装软体中谈谈软体发展管理
从组装软体中谈谈软体发展管理
Wen Liao
?
软体组装心得分享
软体组装心得分享
Wen Liao
?
Introduce to Linux command line
Introduce to Linux command line
Wen Liao
?
Ad

UPnP 1.0 簡介