- Add some media types to be dissected as xml

- be more tollerant on how an XML document should look like


svn path=/trunk/; revision=13639
This commit is contained in:
Luis Ontanon 2005-03-06 21:57:25 +00:00
parent c57a54f3ec
commit e6853d6645
3 changed files with 72 additions and 64 deletions

View File

@ -119,6 +119,7 @@ static void dissect_xml(tvbuff_t* tvb, packet_info* pinfo _U_, proto_tree* tree)
GPtrArray* stack;
#ifdef DEBUG_XML
proto_tree* tree2 = NULL;
proto_tree* pt = NULL;
#endif
is_soap = FALSE;
@ -258,4 +259,9 @@ proto_reg_handoff_xml(void)
xml_handle = find_dissector("xml");
dissector_add_string("media_type", "text/xml", xml_handle);
dissector_add_string("media_type", "application/smil", xml_handle);
dissector_add_string("media_type", "text/xml", xml_handle);
dissector_add_string("media_type", "application/xml", xml_handle);
dissector_add_string("media_type", "application/soap+xml", xml_handle);
}

View File

@ -287,15 +287,15 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
#define YY_NUM_RULES 26
#define YY_END_OF_BUFFER 27
static yyconst short int yy_accept[67] =
static yyconst short int yy_accept[68] =
{ 0,
0, 0, 3, 3, 0, 0, 0, 0, 0, 0,
25, 25, 27, 26, 26, 3, 3, 4, 21, 26,
25, 25, 27, 26, 16, 3, 3, 4, 21, 26,
23, 20, 7, 8, 6, 13, 26, 14, 25, 24,
16, 9, 3, 3, 21, 22, 20, 0, 7, 6,
13, 15, 14, 0, 25, 24, 0, 5, 2, 0,
0, 19, 0, 0, 12, 0, 0, 17, 0, 18,
0, 10, 0, 11, 1, 0
0, 5, 9, 3, 3, 21, 22, 20, 20, 0,
7, 6, 13, 15, 14, 14, 0, 25, 24, 0,
2, 0, 0, 19, 0, 0, 12, 1, 0, 17,
0, 18, 0, 10, 0, 11, 0
} ;
static yyconst int yy_ec[256] =
@ -332,70 +332,72 @@ static yyconst int yy_ec[256] =
static yyconst int yy_meta[15] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 2, 2, 3,
1, 1, 1, 1, 1, 2, 1, 2, 2, 3,
4, 1, 1, 2
} ;
static yyconst short int yy_base[79] =
static yyconst short int yy_base[82] =
{ 0,
55, 54, 0, 1, 10, 0, 23, 0, 36, 0,
3, 6, 60, 126, 46, 0, 52, 44, 54, 42,
126, 42, 50, 126, 0, 45, 34, 34, 0, 42,
48, 126, 0, 31, 40, 126, 30, 58, 38, 0,
37, 126, 25, 69, 0, 32, 27, 126, 0, 28,
26, 1, 25, 23, 13, 20, 19, 126, 14, 126,
14, 126, 9, 126, 126, 126, 83, 87, 91, 95,
98, 0, 101, 105, 109, 113, 117, 121
58, 57, 0, 1, 10, 0, 23, 0, 36, 0,
3, 6, 65, 126, 48, 0, 58, 0, 58, 47,
126, 3, 56, 126, 0, 55, 44, 12, 0, 52,
47, 126, 126, 0, 40, 45, 126, 0, 15, 58,
44, 0, 43, 126, 0, 21, 69, 0, 42, 37,
0, 38, 36, 20, 36, 31, 25, 126, 27, 126,
24, 126, 15, 126, 10, 126, 126, 83, 87, 91,
95, 98, 2, 101, 105, 1, 0, 109, 113, 117,
121
} ;
static yyconst short int yy_def[79] =
static yyconst short int yy_def[82] =
{ 0,
67, 67, 68, 68, 67, 5, 5, 7, 7, 9,
69, 69, 66, 66, 66, 70, 70, 66, 66, 66,
66, 71, 66, 66, 72, 66, 66, 73, 74, 74,
66, 66, 70, 70, 66, 66, 71, 66, 66, 72,
66, 66, 73, 66, 74, 74, 66, 66, 70, 75,
76, 66, 77, 78, 66, 66, 75, 66, 76, 66,
77, 66, 78, 66, 66, 0, 66, 66, 66, 66,
66, 66, 66, 66, 66, 66, 66, 66
68, 68, 69, 69, 68, 5, 5, 7, 7, 9,
70, 70, 67, 67, 67, 71, 71, 15, 67, 67,
67, 72, 67, 67, 73, 67, 67, 74, 75, 75,
67, 67, 67, 71, 71, 67, 67, 76, 72, 67,
67, 73, 67, 67, 77, 74, 67, 75, 75, 67,
71, 78, 79, 67, 80, 81, 67, 67, 78, 67,
79, 67, 80, 67, 81, 67, 0, 67, 67, 67,
67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
67
} ;
static yyconst short int yy_nxt[141] =
{ 0,
66, 40, 66, 66, 30, 17, 17, 30, 52, 18,
18, 19, 31, 64, 52, 31, 20, 62, 60, 15,
55, 21, 58, 22, 23, 65, 55, 64, 62, 14,
60, 58, 56, 46, 24, 44, 25, 26, 41, 39,
38, 35, 49, 46, 44, 42, 41, 14, 27, 28,
47, 39, 38, 36, 48, 35, 32, 34, 32, 66,
32, 50, 51, 15, 15, 52, 66, 66, 66, 66,
66, 52, 53, 54, 66, 66, 55, 66, 66, 66,
66, 66, 55, 14, 14, 14, 14, 16, 16, 16,
16, 29, 29, 29, 29, 33, 33, 66, 33, 37,
67, 45, 38, 42, 30, 17, 17, 30, 38, 18,
18, 19, 15, 40, 66, 15, 20, 45, 64, 15,
38, 21, 47, 22, 23, 40, 45, 54, 62, 14,
60, 47, 57, 54, 24, 66, 25, 26, 57, 64,
62, 60, 58, 49, 43, 41, 36, 14, 27, 28,
31, 51, 50, 49, 32, 44, 43, 41, 37, 36,
33, 52, 53, 35, 67, 54, 15, 15, 67, 67,
67, 54, 55, 56, 67, 67, 57, 67, 67, 67,
67, 67, 57, 14, 14, 14, 14, 16, 16, 16,
16, 29, 29, 29, 29, 34, 34, 67, 34, 39,
66, 37, 43, 66, 43, 45, 45, 66, 45, 57,
57, 57, 57, 59, 59, 59, 59, 61, 61, 61,
61, 63, 63, 63, 63, 13, 66, 66, 66, 66,
66, 66, 66, 66, 66, 66, 66, 66, 66, 66
67, 39, 46, 67, 46, 48, 48, 67, 48, 59,
59, 59, 59, 61, 61, 61, 61, 63, 63, 63,
63, 65, 65, 65, 65, 13, 67, 67, 67, 67,
67, 67, 67, 67, 67, 67, 67, 67, 67, 67
} ;
static yyconst short int yy_chk[141] =
{ 0,
0, 72, 0, 0, 11, 3, 4, 12, 52, 3,
4, 5, 11, 63, 52, 12, 5, 61, 59, 5,
55, 5, 57, 5, 7, 56, 55, 54, 53, 7,
51, 50, 47, 46, 7, 43, 7, 9, 41, 39,
37, 35, 34, 30, 28, 27, 26, 9, 9, 9,
31, 23, 22, 20, 31, 19, 18, 17, 15, 13,
31, 38, 38, 2, 1, 38, 0, 0, 0, 0,
0, 38, 44, 44, 0, 0, 44, 0, 0, 0,
0, 0, 44, 67, 67, 67, 67, 68, 68, 68,
68, 69, 69, 69, 69, 70, 70, 0, 70, 71,
0, 77, 76, 73, 11, 3, 4, 12, 22, 3,
4, 5, 11, 22, 65, 12, 5, 28, 63, 5,
39, 5, 28, 5, 7, 39, 46, 54, 61, 7,
59, 46, 57, 54, 7, 56, 7, 9, 57, 55,
53, 52, 50, 49, 43, 41, 36, 9, 9, 9,
15, 35, 31, 30, 15, 27, 26, 23, 20, 19,
15, 40, 40, 17, 13, 40, 2, 1, 0, 0,
0, 40, 47, 47, 0, 0, 47, 0, 0, 0,
0, 0, 47, 68, 68, 68, 68, 69, 69, 69,
69, 70, 70, 70, 70, 71, 71, 0, 71, 72,
0, 71, 73, 0, 73, 74, 74, 0, 74, 75,
75, 75, 75, 76, 76, 76, 76, 77, 77, 77,
77, 78, 78, 78, 78, 66, 66, 66, 66, 66,
66, 66, 66, 66, 66, 66, 66, 66, 66, 66
0, 72, 74, 0, 74, 75, 75, 0, 75, 78,
78, 78, 78, 79, 79, 79, 79, 80, 80, 80,
80, 81, 81, 81, 81, 67, 67, 67, 67, 67,
67, 67, 67, 67, 67, 67, 67, 67, 67, 67
} ;
static yy_state_type yy_last_accepting_state;
@ -463,7 +465,7 @@ char *yytext;
#define META_TAG 4
#define OUT 5
#line 467 "xml_lexer.c"
#line 469 "xml_lexer.c"
/* Macros after this point can all be overridden by user definitions in
* section 1.
@ -616,7 +618,7 @@ YY_DECL
#line 64 "xml_lexer.l"
#line 620 "xml_lexer.c"
#line 622 "xml_lexer.c"
if ( yy_init )
{
@ -667,7 +669,7 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 67 )
if ( yy_current_state >= 68 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@ -829,7 +831,7 @@ YY_RULE_SETUP
#line 94 "xml_lexer.l"
ECHO;
YY_BREAK
#line 833 "xml_lexer.c"
#line 835 "xml_lexer.c"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(COMMENT):
case YY_STATE_EOF(TAG):
@ -1126,7 +1128,7 @@ static yy_state_type yy_get_previous_state()
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 67 )
if ( yy_current_state >= 68 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@ -1161,11 +1163,11 @@ yy_state_type yy_current_state;
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 67 )
if ( yy_current_state >= 68 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
yy_is_jam = (yy_current_state == 66);
yy_is_jam = (yy_current_state == 67);
return yy_is_jam ? 0 : yy_current_state;
}

View File

@ -57,17 +57,17 @@ closetag_start "</"
tag_start "<"
tag_end ">"
closedtag_end "/>"
name [A-Za-z][_A-Za-z0-9:]*
name [A-Za-z][-_A-Za-z0-9:]*
whitespace [ \t\r\n]+
text [^<]*
%START COMMENT TAG CLOSE_TAG META_TAG OUT
%%
<OUT>{comment_start} { add_xml_item(XML_COMMENT_START, XML_CTX_COMMENT, yyleng, yytext); BEGIN COMMENT;}
{comment_start} { add_xml_item(XML_COMMENT_START, XML_CTX_COMMENT, yyleng, yytext); BEGIN COMMENT;}
<COMMENT>{comment_end} { add_xml_item(XML_COMMENT_END, XML_CTX_COMMENT, yyleng, yytext); BEGIN OUT; }
<COMMENT>{text} add_xml_item(XML_TEXT, XML_CTX_COMMENT, yyleng, yytext);
<COMMENT>{tag_start} add_xml_item(XML_TEXT, XML_CTX_COMMENT, yyleng, yytext);
<OUT>{closetag_start} { add_xml_item(XML_CLOSE_TAG_START, XML_CTX_CLOSETAG, yyleng, yytext); BEGIN CLOSE_TAG; }
{closetag_start} { add_xml_item(XML_CLOSE_TAG_START, XML_CTX_CLOSETAG, yyleng, yytext); BEGIN CLOSE_TAG; }
<CLOSE_TAG>{name} add_xml_item(XML_NAME, XML_CTX_CLOSETAG, yyleng, yytext);
<CLOSE_TAG>{whitespace} add_xml_item(XML_WHITESPACE, XML_CTX_CLOSETAG, yyleng,yytext);
<CLOSE_TAG>{tag_end} { add_xml_item(XML_TAG_END, XML_CTX_CLOSETAG, yyleng, yytext); BEGIN OUT; }
@ -80,7 +80,7 @@ text [^<]*
<META_TAG>{name} add_xml_item(XML_NAME, XML_CTX_METATAG, yyleng, yytext);
<META_TAG>{metatag_end} { add_xml_item(XML_METATAG_END, XML_CTX_METATAG, yyleng,yytext); BEGIN OUT; }
<OUT>{tag_start} { add_xml_item(XML_TAG_START, XML_CTX_TAG, yyleng, yytext); BEGIN TAG; }
{tag_start} { add_xml_item(XML_TAG_START, XML_CTX_TAG, yyleng, yytext); BEGIN TAG; }
<TAG>{property_dq} add_xml_item(XML_PROPERTY, XML_CTX_TAG, yyleng, yytext);
<TAG>{property_sq} add_xml_item(XML_PROPERTY, XML_CTX_TAG, yyleng, yytext);
<TAG>{property_nq} add_xml_item(XML_PROPERTY, XML_CTX_TAG, yyleng, yytext);