delete the xml plugin

svn path=/trunk/; revision=15989
This commit is contained in:
Luis Ontanon 2005-09-24 16:37:48 +00:00
parent 86e8646afd
commit 0f2e45a47a
9 changed files with 0 additions and 590 deletions

View File

@ -1 +0,0 @@
Luis E. Garcia Ontanon <luis.ontanon@gmail.com>

View File

@ -1,19 +0,0 @@
Copyright 2005, Luis E. Garcia Ontanon <luis.ontanon@gmail.com>
Ethereal - Network traffic analyzer
By Gerald Combs <gerald@ethereal.com>
Copyright 1998 Gerald Combs
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

View File

@ -1,64 +0,0 @@
# Makefile.am
# Automake file for XML Ethereal plugin
#
# $Id$
#
# Ethereal - Network traffic analyzer
# By Gerald Combs <gerald@ethereal.com>
# Copyright 1998 Gerald Combs
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
INCLUDES = -I$(top_srcdir)
plugindir = @plugindir@
plugin_LTLIBRARIES = xml.la
xml_la_SOURCES = moduleinfo.h \
packet-xml.h \
xml_lexer.l \
packet-xml.c \
xml_plugin.c
# dtd.h dtd.c dtd_lexer.l dtd_prep.l dtd_parser.c dtd_parser.h
xml_la_LDFLAGS = -module -avoid-version
xml_la_LIBADD = @PLUGIN_LIBS@
# Libs must be cleared, or else libtool won't create a shared module.
# If your module needs to be linked against any particular libraries,
# add them here.
LIBS =
CLEANFILES = \
xml \
*~
MAINTAINERCLEANFILES = \
Makefile.in
EXTRA_DIST = \
Makefile.nmake \
xml_lexer.l
# dtd_parser.lemon dtd_prep.l \
#
#LEMON=../../tools/lemon
#
#dtd_parser.h : dtd_parser.c
#dtd_parser.c : dtd_parser.lemon
# $(LEMON)/lemon t=$(srcdir)/$(lemon) $(srcdir)/dtd_parser.lemon || (rm -f dtd_parser.c dtd_parser.h false)
#

View File

@ -1,46 +0,0 @@
#
# $Id$
#
include ..\..\config.nmake
include <win32.mak>
############### no need to modify below this line #########
CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
.c.obj::
$(CC) $(CFLAGS) -Fdxml.pdb -c $<
LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
!IFDEF ENABLE_LIBETHEREAL
LINK_PLUGIN_WITH=..\..\epan\libethereal.lib
CFLAGS=/DHAVE_WIN32_LIBETHEREAL_LIB /D_NEED_VAR_IMPORT_ $(CFLAGS)
OBJECTS=packet-xml.obj xml_lexer.obj xml_plugin.obj
xml.dll xml.exp xml.lib : $(OBJECTS) $(LINK_PLUGIN_WITH)
link -dll /out:xml.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
$(GLIB_LIBS)
!ENDIF
xml_lexer.c : xml_lexer.l
$(LEX) -oxml_lexer.c xml_lexer.l
clean:
rm -f $(OBJECTS) xml.dll xml.exp xml.lib *.pdb
#
# We remove "xml_lexter.c" with "distclean" because it needs different
# #includes for UN*X and Windows (UN*X versions of Flex make it include
# <unistd.h>, but that's a UN*X-only header), so if you're going to build
# from source, you need to build "xml_lexer.c" from "xml_lexer.l" with
# Flex.
#
distclean: clean
rm -f xml_lexer.c
maintainer-clean: distclean

View File

@ -1,16 +0,0 @@
/* Included *after* config.h, in order to re-define these macros */
#ifdef PACKAGE
#undef PACKAGE
#endif
/* Name of package */
#define PACKAGE "xml"
#ifdef VERSION
#undef VERSION
#endif
/* Version number of package */
#define VERSION "0.0.-1"

View File

@ -1,141 +0,0 @@
/* packet-xml.c
* an XML dissector for ethereal
*
* Copyright 2004, Luis E. Garcia Ontanon <luis.ontanon@gmail.com>
*
* $Id$
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "packet-xml.h"
static int proto_xml = -1;
static int ett_xml = -1;
static int hf_xml_pi = -1;
static int hf_xml_markup_decl = -1;
static int hf_xml_tag = -1;
static int hf_xml_text = -1;
extern proto_item* proto_tree_add_xml_item(proto_tree* tree, tvbuff_t* tvb,
xml_token_type_t type, guint offset, guint len) {
proto_item* pi;
gchar* txt;
int hfid;
switch (type) {
case XML_TAG: hfid = hf_xml_tag; break;
case XML_MARKUPDECL: hfid = hf_xml_markup_decl; break;
case XML_XMLPI: hfid = hf_xml_pi; break;
case XML_TEXT: hfid = hf_xml_text; break;
default: hfid = 0; break;
}
txt = tvb_get_string(tvb,offset,len);
if ( hfid ) {
pi = proto_tree_add_string_format(tree,hfid,tvb,offset,len,txt,"%s",format_text(txt, len));
} else {
pi = proto_tree_add_text(tree,tvb,offset,len,"%s",format_text(txt, len));
}
g_free(txt);
return pi;
}
void
proto_register_xml(void)
{
static hf_register_info hf[] = {
{ &hf_xml_pi,
{ "XML Processing Instruction",
"xml.pi", FT_STRING, BASE_NONE, NULL, 0x0,
"XML Processing Instruction", HFILL }},
{ &hf_xml_markup_decl,
{ "XML Markup Declaration",
"xml.markrp_decl", FT_STRING, BASE_NONE, NULL, 0x0,
"XML Markup Declaration", HFILL }},
{ &hf_xml_tag,
{ "XML Tag",
"xml.tag", FT_STRING, BASE_NONE, NULL, 0x0,
"XML Tag", HFILL }},
{ &hf_xml_text,
{ "XML Text",
"xml.text", FT_STRING, BASE_NONE, NULL, 0x0,
"Text in XML", HFILL }}
};
static gint *ett[] = {
&ett_xml
};
proto_xml = proto_register_protocol("eXtensible Markup Language", "XML", "xml");
proto_register_field_array(proto_xml, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
register_dissector("xml", dissect_xml, proto_xml);
}
void
proto_reg_handoff_xml(void)
{
dissector_handle_t xml_handle;
xml_handle = find_dissector("xml");
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);
dissector_add_string("media_type", "application/xml-dtd", xml_handle);
/* WAP and OMA XML media */
dissector_add_string("media_type", "text/vnd.wap.wml", xml_handle);
dissector_add_string("media_type", "text/vnd.wap.si", xml_handle);
dissector_add_string("media_type", "text/vnd.wap.sl", xml_handle);
dissector_add_string("media_type", "text/vnd.wap.co", xml_handle);
dissector_add_string("media_type", "text/vnd.wap.emn", xml_handle);
dissector_add_string("media_type", "application/vnd.wv.csp+xml", xml_handle);
/* The Extensible Markup Language (XML) Configuration Access Protocol (XCAP)
* draft-ietf-simple-xcap-06
*/
dissector_add_string("media_type", "application/xcap-el+xml", xml_handle);
dissector_add_string("media_type", "application/xcap-att+xml", xml_handle);
dissector_add_string("media_type", "application/xcap-error+xml", xml_handle);
dissector_add_string("media_type", "application/xcap-caps+xml", xml_handle);
/* draft-ietf-simple-presence-rules-02 */
dissector_add_string("media_type", "application/auth-policy+xml", xml_handle);
/* Other */
dissector_add_string("media_type", "application/smil", xml_handle);
dissector_add_string("media_type", "application/cpim-pidf+xml", xml_handle);
dissector_add_string("media_type", "application/rdf+xml", xml_handle);
dissector_add_string("media_type", "application/xslt+xml", xml_handle);
dissector_add_string("media_type", "application/mathml+xml", xml_handle);
dissector_add_string("media_type", "image/svg+xml", xml_handle);
dissector_add_string("media_type", "application/vnd.wv.csp.xml", xml_handle);
xml_lexer_init(proto_xml,ett_xml);
}

View File

@ -1,68 +0,0 @@
/* packet-xml.h
* an XML dissector for ethereal
*
* Copyright 2004, Luis E. Garcia Ontanon <luis.ontanon@gmail.com>
*
* $Id$
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __XML_H_
#define __XML_H_
#include <epan/tvbuff.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <glib.h>
#include <epan/packet.h>
#include <epan/strutil.h>
#include <epan/prefs.h>
#include <epan/report_err.h>
typedef enum _xml_token_type_t {
XML_WHITESPACE,
XML_TEXT,
XML_COMMENT,
XML_TAG,
XML_CLOSEDTAG,
XML_MARKUPDECL,
XML_XMLPI,
XML_CLOSE_TAG,
XML_DOCTYPE_START,
XML_DOCTYPE_STOP
} xml_token_type_t;
extern proto_item* proto_tree_add_xml_item(proto_tree* tree,
tvbuff_t* tvb,
xml_token_type_t type,
guint offset,
guint len);
extern void xml_lexer_init(int proto_hfid, int ett);
extern void dissect_xml(tvbuff_t* tvb,
packet_info* pinfo,
proto_tree* tree);
#endif

View File

@ -1,174 +0,0 @@
%option noyywrap
%option nounput
%option caseless
%{
/* xml_lexer.l
* an XML dissector for ethereal
* lexical analyzer for XML
*
* Copyright 2004, Luis E. Garcia Ontanon <luis.ontanon@gmail.com>
*
* $Id$
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "packet-xml.h"
static guint8* extracted = NULL;
static gint offset;
static gint text_offset;
static gint len;
tvbuff_t* tvb;
proto_item* pi;
proto_tree* tree;
GPtrArray* stack;
static int ett_xml;
static int proto_xml;
#define YY_INPUT(buff,result,max_size) \
( (result) = tvb_yyinput((buff),(max_size)) )
#define ECHO ;
static void add_xml_item(xml_token_type_t, guint);
static int tvb_yyinput(char*, guint);
%}
xmlpi_start "<?"
xmlpi_end "?>"
comment_start <!--
comment_end -->
markupdecl_start "<!"
closetag_start "</"
tag_start "<"
tag_end >
closedtag_end "/>"
open_brace "["
dtd_doctype_stop "]"[:blank:]*>
whitespace [[:blank:]\r\n]+
text_start ([^<[:blank:]\r\n]|[^<])
text_stop <
%START OUTSIDE COMMENT TAG CLOSE_TAG XMLPI DOCTYPE MARKUPDECL CDATA
%%
<OUTSIDE>{whitespace} { text_offset = offset - yyleng; add_xml_item(XML_WHITESPACE, yyleng); }
<OUTSIDE>{dtd_doctype_stop} { text_offset = offset - yyleng; add_xml_item(XML_DOCTYPE_STOP, yyleng); }
<OUTSIDE>{text_start} { text_offset = offset - yyleng; BEGIN CDATA; }
<CDATA>{text_stop} { add_xml_item(XML_TEXT, --offset - text_offset ); BEGIN OUTSIDE; }
<OUTSIDE>{comment_start} { text_offset = offset - yyleng; BEGIN COMMENT; }
<COMMENT>{comment_end} { add_xml_item(XML_COMMENT, offset - text_offset); BEGIN OUTSIDE; }
<OUTSIDE>{closetag_start} { text_offset = offset - yyleng ; BEGIN CLOSE_TAG; }
<CLOSE_TAG>{tag_end} { add_xml_item(XML_CLOSE_TAG, offset - text_offset ); BEGIN OUTSIDE; }
<OUTSIDE>{xmlpi_start} { text_offset = offset - yyleng; BEGIN XMLPI; }
<XMLPI>{xmlpi_end} { add_xml_item(XML_XMLPI, offset - text_offset); BEGIN OUTSIDE; }
<OUTSIDE>{markupdecl_start} { text_offset = offset - yyleng -1; BEGIN MARKUPDECL; }
<MARKUPDECL>{open_brace} { add_xml_item(XML_DOCTYPE_START, offset - text_offset); BEGIN OUTSIDE; }
<MARKUPDECL>{tag_end} { add_xml_item(XML_MARKUPDECL, offset - text_offset); BEGIN OUTSIDE; }
<OUTSIDE>{tag_start} { text_offset = offset - yyleng -1; BEGIN TAG; }
<TAG>{closedtag_end} { add_xml_item(XML_CLOSEDTAG, offset - text_offset); BEGIN OUTSIDE; }
<TAG>{tag_end} { add_xml_item(XML_TAG, offset - text_offset); BEGIN OUTSIDE; }
%%
static void add_xml_item(xml_token_type_t type, guint the_len) {
switch (type) {
case XML_WHITESPACE:
break;
case XML_CLOSEDTAG:
case XML_TEXT:
case XML_MARKUPDECL:
case XML_XMLPI:
case XML_COMMENT:
pi = proto_tree_add_xml_item(tree,tvb,type,text_offset,the_len);
break;
case XML_DOCTYPE_START:
case XML_TAG:
pi = proto_tree_add_xml_item(tree,tvb,type,text_offset,the_len);
g_ptr_array_add(stack,tree);
tree = proto_item_add_subtree(pi, ett_xml);
break;
case XML_CLOSE_TAG:
case XML_DOCTYPE_STOP:
pi = proto_tree_add_xml_item(tree,tvb,type,text_offset,the_len);
if ( stack->len )
tree = g_ptr_array_remove_index(stack,stack->len - 1);
break;
}
}
static int tvb_yyinput(char* buff, guint max_len _U_) {
if ( offset < len ) {
buff[0] = extracted[offset];
offset++;
return 1;
} else {
return YY_NULL;
}
}
extern void xml_lexer_init(int proto_hfid, int ett) {
proto_xml = proto_hfid;
ett_xml = ett;
}
extern void dissect_xml(tvbuff_t* the_tvb, packet_info* pinfo _U_, proto_tree* the_tree) {
if (the_tree) {
tree = the_tree;
tvb = the_tvb;
text_offset = offset = 0;
len = tvb_length(tvb);
extracted = tvb_memdup(tvb,offset,len);
stack = g_ptr_array_new();
pi = proto_tree_add_item(tree, proto_xml, tvb, 0, -1, FALSE);
tree = proto_item_add_subtree(pi, ett_xml);
BEGIN OUTSIDE;
yylex();
yyrestart(NULL);
g_free(extracted);
g_ptr_array_free(stack,FALSE);
}
}

View File

@ -1,61 +0,0 @@
/* xml_plugin.c
*
* Copyright 2004, Luis E. Garcia Ontanon <luis.ontanon@gmail.com>
*
* $Id$
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* this file is used temporarily to buid it as a plugin */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <glib.h>
#ifndef ENABLE_STATIC
#include "moduleinfo.h"
#include <gmodule.h>
#endif
/* these two are in packet-xml.c */
void proto_register_xml(void);
void proto_reg_handoff_xml(void);
static gboolean initialized = FALSE;
#ifndef ENABLE_STATIC
G_MODULE_EXPORT const gchar version[] = VERSION;
G_MODULE_EXPORT void plugin_register(void) {
/* register the new protocol, protocol fields, and subtrees */
if (! initialized ) { /* execute protocol initialization only once */
proto_register_xml();
initialized = TRUE;
}
}
G_MODULE_EXPORT void plugin_reg_handoff(void)
{
proto_reg_handoff_xml();
}
#endif