* Routines for raw data (default case)
* Gilbert Ramirez <gram@xiexie.org>
*
- * $Id: packet-data.c,v 1.17 2000/05/11 22:04:15 gram Exp $
+ * $Id: packet-data.c,v 1.21 2001/01/03 06:55:27 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
*/
int proto_data = -1;
+/* Remove this once all dissectors are converted to use tvbuffs */
void
-dissect_data(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
+old_dissect_data(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
{
if (IS_DATA_IN_FRAME(offset) && tree) {
proto_tree_add_protocol_format(tree, proto_data, NullTVB, offset,
}
}
-/* This will become dissect_data() once all dissectors are converted to use tvbuffs */
void
-dissect_data_tvb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_data(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
int bytes;
if (tree) {
- bytes = tvb_length(tvb);
- proto_tree_add_protocol_format(tree, proto_data, tvb, 0,
- bytes, "Data (%d byte%s)", bytes,
- plurality(bytes, "", "s"));
+ bytes = tvb_length_remaining(tvb, offset);
+ if (bytes > 0) {
+ proto_tree_add_protocol_format(tree, proto_data, tvb,
+ offset,
+ bytes, "Data (%d byte%s)", bytes,
+ plurality(bytes, "", "s"));
+ }
}
}
proto_register_data(void)
{
proto_data = proto_register_protocol (
- /* name */ "Data",
- /* abbrev */ "data" );
+ "Data", /* name */
+ "Data", /* short name */
+ "data" /* abbrev */
+ );
+
+ /*
+ * "Data" is used to dissect something whose normal dissector
+ * is disabled, so it cannot itself be disabled.
+ */
+ proto_set_cant_disable(proto_data);
+
}