9. SDP Grammar
This section provides an Augmented Backus-Naur Form (ABNF) grammar for SDP. ABNF is defined in [RFC5234].
; SDP Syntax
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
; Protocol version
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
; Generic rules
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
; Generic primitive rules
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
This grammar defines the complete syntax for SDP session descriptions. Implementations MUST conform to this syntax.