メインコンテンツまでスキップ

9. SDP文法 (SDP Grammar)

このセクションでは、SDPの拡張バッカス・ナウア記法(ABNF)文法を提供します。ABNFは[RFC5234]で定義されています。

; SDP構文

announcement = proto-version
origin-field
session-name-field
information-field
uri-field
email-fields
phone-fields
connection-field
bandwidth-fields
time-fields
key-field
attribute-fields
media-descriptions

proto-version = %x76 "=" 1*DIGIT CRLF

origin-field = %x6f "=" username SP sess-id SP sess-version SP
nettype SP addrtype SP unicast-address CRLF

session-name-field = %x73 "=" text CRLF

information-field = [%x69 "=" text CRLF]

uri-field = [%x75 "=" uri CRLF]

email-fields = *(%x65 "=" email-address CRLF)

phone-fields = *(%x70 "=" phone-number CRLF)

connection-field = [%x63 "=" nettype SP addrtype SP
connection-address CRLF]

bandwidth-fields = *(%x62 "=" bwtype ":" bandwidth CRLF)

time-fields = 1*( %x74 "=" start-time SP stop-time
*(CRLF repeat-fields) CRLF)
[zone-adjustments CRLF]

repeat-fields = %x72 "=" repeat-interval SP typed-time
1*(SP typed-time)

zone-adjustments = %x7a "=" time SP ["-"] typed-time
*(SP time SP ["-"] typed-time)

key-field = [%x6b "=" key-data CRLF]

attribute-fields = *(%x61 "=" attribute CRLF)

media-descriptions = *( media-field
information-field
*connection-field
bandwidth-fields
key-field
attribute-fields )

media-field = %x6d "=" media SP port ["/" integer]
SP proto 1*(SP fmt) CRLF

; 一般規則

username = non-ws-string
sess-id = 1*DIGIT
sess-version = 1*DIGIT
nettype = token
addrtype = token
unicast-address = IP4-address / IP6-address / FQDN / extn-addr

IP4-address = b1 3("." decimal-uchar)
b1 = decimal-uchar
IP6-address = hexpart [ ":" IP4-address ]
FQDN = 4*(alpha-numeric / "-" / ".")

email-address = email / email "(" email-safe ")" /
email-safe "<" email ">"

phone-number = phone / phone "(" email-safe ")" /
email-safe "<" phone ">"

connection-address = multicast-address / unicast-address
bwtype = token
bandwidth = 1*DIGIT
start-time = time / "0"
stop-time = time / "0"
time = POS-DIGIT 9*DIGIT
repeat-interval = typed-time
typed-time = 1*DIGIT [fixed-len-time-unit]
fixed-len-time-unit = %x64 / %x68 / %x6d / %x73

key-data = key-type / key-type ":" key-material
key-type = %x63 %x6c %x65 %x61 %x72 /
%x62 %x61 %x73 %x65 "64" /
%x75 %x72 %x69 /
%x70 %x72 %x6f %x6d %x70 %x74

attribute = att-field ":" att-value / att-field
att-field = token
att-value = byte-string

media = token
port = 1*DIGIT
proto = token 0*("/" token)
fmt = token

; 一般的な基本規則

token = 1*(token-char)
token-char = %x21 / %x23-27 / %x2A-2B / %x2D-2E / %x30-39
/ %x41-5A / %x5E-7E

byte-string = 1*(0x01..0x09 / 0x0B..0x0C / 0x0E..0xFF)
non-ws-string = 1*(VCHAR / 0x80..0xFF)
text = byte-string

email = email-safe "@" email-safe
email-safe = byte-string
phone = "+" POS-DIGIT 1*(SP / "-" / DIGIT)
uri = URI-reference

decimal-uchar = DIGIT
/ POS-DIGIT DIGIT
/ ("1" 2*(DIGIT))
/ ("2" ("0"/"1"/"2"/"3"/"4") DIGIT)
/ ("2" "5" ("0"/"1"/"2"/"3"/"4"/"5"))

alpha-numeric = ALPHA / DIGIT
POS-DIGIT = %x31-39

hexpart = hexseq / hexseq "::" [ hexseq ] / "::" [ hexseq ]
hexseq = hex4 *( ":" hex4)
hex4 = 1*4HEXDIG
extn-addr = non-ws-string

この文法は、SDPセッション記述の完全な構文を定義します。実装はこの構文に準拠する必要があります(MUST)。