RTSP 協(xié)議分析
1.概述:
RTSP(Real Time Streaming Protocol)较性,實(shí)時(shí)流傳輸協(xié)議堵第,是TCP/IP協(xié)議體系中的一個(gè)應(yīng)用層協(xié)議矾芙,由哥倫比亞大學(xué)、網(wǎng)景和RealNetworks公司提交的IETF RFC標(biāo)準(zhǔn)朵栖。該協(xié)議定義了一對(duì)多應(yīng)用程序如何有效地通過(guò)IP網(wǎng)絡(luò)傳送多媒體數(shù)據(jù)颊亮。類(lèi)似HTTP協(xié)議的流控制協(xié)議。它們都使用純文本來(lái)發(fā)送信息陨溅,而且rtsp協(xié)議的語(yǔ)法也和HTTP類(lèi)似终惑,和HTTP協(xié)議相比RTSP協(xié)議所不同的地方是,RTSP協(xié)議是有狀態(tài)的協(xié)議门扇,而HTTP是無(wú)狀態(tài)的協(xié)議雹有。RTSP通過(guò)維護(hù)一個(gè)session來(lái)維護(hù)其狀態(tài)的轉(zhuǎn)換。RTSP協(xié)議的默認(rèn)端口是554臼寄,默認(rèn)的承載協(xié)議為T(mén)CP霸奕。
2.RTSP的特性:
(1).流控分離:從控制邏輯上來(lái)說(shuō)RTSP和FTP相似,控制流和數(shù)據(jù)流是分開(kāi)的吉拳。
(2).可擴(kuò)展性:因?yàn)镽TSP協(xié)議是基于文本的協(xié)議所以其具有較強(qiáng)的可擴(kuò)展性质帅。
(3).安全:RTSP 使用網(wǎng)頁(yè)安全機(jī)制。
3.RTSP 協(xié)議格式:
請(qǐng)求命令的格式為:
METHOD URL CR LF
Field1:value CR LF
Field2:value CR LF
......
Fieldn:value CR LF
CR LF
應(yīng)答的格式為:
RTSP/major_version.minor_version status CR LF
Field1:value CR LF
Field2:value CR LF
......
Fieldn:value CR LF
CR LF
4.RTSP的主要命令:
5.RTSP命令的狀態(tài)轉(zhuǎn)換表
6.RTSP狀態(tài)碼
Status-Code = "100" ; Continue
| "200" ; OK
| "201" ; Created
| "250" ; Low on Storage Space
| "300" ; Multiple Choices
| "301" ; Moved Permanently
| "302" ; Moved Temporarily
| "303" ; See Other
| "304" ; Not Modified
| "305" ; Use Proxy
| "400" ; Bad Request
| "401" ; Unauthorized
| "402" ; Payment Required
| "403" ; Forbidden
| "404" ; Not Found
| "405" ; Method Not Allowed
| "406" ; Not Acceptable
| "407" ; Proxy Authentication Required
| "408" ; Request Time-out
| "410" ; Gone
| "411" ; Length Required
| "412" ; Precondition Failed
| "413" ; Request Entity Too Large
| "414" ; Request-URI Too Large
| "415" ; Unsupported Media Type
| "451" ; Parameter Not Understood
| "452" ; Conference Not Found
| "453" ; Not Enough Bandwidth
| "454" ; Session Not Found
| "455" ; Method Not Valid in This State
| "456" ; Header Field Not Valid for Resource
| "457" ; Invalid Range
| "458" ; Parameter Is Read-Only
| "459" ; Aggregate operation not allowed
| "460" ; Only aggregate operation allowed
| "461" ; Unsupported transport
| "462" ; Destination unreachable
| "500" ; Internal Server Error
| "501" ; Not Implemented
| "502" ; Bad Gateway
| "503" ; Service Unavailable
| "504" ; Gateway Time-out
| "505" ; RTSP Version not supported
| "551" ; Option not supported
| extension-code
extension-code = 3DIGIT
Reason-Phrase = *<TEXT, excluding CR, LF