现在的位置: 首页 > 综合 > 正文

[TCP/IP][2012-6-16] SDP ( Session Description Protocol )

2014年11月23日 ⁄ 综合 ⁄ 共 3699字 ⁄ 字号 评论关闭

原文摘自:http://dslab.ee.ncku.edu.tw/~lily/learning/learning_ch2-3.html

 

SDP ( Session Description Protocol )

        簡單的來說, SDP[1] 就是用來定義 internet 上, 如何描述一個 session 的 protocol. 它可以被用來通知一個 session 的存在, 讓使用者能 join 一個 session, 或是讓使用者得知某個即將開啟的 session 的相關資訊.

        首先, 我們先說明什麼叫 session. 一個存在於 internet 上的 session, 包含了所有往來於 sender 和 receiver 端的 data stream, 無論是單純的資料, 或是控制資訊. 為了描述網路上的 session, 所以定出了一個 protocol, 就是 SDP.

        在哪些地方可能會使用到 SDP 這種 protocol 呢? 我們可以這麼說, 凡是跟 session 有關係的用途, 都可以利用 SDP. 好比說, video conference, 這篇論文所要實作的 RTSP service, real audio, etc.

        至於, SDP 又要如何使用呢? 因為 SDP 是一種單純只有文字內容的 protocol, 所以我們可以利用 email 通知想加入的使用者, 使用者只要在 MIME type 裡加入 "application-sdp" 後, 讓它跟能處理 SDP 內容的程式發生關聯, 那一旦使用者讀到這個包含有 SDP 資訊的 email, 就會自動啟動程式, join 指定的 session. 而在 Web 上, 我們只需在 server 端放一個 *.sdp 的 file, 同樣的, 使用者必需先將 *.sdp
    的 MIME type 設定好, 如此一來, 就能透過外部程式, 對 SDP file 中指定的 session 做處理.


    SDP 包含的資訊有很多種, 列舉如下:

        首先是和 session 相關的:

  1. Session name and purpose -- session 的名稱及目的
  2. Times the session is active -- session 開始的時間 (for conference)
  3. The media comprising the session
  4. Information to receive those media -- 跟 session 相關的資料, 比如 address, ports, formats 等等.
  5. Information about the bandwidth to be used by the conference -- 可用以限制 session 耗用的流量
  6. Contact information for the person responsible for the session -- 跟 session 的負責人聯絡的資訊

    和 media 相關的:

  1. The type of media -- video, audio, 或是 white board
  2. The transport protocol -- RTP/UDP/IP, H.320, etc.
  3. The format of the media -- H.261 video, MPEG video, etc.

    和 IP multicast 以及 unicast 有關的:

  1. Multicast address and transport port for media
  2. Contact address and transport port for media

    除了上述這些 information 之外, SDP 還可根據需求, 定義所謂的 private session. private session 要有 encryption keys 才能 join, 而 SDP 可以直接將這些 keys 包含在裡面, 由 email 的方式, 送到想加入的 client 端.

    另外, session 除了有開始時間之外, 也許是在某段時間之內才 active. SDP 的時間表示法也能夠表示此種特定時間. 它可以指定開始以及結束時間, 甚至還能指定這個 session 會在某個時段內 repeat, 好比說 "每個星期二的早上10:00".


        SDP 是一種純文字的 protocol, 它的好處是可以很方便的用一些 shell script language 來做處理, 無論是要產生或是解譯它, 並且只需要文書處理軟體就能夠修改它的內容, 而且, 也方便用 email 的方式傳遞它.

        SDP 的語法很簡單, 所有的資訊表示法都如下所示: 
        <type>=<value> 
    每一個 type, 都以一個單一的英文字母表示, 而 value 就是 type 所攜帶的資訊. 兩者和之間的 '=' 是相連的, 沒有空格.

        接下來, 我們介紹 SDP 的參數的定義: 
     

  1. v: protocol version
  2. o: owner/creator and session identifier
  3. s: session name
  4. i: session information
  5. u: URI of description
  6. e: email address
  7. p: phone number
  8. c: connection information (not required if included in all media)
  9. b: bandwidth information
  10. z: time zone adjustments
  11. k: encryption key
  12. a: zero or more session attribute lines
  13. t: time the session is active
  14. r: zero or more repeat times
  15. m: media name and transport address

利用下面這個例子, 我們來看看這些參數的用法:

v=o 
o=mhandley 2890844526 2890842807 IN IP4 126.16.64.4 
s=SDP Seminar 
i=A Seminar on the session description protocol 
u=http://www.cs.ucl.ac.uk/staff/M.Handley/sdp.03.ps 
e=mjh@isi.edu(Mark Handley) 
c=IN IP4 224.2.17.12/127 
t=2873397496 2873404696 
a=recvonly 
m=audio 3456 RTP/AVP 0 
m=video 2232 RTP/AVP 31 
m=whiteboard 32416 UDP WB 
a=orient:portrait

v=0 
表示 SDP version number 為 0

o=mhandley 2890844526 2890842807 IN IP4 126.16.64.4 
表示 owner (session 的 creator) 在 login server 時, 其 username 為 mhandley, session id 為 2890844526, version 為 2890842807, network type 為 Internet, address type 為 IPv4, server 的 address 為 126.16.64.4

s=SDP Seminar 
這個 Session 的名稱為 SDP Seminar

i=A Seminar on the session description protocol 
跟這個 Session 相關的 information: 這個 session 的全名是 A Seminar on the session description protocol

u=http://www.cs.ucl.ac.uk/staff/M.Handley/sdp.03.ps 
跟這個 Session 相關的其它 information: 在 http://www.cs.ucl.ac.uk/staff/M.Handley/ 中的 sdp.03.ps 這個檔案, 對這個 session 有更詳盡的描述.

e=mjh@isi.edu(Mark Handley) 
和 session owner 聯絡時可使用的 email address

c=IN IP4 224.2.17.12/127 
表示若要 join 這個 session, network type 為 Internet, address type 為 IPv4, multicast address 是 224.2.17.12, TTL 是 127

t=2873397496 2873404696 
表示 session 開始和結束的時間

a=recvonly 
表示用來處理這個 session 的 tools 只能被設為 receive-only

m=audio 3456 RTP/AVP 0 
media 資料中有 audio data, port 是 3456, 以 RTP/AVP 的 transport protocol 傳輸, 0 是其指定的 format type, 詳細請查看 RTP[2].

m=video 2232 RTP/AVP 31 
media 資料中有 video data, port 是 2232, 以 RTP/AVP 的 transport portocol 傳輸, 31 是 format type.

m=whiteboard 32416 UDP WB 
media 資料中有 whiteboard data, port 32416, 以 UDP 方式傳輸, format type 是 WB (White Board).

a=orient:portrait 
指定白板在螢幕上的位置. 
 

 有關 SDP 參數更詳盡的資料

抱歉!评论已关闭.