⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sdp.syn

📁 h.248协议源码
💻 SYN
字号:
// -- CONFIGURATION SECTION ----------------------------
[
  grammar token = sdp_descr

  default token type = void
  pointer input							// Take input from array in memory
  parser name = rvSdpParser			                // Name parser function
  parser file name = "#.c"			                // Name parser file
  line numbers				                        // Generate #line directives
  reentrant parser						// Make parser reentrant
]


// -- LEXICAL UNITS ------------------------------------

ALPHA_DIGIT =       ALPHA + DIGIT


DIGIT =               '0' + POS_DIGIT


POS_DIGIT = '1-9'


ALPHA = 'a-z' + 'A-Z'

email_safe =          safe + space + tab


safe =                ALPHA_DIGIT +
                      '\'' + '-' + '.' + '/' + ':' + '?' + '"' +
                      '#' + '$' + '&' + '*' + ';' + '=' + '@' + '[' +
                      ']' + '^' + '_' + '`' + '{' + '|' + '}' + '+' +
                      '~' 
					  // Note : What is this ??? : + "


space =               ' ' // 32
tab =                 9


EOF = 0 

let_dig_hyp = ALPHA_DIGIT + '-'

// any byte except NUL, CR or LF
any_byte = 0x01..0x09 + 0x0b + 0x0c + 0x0e..0xff -'\n'

email_char_set = any_byte - '(' - ')' - '<' - '>'


//--------------- Low level productions ----------------------------------------

// default is to interpret this as IS0-10646 UTF8
// ISO 8859-1 requires a "a=charset:ISO-8859-1"
// session-level attribute to be used
text =                byte_string

// any byte except NUL, CR or LF
byte_string //   1*(0x01..0x09|0x0b|0x0c|0x0e..0xff)
	-> any_byte...                    

decimal_uchar        
//	-> DIGIT
//	-> POS_DIGIT, DIGIT
//	-> "1", [DIGIT,DIGIT...]
//	-> "2", [DIGIT]
//	-> "2", {"0"|"1"|"2"|"3"|"4"}, DIGIT
//	-> "2", "5", ["0"|"1"|"2"|"3"|"4"|"5"]
	-> DIGIT
	-> DIGIT,DIGIT
	-> DIGIT,DIGIT,DIGIT

pos_integer //             POS_DIGIT *(DIGIT)
	->POS_DIGIT, [DIGIT]...


CRLF
	-> 13,10 | '\n'

   
//--------------- SDP Productions --------------------------------------------------

// Note : add rule to end with EOF
//sdp_descr 
//	-> proto_version,[sdp_field1]...,[time_fields],[sdp_field2]...,[media_description]..., EOF
   

//sdp_field1 
//	-> origin_field
//	-> session_name_field
//	-> information_field
//	-> uri_field
//	-> email_field
//	-> phone_field
//	-> connection_field
//	-> bandwidth_field

//sdp_field2 
//	-> key_field
//	-> attribute_field

sdp_descr 
	-> proto_version,
	[origin_field],
	[session_name_field],
	[information_field],
	[uri_field],
	[email_field]...,
	[phone_field]...,
	[connection_field],
	[bandwidth_field]...,
	[time_fields],
	[key_field],
	[attribute_field]...,
	[media_description]..., EOF

proto_version //       "v=" 1*DIGIT CRLF ;this memo describes version 0
	-> "v=", DIGIT..., CRLF
                      
origin_field 
	-> "o=", byte_string, CRLF

session_name_field 
	->  "s=", text, CRLF

information_field 
	->   "i=", text, CRLF

uri_field 
	->   "u=", byte_string, CRLF

email_field //        *("e=" email_address CRLF)
	-> "e=", byte_string, CRLF

phone_field //        *("p=" phone_number CRLF)
	-> "p=", byte_string, CRLF

//  a connection field must be present in every media description or at the
//  session-level
connection_field
//	-> ["c=", nettype, space, addrtype, space, connection_address, CRLF]
	-> "c=", nettype, space, addrtype, space, connection_address, CRLF


bandwidth_field //  *("b=" bwtype ":" bandwidth CRLF)
	-> "b=", bwtype, ":",bandwidth, CRLF

//time_field
//	-> "t=",byte_string

time_fields // 1*( "t=" start_time space stop_time *(CRLF repeat_fields) CRLF) [zone_adjustments CRLF]
//	-> { "t=",byte_string, CRLF}... 
	-> { "t=",byte_string, CRLF}..., [zone_adjustments]                      
	-> { "t=",byte_string, CRLF, {repeat_field}...}..., [zone_adjustments]    
                    
repeat_field // "r=" repeat_interval space typed_time 1*(space typed_time)
	-> "r=", byte_string , CRLF

zone_adjustments //    time space ["-"] typed_time *(space time space ["-"] typed_time)
	->  time, space, ["-"], typed_time, [space, time, space, ["-"], typed_time]... , CRLF                    

key_field //           ["k=" key-type CRLF]
	-> "k=", key_type, CRLF

key_type         
	->  "prompt" 
    ->  "clear:", key_data 
    ->  "base64:", key_data 
    ->  "uri:", uri


key_data //  email_safe | "~" | "
	->  email_safe | "~" // Note: What is this ???  | "

attribute_field//    *("a=" attribute CRLF)
	->  "a=", attribute, CRLF

media_description // *( media_field information_field *(connection_field) bandwidth_fields key_field attribute_fields )
	-> media_field,[information_field],[connection_field]...,[bandwidth_field]...,[key_field],[attribute_field]...

media_field // "m=" media space port ["/" pos_integer]  space proto 1*(space fmt) CRLF
	-> "m=", media, space, port, ["/", pos_integer],  space, proto, {space, fmt}..., CRLF                   

//typically "audio", "video", "application" or "data"
media 
	-> ALPHA_DIGIT...

// typically an RTP payload type for audio and video media
fmt 	
	-> ALPHA_DIGIT...


// typically "RTP/AVP" or "udp" for IP4
proto 
	-> safe...


attribute //           (att_field ":" att_value) | att_field
	-> att_field, ":", att_value 
	-> att_field

att_field //           1*(ALPHA_DIGIT)
	-> ALPHA_DIGIT...


att_value = byte_string


// Note : multicast_address conflicts, resolve in semantic level
connection_address 
//	->  multicast_address 
	->  addr

//  multicast addresses may be in the range
//  224.0.0.0 to 239.255.255.255
// multicast_address //   3*(decimal_uchar ".") decimal_uchar "/" ttl [ "/" pos_integer ]
//	-> decimal_uchar3, decimal_uchar, "/", ttl, [ "/", pos_integer ]
// Good for multicast_address and IP4 address
addr
	-> address_part, "/", ttl, [ "/", pos_integer ]
	-> address_part

// At least 3 decimal_uchar
address_part
	-> decimal_uchar,".",decimal_uchar,".",decimal_uchar,".",decimal_uchar
	-> address_part,".",decimal_uchar

ttl = decimal_uchar


// sufficient for 2 more centuries
time //  POS_DIGIT 9*(DIGIT)
	->  POS_DIGIT, DIGIT9                      

// AT least 9 digits
DIGIT9
	-> DIGIT,DIGIT,DIGIT,DIGIT,DIGIT,DIGIT,DIGIT,DIGIT,DIGIT,DIGIT?...

repeat_interval =     typed_time


typed_time //          1*(DIGIT) [fixed-len_time-unit]
	->  DIGIT..., [fixed_len_time_unit]

fixed_len_time_unit 
	->  "d" | "h" | "m" | "s"


bwtype //              1*(ALPHA_DIGIT)
	-> ALPHA_DIGIT...

bandwidth //           1*(DIGIT)
	-> DIGIT...

// pretty wide definition, but doesn't include space
username =  safe
                      


//-------------Uri definitions -----------------------------
//   Note:   defined in RFC1630

uri = byte_string                   

//----------------------------------------------------------


// list to be extended
nettype 
	-> "IN"

//  list to be extended
addrtype 
	-> "IP4" // | "IP6"


//IP4_address //  b1 "." decimal_uchar "." decimal_uchar "." b4
//	-> b1, ".", decimal_uchar, ".", decimal_uchar, ".", b4

// less than "224"; not "0" or "127"
b1 =  decimal_uchar
                      
// not "0"
b4 = decimal_uchar
                      
// Note : to be defined
//IP6_address          

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -