1998-09-16 02:39:15 +00:00
|
|
|
/* packet-data.c
|
|
|
|
* Routines for raw data (default case)
|
2001-11-13 23:55:44 +00:00
|
|
|
* Gilbert Ramirez <gram@alumni.rice.edu>
|
1998-09-16 02:39:15 +00:00
|
|
|
*
|
2002-05-10 23:20:38 +00:00
|
|
|
* $Id: packet-data.c,v 1.29 2002/05/10 23:20:38 guy Exp $
|
1998-09-16 03:22:19 +00:00
|
|
|
*
|
1998-09-16 02:39:15 +00:00
|
|
|
* Ethereal - Network traffic analyzer
|
2001-10-31 05:59:20 +00:00
|
|
|
* By Gerald Combs <gerald@ethereal.com>
|
1998-09-16 02:39:15 +00:00
|
|
|
* 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
|
|
|
|
|
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
# include <sys/types.h>
|
|
|
|
#endif
|
|
|
|
|
1999-03-23 03:14:46 +00:00
|
|
|
#include <glib.h>
|
2002-01-21 07:37:49 +00:00
|
|
|
#include <epan/packet.h>
|
2002-05-10 23:20:38 +00:00
|
|
|
#include "packet-data.h"
|
1998-09-16 02:39:15 +00:00
|
|
|
|
1999-07-29 05:47:07 +00:00
|
|
|
/* proto_data cannot be static because it's referenced in the
|
|
|
|
* print routines
|
|
|
|
*/
|
1999-07-07 22:52:57 +00:00
|
|
|
int proto_data = -1;
|
|
|
|
|
2002-04-04 05:16:15 +00:00
|
|
|
static void
|
2002-04-04 03:52:47 +00:00
|
|
|
dissect_data(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
|
2000-05-11 22:04:18 +00:00
|
|
|
{
|
|
|
|
int bytes;
|
|
|
|
|
|
|
|
if (tree) {
|
2001-11-26 05:41:15 +00:00
|
|
|
bytes = tvb_length_remaining(tvb, 0);
|
2000-05-12 06:23:33 +00:00
|
|
|
if (bytes > 0) {
|
2000-11-16 07:35:43 +00:00
|
|
|
proto_tree_add_protocol_format(tree, proto_data, tvb,
|
2001-11-26 05:41:15 +00:00
|
|
|
0,
|
2000-05-12 06:23:33 +00:00
|
|
|
bytes, "Data (%d byte%s)", bytes,
|
|
|
|
plurality(bytes, "", "s"));
|
|
|
|
}
|
2000-05-11 22:04:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-07-07 22:52:57 +00:00
|
|
|
void
|
|
|
|
proto_register_data(void)
|
|
|
|
{
|
|
|
|
proto_data = proto_register_protocol (
|
2001-01-03 06:56:03 +00:00
|
|
|
"Data", /* name */
|
|
|
|
"Data", /* short name */
|
|
|
|
"data" /* abbrev */
|
|
|
|
);
|
|
|
|
|
2002-04-04 05:16:15 +00:00
|
|
|
register_dissector("data", dissect_data, proto_data);
|
2001-11-25 21:44:57 +00:00
|
|
|
|
2001-01-03 06:56:03 +00:00
|
|
|
/*
|
|
|
|
* "Data" is used to dissect something whose normal dissector
|
|
|
|
* is disabled, so it cannot itself be disabled.
|
|
|
|
*/
|
|
|
|
proto_set_cant_disable(proto_data);
|
1999-07-07 22:52:57 +00:00
|
|
|
}
|