Subject: draft of SDP Grammar

From: Mark Handley <[email-masked]>
Date: Thu, 30 Mar 95 14:32:15 +0100

> 7) A bit of guidance about things like whitespace might help. Maybe 
> even a more formal notation like HTTP uses. What about control 
> characters (tab, ^A, ^H, etc.)? I'd want to avoid somebody sending 
> xterm control codes...

Henning,

The following is my first attempt at a grammar for SDP.  I hope it
accurately represents what's in the internet-draft, but there's no
guarantee it does.  If it contradicts the i-d, then take the i-d as
being the correct version.

Comments and corrections are welcome.

Mark

--------8<--------
SDP v 2.0 grammar draft 1.0

announcement ::= 	session-name-field 
			description-field 
			uri-field 
			owner-field
			email-fields
			phone-fields
			origin-field
			connection-field
			bandwidth-field
			time-fields
			key-field
			attribute-fields
			media-descriptions

session-name-field ::=	"s=" text

description-field ::=	[newline "i=" text]

uri-field ::= 		[newline "u=" uri]

owner-field ::= 	newline "o=" username @ hostname

email-fields ::= 	(newline "e=" email-address)*

phone-fields ::= 	(newline "p=" phone-number)*

origin-field ::=	[newline "h=" unicast-address]

connection-field ::=	newline "c=" connection-address space ttl space 
			start-time space stop-time

bandwidth-field ::=	[newline "b=" bandwidth [space bandwidth-modifier]]

time-fields ::=		(newline "t=" repeat-time)*

key-field ::=		[newline "k=" (printable-ascii)+]

attribute-fields ::=	(newline "a=" attribute)*

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

media-field ::=		newline "m=" media space port space id

media ::=		(alpha-numeric)+
			;typically "audio", "video" or "whiteboard"

port ::=		POS-DIGIT [DIGIT] 3*DIGIT
			;should in the range "1024" to "65535"

id ::=			(DIGIT)+
			;typically "0"

attribute ::=		att-field ":" att-value | att-field

att-field ::=		(ALPHA)+

att-value ::=		(att-char)+

att-char ::=		alpha-numeric | "-"
			;is this too tight a restriction

connection-address ::=	multicast-conf-address | unicast-address

multicast-conf-address ::=	"224.2." decimal_uchar "." decimal_uchar
			;multicast addresses may be in a larger range
			;but only these should be assigned by an sdp tool

ttl ::=			decimal_uchar

start-time ::=		time | "0"

stop-time ::=		time | "0"

time ::=		POS-DIGIT 9*DIGIT
			;sufficient for 2 more centuries

bandwidth ::=		(DIGIT)+

bandwidth-modifier ::=	(alpha-numeric)+

repeat-time ::=		mins space 
			hrs space 
			doms space 
			moys space 
			dows space 
			duration

mins ::=		min ("," min)*

min ::=			[1|2|3|4|5] DIGIT

hrs ::=			hr ("," hr)*

hr ::=			[1] digit | 2 (0|1|2|3)

doms ::=		"*" | dom ("," dom)*

dom ::=			[1|2] DIGIT | 3 (0|1)

moys ::=		"*" | moy ("," moy)*

moy ::=			POS-DIGIT | 1 (0|1|2)

dows ::=		"*" | dow ("," dow)*

dow ::=			0|1|2|3|4|5|6

duration ::=		POS-DIGIT (DIGIT)*

username ::=		;not defined here

hostname ::=		hostpart ("." hostpart)*
			;fully qualified DNS host name

hostpart ::=		(hostchar)+

hostchar ::=		alpha-numeric | "-" | "_" | "/"
			;what do hostnames allow?

email-address ::=	;defined in RFC822

uri::=			;defined elsewhere

phone-number ::=	"+" POS-DIGIT (space | DIGIT)+
			;there must be a space between the international
			;code and the rest of the number.

unicast-address ::=	IP4-address | IP6-address
			
IP4-address ::=		b1 "." decimal_uchar "." decimal_uchar "." b4
b1 ::=			decimal_uchar
			;less than "224"; not "0" or "127"
b4 ::=			decimal_uchar
			;not "0"

IP6-address ::=		;to be defined

text ::=		(printable-iso8859-1)+ | (unicode-1-1-utf-7)+
			;unicode requires a "a=charset:unicode-1-1-utf-7"
			;attribute to be used

printable-iso8859-1 ::= ;8 bit ascii character
			;decimal 9 (TAB), 32-126 and 161-255

unicode-1-1-utf-7 ::=	unicode-safe
			;defined in RFC 1642

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

printable-ascii ::=	unicode-safe | "~" | "\"

DIGIT ::=		0 | POS-DIGIT

POS-DIGIT ::=		1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9

ALPHA ::=               a | b | c | d | e | f | g | h | i | j | k |
                        l | m | n | o  | p | q | r | s | t | u | v |
                        w | x | y | z | A | B | C  | D | E | F | G |
                        H | I | J | K | L | M | N | O | P |  Q | R |
                        S | T | U | V | W | X | Y | Z

unicode-safe ::=	alpha-numeric |
			"'" | "(" | ")" | "'" | "-" | "." | "/" | ":" |
			"?" | """ | "#" | "$" | "&" | "*" | ";" | "<" |
			"=" | ">" | "@" | "[" | "]" | "^" | "_" | "`" |
			"{" | "|" | "}" | "+" | space | tab
			;although unicode allows newline and carriage
			;return, we don't here.

space ::=		;ascii code 32
tab ::=			;ascii code 9
newline ::=		;ascii code 10