From 56b989e0adbbbdb7b5f0e9edeb47dc7ebd44ced0 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Mon, 7 Aug 2000 03:21:25 +0000 Subject: [PATCH] Allow either old-style (pre-tvbuff) or new-style (tvbuffified) dissectors to be registered as dissectors for particular ports, registered as heuristic dissectors, and registered as dissectors for conversations, and have routines to be used both by old-style and new-style dissectors to call registered dissectors. Have the code that calls those dissectors translate the arguments as necessary. (For conversation dissectors, replace "find_conversation_dissector()", which just returns a pointer to the dissector, with "old_try_conversation_dissector()" and "try_conversation_dissector()", which actually call the dissector, so that there's a single place at which we can do that translation. Also make "dissector_lookup()" static and, instead of calling it and, if it returns a non-null pointer, calling that dissector, just use "old_dissector_try_port()" or "dissector_try_port()", for the same reason.) This allows some dissectors that took old-style arguments and immediately translated them to new-style arguments to just take new-style arguments; make them do so. It also allows some new-style dissectors not to have to translate arguments before calling routines to look up and call dissectors; make them not do so. Get rid of checks for too-short frames in new-style dissectors - the tvbuff code does those checks for you. Give the routines to register old-style dissectors, and to call dissectors from old-style dissectors, names beginning with "old_", with the routines for new-style dissectors not having the "old_". Update the dissectors that use those routines appropriately. Rename "dissect_data()" to "old_dissect_data()", and "dissect_data_tvb()" to "dissect_data()". svn path=/trunk/; revision=2218 --- conversation.c | 68 ++++++++++-- conversation.h | 19 +++- packet-aarp.c | 8 +- packet-arp.c | 14 +-- packet-atalk.c | 34 +++--- packet-atm.c | 8 +- packet-auto_rp.c | 8 +- packet-bgp.c | 4 +- packet-bootp.c | 4 +- packet-bpdu.c | 6 +- packet-cdp.c | 4 +- packet-clnp.c | 38 +++---- packet-cops.c | 11 +- packet-data.c | 8 +- packet-ddtp.c | 19 +--- packet-diameter.c | 18 ++-- packet-dns.c | 6 +- packet-eigrp.c | 8 +- packet-esis.c | 4 +- packet-eth.c | 14 +-- packet-ethertype.c | 41 +++---- packet-fddi.c | 4 +- packet-ftp.c | 6 +- packet-giop.c | 18 ++-- packet-gre.c | 10 +- packet-h1.c | 35 +++--- packet-hsrp.c | 6 +- packet-http.c | 12 +-- packet-icmpv6.c | 18 ++-- packet-icp.c | 4 +- packet-icq.c | 4 +- packet-imap.c | 4 +- packet-ip.c | 37 +++---- packet-ipp.c | 6 +- packet-ipsec.c | 16 +-- packet-ipv6.c | 16 +-- packet-ipx.c | 67 +++--------- packet-ipx.h | 4 +- packet-irc.c | 4 +- packet-isakmp.c | 34 +++--- packet-isis.c | 4 +- packet-isl.c | 6 +- packet-l2tp.c | 4 +- packet-lapd.c | 6 +- packet-ldap.c | 4 +- packet-llc.c | 17 ++- packet-lpd.c | 10 +- packet-mapi.c | 4 +- packet-mip.c | 4 +- packet-mpls.c | 6 +- packet-msproxy.c | 9 +- packet-nbipx.c | 6 +- packet-nbns.c | 12 +-- packet-ncp.c | 12 +-- packet-netbios.c | 6 +- packet-nntp.c | 4 +- packet-ntp.c | 6 +- packet-null.c | 6 +- packet-osi.c | 12 +-- packet-ospf.c | 6 +- packet-pim.c | 4 +- packet-pop.c | 6 +- packet-ppp.c | 6 +- packet-pppoe.c | 6 +- packet-pptp.c | 8 +- packet-quake.c | 22 +--- packet-radius.c | 10 +- packet-rip.c | 10 +- packet-ripng.c | 4 +- packet-rlogin.c | 4 +- packet-rpc.c | 8 +- packet-rsvp.c | 4 +- packet-rtsp.c | 10 +- packet-rx.c | 6 +- packet-sap.c | 4 +- packet-sctp.c | 21 ++-- packet-sna.c | 8 +- packet-snmp.c | 18 ++-- packet-socks.c | 7 +- packet-srvloc.c | 6 +- packet-sscop.c | 4 +- packet-syslog.c | 16 +-- packet-tacacs.c | 6 +- packet-tcp.c | 26 ++--- packet-telnet.c | 4 +- packet-time.c | 4 +- packet-tns.c | 16 +-- packet-tr.c | 4 +- packet-udp.c | 30 +++--- packet-v120.c | 4 +- packet-vines.c | 12 +-- packet-vlan.c | 8 +- packet-vrrp.c | 8 +- packet-wccp.c | 6 +- packet-who.c | 4 +- packet-x11.c | 12 +-- packet-x25.c | 4 +- packet-yhoo.c | 4 +- packet.c | 261 ++++++++++++++++++++++++++++++++++++++++----- packet.h | 29 +++-- 100 files changed, 784 insertions(+), 643 deletions(-) diff --git a/conversation.c b/conversation.c index 60e4f8dd58..a1d84ec227 100644 --- a/conversation.c +++ b/conversation.c @@ -1,7 +1,7 @@ /* conversation.c * Routines for building lists of packets that are part of a "conversation" * - * $Id: conversation.c,v 1.7 2000/04/12 22:53:14 guy Exp $ + * $Id: conversation.c,v 1.8 2000/08/07 03:20:20 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -279,15 +279,65 @@ find_conversation(address *src, address *dst, port_type ptype, /* * Given source and destination addresses and ports for a packet, * search for a conversational dissector. - * Returns NULL if not found. + * If found, call it and return TRUE, otherwise return FALSE. */ -dissector_t find_conversation_dissector(address *src, address *dst, port_type ptype, - guint32 src_port, guint32 dst_port){ +gboolean +old_try_conversation_dissector(address *src, address *dst, port_type ptype, + guint32 src_port, guint32 dst_port, const u_char *pd, int offset, + frame_data *fd, proto_tree *tree) +{ + conversation_t *conversation; + tvbuff_t *tvb; - conversation_t *conversation = find_conversation(src, dst, ptype, src_port, dst_port); + conversation = find_conversation(src, dst, ptype, src_port, dst_port); + if (conversation != NULL) { + if (conversation->is_old_dissector) { + if (conversation->dissector.old == NULL) + return FALSE; + (*conversation->dissector.old)(pd, offset, fd, tree); + } else { + if (conversation->dissector.new == NULL) + return FALSE; - if ( conversation) - return conversation->dissector; - - return NULL; + /* + * Old dissector calling new dissector; use + * "tvb_create_from_top()" to remap. + * + * XXX - what about the "pd" argument? Do + * any dissectors not just pass that along and + * let the "offset" argument handle stepping + * through the packet? + */ + tvb = tvb_create_from_top(offset); + (*conversation->dissector.new)(tvb, &pi, tree); + } + return TRUE; + } + return FALSE; +} + +gboolean +try_conversation_dissector(address *src, address *dst, port_type ptype, + guint32 src_port, guint32 dst_port, tvbuff_t *tvb, packet_info *pinfo, + proto_tree *tree) +{ + conversation_t *conversation; + const guint8 *pd; + int offset; + + conversation = find_conversation(src, dst, ptype, src_port, dst_port); + if (conversation != NULL) { + if (conversation->is_old_dissector) { + /* + * New dissector calling old dissector; use + * "tvb_compat()" to remap. + */ + tvb_compat(tvb, &pd, &offset); + (*conversation->dissector.old)(pd, offset, pinfo->fd, + tree); + } else + (*conversation->dissector.new)(tvb, pinfo, tree); + return TRUE; + } + return FALSE; } diff --git a/conversation.h b/conversation.h index 68acad1833..635e7ec903 100644 --- a/conversation.h +++ b/conversation.h @@ -1,7 +1,7 @@ /* conversation.h * Routines for building lists of packets that are part of a "conversation" * - * $Id: conversation.h,v 1.5 2000/04/12 22:53:14 guy Exp $ + * $Id: conversation.h,v 1.6 2000/08/07 03:20:20 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -34,8 +34,11 @@ typedef struct conversation { struct conversation *next; /* pointer to next conversation on hash chain */ guint32 index; /* unique ID for conversation */ void *data; /* data our client can associate with a conversation */ - dissector_t dissector; /* protocol dissector client can associate with conversation */ - + gboolean is_old_dissector; /* XXX - nuke when everybody tvbuffified */ + union { + old_dissector_t old; + dissector_t new; + } dissector; /* protocol dissector client can associate with conversation */ } conversation_t; extern void conversation_init(void); @@ -44,7 +47,13 @@ conversation_t *conversation_new(address *src, address *dst, port_type ptype, conversation_t *find_conversation(address *src, address *dst, port_type ptype, guint32 src_port, guint32 dst_port); -dissector_t find_conversation_dissector(address *src, address *dst, port_type ptype, - guint32 src_port, guint32 dst_port); +gboolean +old_try_conversation_dissector(address *src, address *dst, port_type ptype, + guint32 src_port, guint32 dst_port, const u_char *pd, int offset, + frame_data *fd, proto_tree *tree); +gboolean +try_conversation_dissector(address *src, address *dst, port_type ptype, + guint32 src_port, guint32 dst_port, tvbuff_t *tvb, packet_info *pinfo, + proto_tree *tree); #endif /* conversation.h */ diff --git a/packet-aarp.c b/packet-aarp.c index a4c0c43811..dcb2736c6a 100644 --- a/packet-aarp.c +++ b/packet-aarp.c @@ -1,7 +1,7 @@ /* packet-aarp.c * Routines for Appletalk ARP packet disassembly * - * $Id: packet-aarp.c,v 1.20 2000/05/31 05:06:48 guy Exp $ + * $Id: packet-aarp.c,v 1.21 2000/08/07 03:20:20 guy Exp $ * * Simon Wilkinson * @@ -140,7 +140,7 @@ dissect_aarp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { gchar *sha_str, *spa_str, *tha_str, *tpa_str; if (!BYTES_ARE_IN_FRAME(offset, MIN_AARP_HEADER_SIZE)) { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return; } @@ -152,7 +152,7 @@ dissect_aarp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (!BYTES_ARE_IN_FRAME(offset, MIN_AARP_HEADER_SIZE + ar_hln*2 + ar_pln*2)) { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return; } @@ -287,5 +287,5 @@ proto_register_aarp(void) void proto_reg_handoff_aarp(void) { - dissector_add("ethertype", ETHERTYPE_AARP, dissect_aarp); + old_dissector_add("ethertype", ETHERTYPE_AARP, dissect_aarp); } diff --git a/packet-arp.c b/packet-arp.c index 4e05d1f5f0..e33874d68e 100644 --- a/packet-arp.c +++ b/packet-arp.c @@ -1,7 +1,7 @@ /* packet-arp.c * Routines for ARP packet disassembly * - * $Id: packet-arp.c,v 1.30 2000/05/31 05:06:50 guy Exp $ + * $Id: packet-arp.c,v 1.31 2000/08/07 03:20:21 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -388,7 +388,7 @@ dissect_atmarp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) gchar *tha_str, *tsa_str, *tpa_str; if (!BYTES_ARE_IN_FRAME(offset, MIN_ATMARP_HEADER_SIZE)) { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return; } @@ -409,7 +409,7 @@ dissect_atmarp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) tot_len = MIN_ATMARP_HEADER_SIZE + ar_shtl + ar_ssl + ar_spln + ar_thtl + ar_tsl + ar_tpln; if (!BYTES_ARE_IN_FRAME(offset, tot_len)) { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return; } @@ -564,7 +564,7 @@ dissect_arp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) gchar *sha_str, *spa_str, *tha_str, *tpa_str; if (!BYTES_ARE_IN_FRAME(offset, MIN_ARP_HEADER_SIZE)) { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return; } @@ -580,7 +580,7 @@ dissect_arp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) tot_len = MIN_ARP_HEADER_SIZE + ar_hln*2 + ar_pln*2; if (!BYTES_ARE_IN_FRAME(offset, tot_len)) { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return; } @@ -796,6 +796,6 @@ proto_register_arp(void) void proto_reg_handoff_arp(void) { - dissector_add("ethertype", ETHERTYPE_ARP, dissect_arp); - dissector_add("ethertype", ETHERTYPE_REVARP, dissect_arp); + old_dissector_add("ethertype", ETHERTYPE_ARP, dissect_arp); + old_dissector_add("ethertype", ETHERTYPE_REVARP, dissect_arp); } diff --git a/packet-atalk.c b/packet-atalk.c index 56b1b6ccdb..a9f85b3572 100644 --- a/packet-atalk.c +++ b/packet-atalk.c @@ -1,7 +1,7 @@ /* packet-atalk.c * Routines for Appletalk packet disassembly (DDP, currently). * - * $Id: packet-atalk.c,v 1.38 2000/05/31 05:06:51 guy Exp $ + * $Id: packet-atalk.c,v 1.39 2000/08/07 03:20:22 guy Exp $ * * Simon Wilkinson * @@ -148,13 +148,13 @@ int dissect_pascal_string(const u_char *pd, int offset, frame_data *fd, int len; if ( ! BYTES_ARE_IN_FRAME(offset,1) ) { - dissect_data(pd,offset,fd,tree); + old_dissect_data(pd,offset,fd,tree); return END_OF_FRAME; } len = pd[offset]; if ( ! BYTES_ARE_IN_FRAME(offset,len) ) { - dissect_data(pd,offset,fd,tree); + old_dissect_data(pd,offset,fd,tree); return END_OF_FRAME; } offset++; @@ -183,7 +183,7 @@ int dissect_pascal_string(const u_char *pd, int offset, frame_data *fd, static void dissect_rtmp_request(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return; } @@ -197,7 +197,7 @@ dissect_rtmp_data(const u_char *pd, int offset, frame_data *fd, proto_tree *tree int i; if (!BYTES_ARE_IN_FRAME(offset, 3)) { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return; } @@ -236,7 +236,7 @@ dissect_rtmp_data(const u_char *pd, int offset, frame_data *fd, proto_tree *tree if ( ! BYTES_ARE_IN_FRAME(offset, 3) ) { - dissect_data(pd,offset,fd,rtmp_tree); + old_dissect_data(pd,offset,fd,rtmp_tree); return; } @@ -257,7 +257,7 @@ dissect_rtmp_data(const u_char *pd, int offset, frame_data *fd, proto_tree *tree { if ( ! BYTES_ARE_IN_FRAME(offset+3, 3) ) { - dissect_data(pd,offset,fd,rtmp_tree); + old_dissect_data(pd,offset,fd,rtmp_tree); return; } @@ -293,7 +293,7 @@ dissect_nbp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { int i; if (!BYTES_ARE_IN_FRAME(offset, 2)) { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return; } @@ -328,7 +328,7 @@ dissect_nbp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { int soffset = offset; if ( !BYTES_ARE_IN_FRAME(offset, 6) ) { - dissect_data(pd,offset,fd,nbp_tree); + old_dissect_data(pd,offset,fd,nbp_tree); return; } @@ -371,7 +371,7 @@ dissect_ddp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { static struct atalk_ddp_addr src, dst; if (!BYTES_ARE_IN_FRAME(offset, DDP_HEADER_SIZE)) { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return; } @@ -416,8 +416,8 @@ dissect_ddp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { offset += DDP_HEADER_SIZE; - if (!dissector_try_port(ddp_dissector_table, ddp.type, pd, offset, fd, tree)) - dissect_data(pd, offset, fd, tree); + if (!old_dissector_try_port(ddp_dissector_table, ddp.type, pd, offset, fd, tree)) + old_dissect_data(pd, offset, fd, tree); } void @@ -548,9 +548,9 @@ proto_register_atalk(void) void proto_reg_handoff_atalk(void) { - dissector_add("ethertype", ETHERTYPE_ATALK, dissect_ddp); - dissector_add("ppp.protocol", PPP_AT, dissect_ddp); - dissector_add("ddp.type", DDP_NBP, dissect_nbp); - dissector_add("ddp.type", DDP_RTMPREQ, dissect_rtmp_request); - dissector_add("ddp.type", DDP_RTMPDATA, dissect_rtmp_data); + old_dissector_add("ethertype", ETHERTYPE_ATALK, dissect_ddp); + old_dissector_add("ppp.protocol", PPP_AT, dissect_ddp); + old_dissector_add("ddp.type", DDP_NBP, dissect_nbp); + old_dissector_add("ddp.type", DDP_RTMPREQ, dissect_rtmp_request); + old_dissector_add("ddp.type", DDP_RTMPDATA, dissect_rtmp_data); } diff --git a/packet-atm.c b/packet-atm.c index 53d94ee77a..c213327f01 100644 --- a/packet-atm.c +++ b/packet-atm.c @@ -1,7 +1,7 @@ /* packet-atm.c * Routines for ATM packet disassembly * - * $Id: packet-atm.c,v 1.22 2000/05/31 05:06:52 guy Exp $ + * $Id: packet-atm.c,v 1.23 2000/08/07 03:20:22 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -413,7 +413,7 @@ dissect_lane(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) default: /* Dump it as raw data. */ next_tvb = tvb_new_subset(tvb, 0, -1, -1); - dissect_data_tvb(next_tvb, pinfo, tree); + dissect_data(next_tvb, pinfo, tree); break; } } @@ -743,7 +743,7 @@ dissect_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) default: if (tree) { /* Dump it as raw data. */ - dissect_data_tvb(tvb, pinfo, tree); + dissect_data(tvb, pinfo, tree); break; } } @@ -752,7 +752,7 @@ dissect_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) default: if (tree) { /* Dump it as raw data. (Is this a single cell?) */ - dissect_data_tvb(tvb, pinfo, tree); + dissect_data(tvb, pinfo, tree); } break; } diff --git a/packet-auto_rp.c b/packet-auto_rp.c index dee0db1ec4..dfc069b2b3 100644 --- a/packet-auto_rp.c +++ b/packet-auto_rp.c @@ -4,7 +4,7 @@ * * Heikki Vatiainen * - * $Id: packet-auto_rp.c,v 1.6 2000/05/31 05:06:53 guy Exp $ + * $Id: packet-auto_rp.c,v 1.7 2000/08/07 03:20:23 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -147,7 +147,7 @@ static void dissect_auto_rp(const u_char *pd, int offset, frame_data *fd, proto_ int i; if (short_hdr) { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return; } @@ -182,7 +182,7 @@ static void dissect_auto_rp(const u_char *pd, int offset, frame_data *fd, proto_ } if (END_OF_FRAME > 0) - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } return; @@ -244,7 +244,7 @@ void proto_register_auto_rp(void) void proto_reg_handoff_auto_rp(void) { - dissector_add("udp.port", UDP_PORT_PIM_RP_DISC, dissect_auto_rp); + old_dissector_add("udp.port", UDP_PORT_PIM_RP_DISC, dissect_auto_rp); } /* diff --git a/packet-bgp.c b/packet-bgp.c index e7c6438afb..f4e548f6d9 100644 --- a/packet-bgp.c +++ b/packet-bgp.c @@ -2,7 +2,7 @@ * Routines for BGP packet dissection. * Copyright 1999, Jun-ichiro itojun Hagino * - * $Id: packet-bgp.c,v 1.23 2000/05/11 08:14:59 gram Exp $ + * $Id: packet-bgp.c,v 1.24 2000/08/07 03:20:23 guy Exp $ * * Supports: * RFC1771 A Border Gateway Protocol 4 (BGP-4) @@ -1303,5 +1303,5 @@ proto_register_bgp(void) void proto_reg_handoff_bgp(void) { - dissector_add("tcp.port", TCP_PORT_BGP, dissect_bgp); + old_dissector_add("tcp.port", TCP_PORT_BGP, dissect_bgp); } diff --git a/packet-bootp.c b/packet-bootp.c index 9e8ab5977d..87d140ab97 100644 --- a/packet-bootp.c +++ b/packet-bootp.c @@ -2,7 +2,7 @@ * Routines for BOOTP/DHCP packet disassembly * Gilbert Ramirez * - * $Id: packet-bootp.c,v 1.37 2000/07/25 21:25:59 guy Exp $ + * $Id: packet-bootp.c,v 1.38 2000/08/07 03:20:24 guy Exp $ * * The information used comes from: * RFC 951: Bootstrap Protocol @@ -834,5 +834,5 @@ proto_register_bootp(void) void proto_reg_handoff_bootp(void) { - dissector_add("udp.port", UDP_PORT_BOOTPS, dissect_bootp); + old_dissector_add("udp.port", UDP_PORT_BOOTPS, dissect_bootp); } diff --git a/packet-bpdu.c b/packet-bpdu.c index 316238646e..8256ba737a 100644 --- a/packet-bpdu.c +++ b/packet-bpdu.c @@ -1,7 +1,7 @@ /* packet-bpdu.c * Routines for BPDU (Spanning Tree Protocol) disassembly * - * $Id: packet-bpdu.c,v 1.11 2000/05/31 05:06:56 guy Exp $ + * $Id: packet-bpdu.c,v 1.12 2000/08/07 03:20:25 guy Exp $ * * Copyright 1999 Christophe Tronche * @@ -146,7 +146,7 @@ void dissect_bpdu(const u_char *pd, int offset, frame_data *fd, proto_tree *tree bpdu_type == 0x80 ? "Topology Change Notification" : "Unknown"); if (bpdu_type != 0) { - dissect_data(pd, offset + BPDU_TYPE + 1, fd, tree); + old_dissect_data(pd, offset + BPDU_TYPE + 1, fd, tree); return; } @@ -267,5 +267,5 @@ proto_register_bpdu(void) void proto_reg_handoff_bpdu(void) { - dissector_add("llc.dsap", SAP_BPDU, dissect_bpdu); + old_dissector_add("llc.dsap", SAP_BPDU, dissect_bpdu); } diff --git a/packet-cdp.c b/packet-cdp.c index d56d038731..1fd7bc59b0 100644 --- a/packet-cdp.c +++ b/packet-cdp.c @@ -2,7 +2,7 @@ * Routines for the disassembly of the "Cisco Discovery Protocol" * (c) Copyright Hannes R. Boehm * - * $Id: packet-cdp.c,v 1.23 2000/05/31 05:06:56 guy Exp $ + * $Id: packet-cdp.c,v 1.24 2000/08/07 03:20:25 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -270,7 +270,7 @@ dissect_cdp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) offset+=length; } } - dissect_data(pd, offset, fd, cdp_tree); + old_dissect_data(pd, offset, fd, cdp_tree); } } diff --git a/packet-clnp.c b/packet-clnp.c index ed5aa0a82b..c302241269 100644 --- a/packet-clnp.c +++ b/packet-clnp.c @@ -1,7 +1,7 @@ /* packet-clnp.c * Routines for ISO/OSI network and transport protocol packet disassembly * - * $Id: packet-clnp.c,v 1.11 2000/08/06 15:54:42 deniel Exp $ + * $Id: packet-clnp.c,v 1.12 2000/08/07 03:20:26 guy Exp $ * Laurent Deniel * Ralf Schneider * @@ -691,7 +691,7 @@ static int osi_decode_DR(const u_char *pd, int offset, } offset += li + 1; - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return pi.captured_len; /* we dissected all of the containing PDU */ @@ -816,16 +816,16 @@ static gboolean osi_decode_DT(const u_char *pd, int offset, offset += li; if (uses_inactive_subset){ - if (dissector_try_heuristic(cotp_is_heur_subdissector_list, pd, offset, + if (old_dissector_try_heuristic(cotp_is_heur_subdissector_list, pd, offset, fd, tree)) { return TRUE; } /* Fill in other Dissectors using inactive subset here */ - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return FALSE; } else { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return FALSE; } } /* osi_decode_DT */ @@ -925,7 +925,7 @@ static int osi_decode_ED(const u_char *pd, int offset, osi_decode_tp_var_part(pd, offset, li, 4, cotp_tree); offset += li; - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return pi.captured_len; /* we dissected all of the containing PDU */ @@ -1049,7 +1049,7 @@ static int osi_decode_CC(const u_char *pd, int offset, osi_decode_tp_var_part(pd, offset, li, class_option, cotp_tree); offset += li; - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return pi.captured_len; /* we dissected all of the containing PDU */ @@ -1392,7 +1392,7 @@ static gboolean osi_decode_UD(const u_char *pd, int offset, osi_decode_tp_var_part(pd, offset, li, 0, cltp_tree); offset += li; - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return FALSE; } /* osi_decode_UD */ @@ -1428,14 +1428,14 @@ static gboolean dissect_ositp_internal(const u_char *pd, int offset, if (check_col(fd, COL_INFO)) col_append_str(fd, COL_INFO, "Length indicator is zero"); if (!first_tpdu) - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return found_ositp; } if (!BYTES_ARE_IN_FRAME(offset, P_LI + li + 1)) { if (check_col(fd, COL_INFO)) col_append_str(fd, COL_INFO, "Captured data in frame doesn't include entire frame"); if (!first_tpdu) - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return found_ositp; } @@ -1489,7 +1489,7 @@ static gboolean dissect_ositp_internal(const u_char *pd, int offset, if (new_offset == -1) { /* incorrect TPDU */ if (!first_tpdu) - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); break; } @@ -1511,7 +1511,7 @@ void dissect_ositp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (!dissect_ositp_internal(pd, offset, fd, tree, FALSE)) - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } @@ -1555,13 +1555,13 @@ static void dissect_clnp(const u_char *pd, int offset, frame_data *fd, } if (!BYTES_ARE_IN_FRAME(offset, sizeof(clnp))) { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return; } /* return if version not known */ if (clnp.cnf_vers != ISO8473_V1) { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return; } @@ -1611,7 +1611,7 @@ static void dissect_clnp(const u_char *pd, int offset, frame_data *fd, if (!BYTES_ARE_IN_FRAME(offset, clnp.cnf_hdr_len)) { if (check_col(fd, COL_INFO)) col_add_fstr(fd, COL_INFO, "%s NPDU %s", pdu_type_string, flag_string); - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return; } @@ -1709,7 +1709,7 @@ static void dissect_clnp(const u_char *pd, int offset, frame_data *fd, if (check_col(fd, COL_INFO)) col_add_fstr(fd, COL_INFO, "Fragmented %s NPDU %s(off=%u)", pdu_type_string, flag_string, segment_offset); - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return; } @@ -1744,7 +1744,7 @@ static void dissect_clnp(const u_char *pd, int offset, frame_data *fd, } if (check_col(fd, COL_INFO)) col_add_fstr(fd, COL_INFO, "%s NPDU %s", pdu_type_string, flag_string); - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } /* dissect_clnp */ @@ -1844,6 +1844,6 @@ void proto_register_cltp(void) void proto_reg_handoff_clnp(void) { - dissector_add("osinl", NLPID_ISO8473_CLNP, dissect_clnp); - dissector_add("osinl", NLPID_NULL, dissect_clnp); /* Inactive subset */ + old_dissector_add("osinl", NLPID_ISO8473_CLNP, dissect_clnp); + old_dissector_add("osinl", NLPID_NULL, dissect_clnp); /* Inactive subset */ } diff --git a/packet-cops.c b/packet-cops.c index 693959d10c..e10d5dc337 100644 --- a/packet-cops.c +++ b/packet-cops.c @@ -4,7 +4,7 @@ * * Copyright 2000, Heikki Vatiainen * - * $Id: packet-cops.c,v 1.2 2000/06/15 03:48:39 gram Exp $ + * $Id: packet-cops.c,v 1.3 2000/08/07 03:20:27 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -147,17 +147,9 @@ static gint ett_cops_obj = -1; static int dissect_cops_object(tvbuff_t *tvb, guint32 offset, proto_tree *tree); /* Code to actually dissect the packets */ -#if 0 static void dissect_cops(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { guint8 op_code; -#else -static void dissect_cops(const u_char *pd, int o, frame_data *fd, proto_tree *tree) -{ - packet_info *pinfo = π - tvbuff_t *tvb = tvb_create_from_top(o); - guint8 op_code; -#endif pinfo->current_proto = "COPS"; if (check_col(pinfo->fd, COL_PROTOCOL)) @@ -331,4 +323,3 @@ proto_reg_handoff_cops(void) { dissector_add("tcp.port", TCP_PORT_COPS, dissect_cops); } - diff --git a/packet-data.c b/packet-data.c index f7563fd383..fcdbb956e5 100644 --- a/packet-data.c +++ b/packet-data.c @@ -2,7 +2,7 @@ * Routines for raw data (default case) * Gilbert Ramirez * - * $Id: packet-data.c,v 1.18 2000/05/12 06:23:33 gram Exp $ + * $Id: packet-data.c,v 1.19 2000/08/07 03:20:27 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -40,8 +40,9 @@ */ 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, @@ -50,9 +51,8 @@ dissect_data(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) } } -/* 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, packet_info *pinfo, proto_tree *tree) { int bytes; diff --git a/packet-ddtp.c b/packet-ddtp.c index ff73f6c3c4..5f8c3efd54 100644 --- a/packet-ddtp.c +++ b/packet-ddtp.c @@ -3,7 +3,7 @@ * see http://ddt.sourceforge.net/ * Olivier Abad * - * $Id: packet-ddtp.c,v 1.8 2000/06/15 03:48:40 gram Exp $ + * $Id: packet-ddtp.c,v 1.9 2000/08/07 03:20:27 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -97,21 +97,11 @@ static const value_string vals_ddtp_status[] = { { 0, NULL} }; -#if 0 static void dissect_ddtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_tree *ddtp_tree; proto_item *ti; -#else -static void -dissect_ddtp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) -{ - proto_tree *ddtp_tree; - proto_item *ti; - packet_info *pinfo = π - tvbuff_t *tvb = tvb_create_from_top(offset); -#endif pinfo->current_proto = "DDTP"; if (check_col(pinfo->fd, COL_PROTOCOL)) { @@ -120,14 +110,9 @@ dissect_ddtp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) } if (tree) { ti = proto_tree_add_item(tree, proto_ddtp, tvb, 0, - END_OF_FRAME - offset, FALSE); + tvb_length(tvb), FALSE); ddtp_tree = proto_item_add_subtree(ti, ett_ddtp); - if (!BYTES_ARE_IN_FRAME(offset, 4)) { - proto_tree_add_text(ddtp_tree, NullTVB, offset, tvb_length(tvb), - "Frame too short"); - return; - } proto_tree_add_item(ddtp_tree, hf_ddtp_version, tvb, 0, 4, FALSE); proto_tree_add_item(ddtp_tree, hf_ddtp_encrypt, tvb, 4, 4, FALSE); proto_tree_add_item(ddtp_tree, hf_ddtp_hostid, tvb, 8, 4, FALSE); diff --git a/packet-diameter.c b/packet-diameter.c index 3af11f8262..49937fa026 100644 --- a/packet-diameter.c +++ b/packet-diameter.c @@ -1,7 +1,7 @@ /* packet-diameter.c * Routines for DIAMETER packet disassembly * - * $Id: packet-diameter.c,v 1.3 2000/08/03 09:30:32 gram Exp $ + * $Id: packet-diameter.c,v 1.4 2000/08/07 03:20:28 guy Exp $ * * Copyright (c) 2000 by David Frascone * @@ -725,11 +725,11 @@ proto_reg_handoff_diameter(void) static int SctpPort=0; #endif if (Initialized) { - dissector_delete("udp.port", UdpPort, dissect_diameter); - dissector_delete("tcp.port", TcpPort, dissect_diameter); + old_dissector_delete("udp.port", UdpPort, dissect_diameter); + old_dissector_delete("tcp.port", TcpPort, dissect_diameter); #ifdef SCTP_DISSECTORS_ENABLED - dissector_delete("sctp.srcport", SctpPort, dissect_diameter); - dissector_delete("sctp.destport", SctpPort, dissect_diameter); + old_dissector_delete("sctp.srcport", SctpPort, dissect_diameter); + old_dissector_delete("sctp.destport", SctpPort, dissect_diameter); #endif } else { Initialized=TRUE; @@ -744,10 +744,10 @@ proto_reg_handoff_diameter(void) strcpy(gbl_diameterString, "Diameter Protocol"); - dissector_add("udp.port", gbl_diameterUdpPort, dissect_diameter); - dissector_add("tcp.port", gbl_diameterTcpPort, dissect_diameter); + old_dissector_add("udp.port", gbl_diameterUdpPort, dissect_diameter); + old_dissector_add("tcp.port", gbl_diameterTcpPort, dissect_diameter); #ifdef SCTP_DISSECTORS_ENABLED - dissector_add("sctp.srcport", gbl_diameterSctpPort, dissect_diameter); - dissector_add("sctp.destport", gbl_diameterSctpPort, dissect_diameter); + old_dissector_add("sctp.srcport", gbl_diameterSctpPort, dissect_diameter); + old_dissector_add("sctp.destport", gbl_diameterSctpPort, dissect_diameter); #endif } diff --git a/packet-dns.c b/packet-dns.c index dd91c1bf16..ef78dce462 100644 --- a/packet-dns.c +++ b/packet-dns.c @@ -1,7 +1,7 @@ /* packet-dns.c * Routines for DNS packet disassembly * - * $Id: packet-dns.c,v 1.48 2000/07/21 01:40:41 guy Exp $ + * $Id: packet-dns.c,v 1.49 2000/08/07 03:20:28 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -1721,7 +1721,7 @@ dissect_dns(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (pi.captured_len < DNS_HDRLEN) { col_add_str(fd, COL_INFO, "Short DNS packet"); - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return; } @@ -1922,5 +1922,5 @@ proto_register_dns(void) void proto_reg_handoff_dns(void) { - dissector_add("udp.port", UDP_PORT_DNS, dissect_dns); + old_dissector_add("udp.port", UDP_PORT_DNS, dissect_dns); } diff --git a/packet-eigrp.c b/packet-eigrp.c index 23b49b3fd8..aa460534a3 100644 --- a/packet-eigrp.c +++ b/packet-eigrp.c @@ -1,6 +1,6 @@ /* packet-eigrp.c * - * $Id: packet-eigrp.c,v 1.4 2000/05/31 05:07:02 guy Exp $ + * $Id: packet-eigrp.c,v 1.5 2000/08/07 03:20:29 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -131,7 +131,7 @@ proto_register_eigrp(void) void proto_reg_handoff_eigrp(void) { - dissector_add("ip.proto", IP_PROTO_EIGRP, dissect_eigrp); - dissector_add("ddp.type", DDP_EIGRP, dissect_eigrp); - dissector_add("ipx.socket", IPX_SOCKET_EIGRP, dissect_eigrp); + old_dissector_add("ip.proto", IP_PROTO_EIGRP, dissect_eigrp); + old_dissector_add("ddp.type", DDP_EIGRP, dissect_eigrp); + old_dissector_add("ipx.socket", IPX_SOCKET_EIGRP, dissect_eigrp); } diff --git a/packet-esis.c b/packet-esis.c index 90f562663f..aac7aa3291 100644 --- a/packet-esis.c +++ b/packet-esis.c @@ -2,7 +2,7 @@ * Routines for ISO/OSI End System to Intermediate System * Routeing Exchange Protocol ISO 9542. * - * $Id: packet-esis.c,v 1.4 2000/05/31 05:07:02 guy Exp $ + * $Id: packet-esis.c,v 1.5 2000/08/07 03:20:31 guy Exp $ * Ralf Schneider * * Ethereal - Network traffic analyzer @@ -440,5 +440,5 @@ proto_register_esis(void) { void proto_reg_handoff_esis(void) { - dissector_add("osinl", NLPID_ISO9542_ESIS, dissect_esis); + old_dissector_add("osinl", NLPID_ISO9542_ESIS, dissect_esis); } diff --git a/packet-eth.c b/packet-eth.c index 65ce8b3c1b..4f5ff0995a 100644 --- a/packet-eth.c +++ b/packet-eth.c @@ -1,7 +1,7 @@ /* packet-eth.c * Routines for ethernet packet disassembly * - * $Id: packet-eth.c,v 1.42 2000/05/31 05:07:03 guy Exp $ + * $Id: packet-eth.c,v 1.43 2000/08/07 03:20:32 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -170,10 +170,10 @@ dissect_eth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) src = tvb_get_ptr(tvb, 6, 6); dst = tvb_get_ptr(tvb, 0, 6); - SET_ADDRESS(&pi.dl_src, AT_ETHER, 6, src); - SET_ADDRESS(&pi.src, AT_ETHER, 6, src); - SET_ADDRESS(&pi.dl_dst, AT_ETHER, 6, dst); - SET_ADDRESS(&pi.dst, AT_ETHER, 6, dst); + SET_ADDRESS(&pinfo->dl_src, AT_ETHER, 6, src); + SET_ADDRESS(&pinfo->src, AT_ETHER, 6, src); + SET_ADDRESS(&pinfo->dl_dst, AT_ETHER, 6, dst); + SET_ADDRESS(&pinfo->dst, AT_ETHER, 6, dst); etype = tvb_get_ntohs(tvb, 12); @@ -280,10 +280,10 @@ dissect_eth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) switch (ethhdr_type) { case ETHERNET_802_3: - dissect_ipx(pd, eth_offset, pinfo->fd, tree); + dissect_ipx(next_tvb, pinfo, tree); break; case ETHERNET_802_2: - dissect_llc(next_tvb, &pi, tree); + dissect_llc(next_tvb, pinfo, tree); break; case ETHERNET_II: ethertype(etype, tvb, ETH_HEADER_SIZE, pinfo, tree, fh_tree, hf_eth_type); diff --git a/packet-ethertype.c b/packet-ethertype.c index b7003027ce..f5378954a7 100644 --- a/packet-ethertype.c +++ b/packet-ethertype.c @@ -1,7 +1,7 @@ /* ethertype.c * Routines for calling the right protocol for the ethertype. * - * $Id: packet-ethertype.c,v 1.5 2000/05/31 05:07:03 guy Exp $ + * $Id: packet-ethertype.c,v 1.6 2000/08/07 03:20:33 guy Exp $ * * Gilbert Ramirez * @@ -89,11 +89,8 @@ void ethertype(guint16 etype, tvbuff_t *tvb, int offset_after_etype, packet_info *pinfo, proto_tree *tree, proto_tree *fh_tree, int item_id) { - dissector_t sub_dissector; char *description; tvbuff_t *next_tvb; - const guint8 *next_pd; - int next_offset; /* Add to proto_tree */ if (tree) { @@ -101,31 +98,27 @@ ethertype(guint16 etype, tvbuff_t *tvb, int offset_after_etype, packet_info *pin } next_tvb = tvb_new_subset(tvb, offset_after_etype, -1, -1); - tvb_compat(next_tvb, &next_pd, &next_offset); /* Look for sub-dissector */ - sub_dissector = dissector_lookup( ethertype_dissector_table, etype ); - - if (sub_dissector) { - /* Call sub-dissector */ - sub_dissector(next_pd, next_offset, pinfo->fd, tree); - } - else { - /* Label rest of packet as "Data" */ - dissect_data_tvb(next_tvb, pinfo, tree); + if (!dissector_try_port(ethertype_dissector_table, etype, + next_tvb, pinfo, tree)) { + /* No sub-dissector found. + Label rest of packet as "Data" */ + dissect_data(next_tvb, pinfo, tree); /* Label protocol */ switch(etype) { - case ETHERTYPE_LOOP: - if (check_col(pinfo->fd, COL_PROTOCOL)) { - col_add_fstr(pinfo->fd, COL_PROTOCOL, "LOOP"); - } - break; - default: - if (check_col(pinfo->fd, COL_PROTOCOL)) { - col_add_fstr(pinfo->fd, COL_PROTOCOL, "0x%04x", etype); - } - break; + + case ETHERTYPE_LOOP: + if (check_col(pinfo->fd, COL_PROTOCOL)) { + col_add_fstr(pinfo->fd, COL_PROTOCOL, "LOOP"); + } + break; + default: + if (check_col(pinfo->fd, COL_PROTOCOL)) { + col_add_fstr(pinfo->fd, COL_PROTOCOL, "0x%04x", etype); + } + break; } if (check_col(pinfo->fd, COL_INFO)) { description = match_strval(etype, etype_vals); diff --git a/packet-fddi.c b/packet-fddi.c index 09fbdcd026..90828623e5 100644 --- a/packet-fddi.c +++ b/packet-fddi.c @@ -3,7 +3,7 @@ * * Laurent Deniel * - * $Id: packet-fddi.c,v 1.36 2000/05/31 05:07:03 guy Exp $ + * $Id: packet-fddi.c,v 1.37 2000/08/07 03:20:33 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -350,7 +350,7 @@ dissect_fddi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, return; default : - dissect_data_tvb(next_tvb, pinfo, tree); + dissect_data(next_tvb, pinfo, tree); return; } /* fc */ diff --git a/packet-ftp.c b/packet-ftp.c index 8f436d8db7..aff4f1dbd1 100644 --- a/packet-ftp.c +++ b/packet-ftp.c @@ -2,7 +2,7 @@ * Routines for ftp packet dissection * Copyright 1999, Richard Sharpe * - * $Id: packet-ftp.c,v 1.16 2000/05/31 05:07:04 guy Exp $ + * $Id: packet-ftp.c,v 1.17 2000/08/07 03:20:34 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -203,7 +203,7 @@ proto_register_ftp(void) void proto_reg_handoff_ftp(void) { - dissector_add("tcp.port", TCP_PORT_FTPDATA, &dissect_ftpdata); - dissector_add("tcp.port", TCP_PORT_FTP, &dissect_ftp); + old_dissector_add("tcp.port", TCP_PORT_FTPDATA, &dissect_ftpdata); + old_dissector_add("tcp.port", TCP_PORT_FTP, &dissect_ftp); } diff --git a/packet-giop.c b/packet-giop.c index abf9d284d7..d56f4b4bfe 100644 --- a/packet-giop.c +++ b/packet-giop.c @@ -3,7 +3,7 @@ * * Laurent Deniel * - * $Id: packet-giop.c,v 1.15 2000/07/27 17:11:44 gram Exp $ + * $Id: packet-giop.c,v 1.16 2000/08/07 03:20:34 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -256,7 +256,7 @@ dissect_giop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) "Version %d.%d not supported", header.GIOP_version.major, header.GIOP_version.minor); } - dissect_data(pd, offset + GIOP_HEADER_SIZE, fd, tree); + old_dissect_data(pd, offset + GIOP_HEADER_SIZE, fd, tree); return TRUE; } @@ -333,7 +333,7 @@ dissect_giop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) offset += GIOP_HEADER_SIZE; if (!BYTES_ARE_IN_FRAME(offset, message_size)) { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return TRUE; } @@ -458,7 +458,7 @@ dissect_giop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) pntohl(&pd[offset]) : pletohl(&pd[offset]); if (sequence_length > message_size) { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return TRUE; } @@ -527,7 +527,7 @@ dissect_giop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) pntohl(&pd[offset]) : pletohl(&pd[offset]); if (sequence_length > message_size) { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return TRUE; } @@ -566,7 +566,7 @@ dissect_giop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) pntohl(&pd[offset]) : pletohl(&pd[offset]); if (sequence_length > message_size) { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return TRUE; } @@ -586,7 +586,7 @@ dissect_giop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) pntohl(&pd[offset]) : pletohl(&pd[offset]); if (sequence_length > message_size) { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return TRUE; } @@ -720,7 +720,7 @@ dissect_giop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) offset = first_offset + GIOP_HEADER_SIZE + message_size; if (IS_DATA_IN_FRAME(offset)) { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } return TRUE; @@ -749,5 +749,5 @@ proto_register_giop(void) void proto_reg_handoff_giop(void) { - heur_dissector_add("tcp", dissect_giop); + old_heur_dissector_add("tcp", dissect_giop); } diff --git a/packet-gre.c b/packet-gre.c index fa8e86d1c3..e30bd9a65f 100644 --- a/packet-gre.c +++ b/packet-gre.c @@ -2,7 +2,7 @@ * Routines for the Generic Routing Encapsulation (GRE) protocol * Brad Robel-Forrest * - * $Id: packet-gre.c,v 1.23 2000/06/15 03:48:40 gram Exp $ + * $Id: packet-gre.c,v 1.24 2000/08/07 03:20:35 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -220,10 +220,12 @@ dissect_gre(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { dissect_ip(pd, offset, fd, tree); break; case GRE_IPX: - dissect_ipx(pd, offset, fd, tree); + next_tvb = tvb_create_from_top(offset); + dissect_ipx(next_tvb, &pi, tree); break; default: - dissect_data(pd, offset, fd, gre_tree); + next_tvb = tvb_create_from_top(offset); + dissect_data(next_tvb, &pi, gre_tree); break; } } @@ -299,5 +301,5 @@ proto_register_gre(void) void proto_reg_handoff_gre(void) { - dissector_add("ip.proto", IP_PROTO_GRE, dissect_gre); + old_dissector_add("ip.proto", IP_PROTO_GRE, dissect_gre); } diff --git a/packet-h1.c b/packet-h1.c index dc33a4b644..42534268a4 100644 --- a/packet-h1.c +++ b/packet-h1.c @@ -2,7 +2,7 @@ * Routines for Sinec H1 packet disassembly * Gerrit Gehnen * - * $Id: packet-h1.c,v 1.10 2000/07/21 07:51:34 guy Exp $ + * $Id: packet-h1.c,v 1.11 2000/08/07 03:20:35 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -99,15 +99,8 @@ static gint ett_org = -1; static gint ett_response = -1; static gint ett_empty = -1; -#if 0 static gboolean dissect_h1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { -#else -static gboolean dissect_h1(const u_char *pd, int o, frame_data *fd, proto_tree *tree) -{ - packet_info *pinfo = π - tvbuff_t *tvb = tvb_create_from_top(o); -#endif tvbuff_t *next_tvb; proto_tree *h1_tree = NULL; @@ -125,10 +118,10 @@ static gboolean dissect_h1(const u_char *pd, int o, frame_data *fd, proto_tree * return FALSE; } - if (check_col (fd, COL_PROTOCOL)) - col_add_str (fd, COL_PROTOCOL, "H1"); - if (check_col (fd, COL_INFO)) - col_add_str (fd, COL_INFO, "S5: "); + if (check_col (pinfo->fd, COL_PROTOCOL)) + col_add_str (pinfo->fd, COL_PROTOCOL, "H1"); + if (check_col (pinfo->fd, COL_INFO)) + col_add_str (pinfo->fd, COL_INFO, "S5: "); if (tree) { ti = proto_tree_add_item (tree, proto_h1, tvb, offset, 16, FALSE); @@ -158,9 +151,9 @@ static gboolean dissect_h1(const u_char *pd, int o, frame_data *fd, proto_tree * offset + position + 2, 1, tvb_get_guint8(tvb,offset + position + 2)); } - if (check_col (fd, COL_INFO)) + if (check_col (pinfo->fd, COL_INFO)) { - col_append_str (fd, COL_INFO, + col_append_str (pinfo->fd, COL_INFO, val_to_str (tvb_get_guint8(tvb,offset + position + 2), opcode_vals,"Unknown Opcode (0x%2.2x)")); } @@ -189,15 +182,15 @@ static gboolean dissect_h1(const u_char *pd, int o, frame_data *fd, proto_tree * offset + position + 6, 2, tvb_get_ntohs(tvb,offset+position+6)); } - if (check_col (fd, COL_INFO)) + if (check_col (pinfo->fd, COL_INFO)) { - col_append_fstr (fd, COL_INFO, " %s %d", + col_append_fstr (pinfo->fd, COL_INFO, " %s %d", val_to_str (tvb_get_guint8(tvb,offset + position + 2), org_vals,"Unknown Type (0x%2.2x)"), tvb_get_guint8(tvb,offset + position + 3)); - col_append_fstr (fd, COL_INFO, " DW %d", + col_append_fstr (pinfo->fd, COL_INFO, " DW %d", tvb_get_ntohs(tvb,offset+position+4)); - col_append_fstr (fd, COL_INFO, " Count %d", + col_append_fstr (pinfo->fd, COL_INFO, " Count %d", tvb_get_ntohs(tvb,offset+position+6)); } break; @@ -216,9 +209,9 @@ static gboolean dissect_h1(const u_char *pd, int o, frame_data *fd, proto_tree * offset + position + 2, 1, tvb_get_guint8(tvb,offset + position+2)); } - if (check_col (fd, COL_INFO)) + if (check_col (pinfo->fd, COL_INFO)) { - col_append_fstr (fd, COL_INFO, " %s", + col_append_fstr (pinfo->fd, COL_INFO, " %s", val_to_str (tvb_get_guint8(tvb,offset + position + 2), returncode_vals,"Unknown Returcode (0x%2.2x")); } @@ -246,7 +239,7 @@ static gboolean dissect_h1(const u_char *pd, int o, frame_data *fd, proto_tree * position += tvb_get_guint8(tvb,offset + position + 1); /* Goto next section */ } /* ..while */ next_tvb = tvb_new_subset(tvb, offset+tvb_get_guint8(tvb,offset+2), -1, -1); - dissect_data_tvb(next_tvb, pinfo, tree); + dissect_data(next_tvb, pinfo, tree); return TRUE; } diff --git a/packet-hsrp.c b/packet-hsrp.c index 8857c22862..b9cbd0c504 100644 --- a/packet-hsrp.c +++ b/packet-hsrp.c @@ -4,7 +4,7 @@ * * Heikki Vatiainen * - * $Id: packet-hsrp.c,v 1.5 2000/05/31 05:07:05 guy Exp $ + * $Id: packet-hsrp.c,v 1.6 2000/08/07 03:20:36 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -116,7 +116,7 @@ dissect_hsrp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) guint8 auth_buf[sizeof(hsrp.auth_data) + 1]; if (short_packet) { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return; } @@ -167,5 +167,5 @@ void proto_register_hsrp(void) void proto_reg_handoff_hsrp(void) { - dissector_add("udp.port", UDP_PORT_HSRP, dissect_hsrp); + old_dissector_add("udp.port", UDP_PORT_HSRP, dissect_hsrp); } diff --git a/packet-http.c b/packet-http.c index 886f15cf3a..5f487973ac 100644 --- a/packet-http.c +++ b/packet-http.c @@ -3,7 +3,7 @@ * * Guy Harris * - * $Id: packet-http.c,v 1.19 2000/05/31 05:07:06 guy Exp $ + * $Id: packet-http.c,v 1.20 2000/08/07 03:20:36 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -207,7 +207,7 @@ void dissect_http(const u_char *pd, int offset, frame_data *fd, proto_tree *tree if (is_ipp) dissect_ipp(pd, offset, fd, tree); else - dissect_data(&pd[offset], offset, fd, http_tree); + old_dissect_data(&pd[offset], offset, fd, http_tree); } } } @@ -294,8 +294,8 @@ proto_register_http(void) void proto_reg_handoff_http(void) { - dissector_add("tcp.port", TCP_PORT_HTTP, dissect_http); - dissector_add("tcp.port", TCP_ALT_PORT_HTTP, dissect_http); - dissector_add("tcp.port", TCP_PORT_PROXY_HTTP, dissect_http); - dissector_add("tcp.port", TCP_PORT_PROXY_ADMIN_HTTP, dissect_http); + old_dissector_add("tcp.port", TCP_PORT_HTTP, dissect_http); + old_dissector_add("tcp.port", TCP_ALT_PORT_HTTP, dissect_http); + old_dissector_add("tcp.port", TCP_PORT_PROXY_HTTP, dissect_http); + old_dissector_add("tcp.port", TCP_PORT_PROXY_ADMIN_HTTP, dissect_http); } diff --git a/packet-icmpv6.c b/packet-icmpv6.c index 85bc272b67..df92c5b88d 100644 --- a/packet-icmpv6.c +++ b/packet-icmpv6.c @@ -1,7 +1,7 @@ /* packet-icmpv6.c * Routines for ICMPv6 packet disassembly * - * $Id: packet-icmpv6.c,v 1.17 2000/05/31 05:07:06 guy Exp $ + * $Id: packet-icmpv6.c,v 1.18 2000/08/07 03:20:36 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -183,7 +183,7 @@ again: if ((pd[offset + 8] & 0xf0) == 0x60) dissect_ipv6(pd, offset + 8, fd, icmp6opt_tree); else - dissect_data(pd, offset + 8, fd, icmp6opt_tree); + old_dissect_data(pd, offset + 8, fd, icmp6opt_tree); break; case ND_OPT_MTU: { @@ -370,7 +370,7 @@ dissect_icmpv6(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if ((pd[offset + sizeof(*dp)] & 0xf0) == 0x60) { dissect_ipv6(pd, offset + sizeof(*dp), fd, icmp6_tree); } else { - dissect_data(pd, offset + sizeof(*dp), fd, icmp6_tree); + old_dissect_data(pd, offset + sizeof(*dp), fd, icmp6_tree); } break; case ICMP6_PACKET_TOO_BIG: @@ -381,7 +381,7 @@ dissect_icmpv6(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if ((pd[offset + sizeof(*dp)] & 0xf0) == 0x60) { dissect_ipv6(pd, offset + sizeof(*dp), fd, icmp6_tree); } else { - dissect_data(pd, offset + sizeof(*dp), fd, icmp6_tree); + old_dissect_data(pd, offset + sizeof(*dp), fd, icmp6_tree); } break; case ICMP6_PARAM_PROB: @@ -392,7 +392,7 @@ dissect_icmpv6(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if ((pd[offset + sizeof(*dp)] & 0xf0) == 0x60) { dissect_ipv6(pd, offset + sizeof(*dp), fd, icmp6_tree); } else { - dissect_data(pd, offset + sizeof(*dp), fd, icmp6_tree); + old_dissect_data(pd, offset + sizeof(*dp), fd, icmp6_tree); } break; case ICMP6_ECHO_REQUEST: @@ -403,7 +403,7 @@ dissect_icmpv6(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) proto_tree_add_text(icmp6_tree, NullTVB, offset + offsetof(struct icmp6_hdr, icmp6_seq), 2, "Sequence: 0x%04x", (guint16)ntohs(dp->icmp6_seq)); - dissect_data(pd, offset + sizeof(*dp), fd, icmp6_tree); + old_dissect_data(pd, offset + sizeof(*dp), fd, icmp6_tree); break; case ICMP6_MEMBERSHIP_QUERY: case ICMP6_MEMBERSHIP_REPORT: @@ -567,10 +567,10 @@ dissect_icmpv6(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) proto_tree_add_text(icmp6_tree, NullTVB, offset + offsetof(struct icmp6_router_renum, rr_segnum), 2, "Max delay: 0x%04x", pntohs(&rr->rr_maxdelay)); - dissect_data(pd, offset + sizeof(*rr), fd, tree); /*XXX*/ + old_dissect_data(pd, offset + sizeof(*rr), fd, tree); /*XXX*/ } default: - dissect_data(pd, offset + sizeof(*dp), fd, tree); + old_dissect_data(pd, offset + sizeof(*dp), fd, tree); break; } } @@ -605,6 +605,6 @@ proto_register_icmpv6(void) void proto_reg_handoff_icmpv6(void) { - dissector_add("ip.proto", IP_PROTO_ICMPV6, dissect_icmpv6); + old_dissector_add("ip.proto", IP_PROTO_ICMPV6, dissect_icmpv6); } diff --git a/packet-icp.c b/packet-icp.c index ae60c254f1..7041308d06 100644 --- a/packet-icp.c +++ b/packet-icp.c @@ -2,7 +2,7 @@ * Routines for ICP (internet cache protocol) packet disassembly * RFC 2186 && RFC 2187 * - * $Id: packet-icp.c,v 1.9 2000/08/06 07:22:33 guy Exp $ + * $Id: packet-icp.c,v 1.10 2000/08/07 03:20:38 guy Exp $ * * Ethereal - Network traffic analyzer * By Peter Torvals @@ -293,5 +293,5 @@ proto_register_icp(void) void proto_reg_handoff_icp(void) { - dissector_add("udp.port", UDP_PORT_ICP, dissect_icp); + old_dissector_add("udp.port", UDP_PORT_ICP, dissect_icp); } diff --git a/packet-icq.c b/packet-icq.c index a7b465adf6..412b80511e 100644 --- a/packet-icq.c +++ b/packet-icq.c @@ -1,7 +1,7 @@ /* packet-icq.c * Routines for ICQ packet disassembly * - * $Id: packet-icq.c,v 1.18 2000/08/06 07:22:33 guy Exp $ + * $Id: packet-icq.c,v 1.19 2000/08/07 03:20:38 guy Exp $ * * Ethereal - Network traffic analyzer * By Johan Feyaerts @@ -2488,5 +2488,5 @@ proto_register_icq(void) void proto_reg_handoff_icq(void) { - dissector_add("udp.port", UDP_PORT_ICQ, dissect_icq); + old_dissector_add("udp.port", UDP_PORT_ICQ, dissect_icq); } diff --git a/packet-imap.c b/packet-imap.c index b1809a9bdc..2dc6a51b38 100644 --- a/packet-imap.c +++ b/packet-imap.c @@ -2,7 +2,7 @@ * Routines for imap packet dissection * Copyright 1999, Richard Sharpe * - * $Id: packet-imap.c,v 1.7 2000/05/31 05:07:07 guy Exp $ + * $Id: packet-imap.c,v 1.8 2000/08/07 03:20:39 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -140,5 +140,5 @@ proto_register_imap(void) void proto_reg_handoff_imap(void) { - dissector_add("tcp.port", TCP_PORT_IMAP, dissect_imap); + old_dissector_add("tcp.port", TCP_PORT_IMAP, dissect_imap); } diff --git a/packet-ip.c b/packet-ip.c index aa2275bb95..e756c05f2f 100644 --- a/packet-ip.c +++ b/packet-ip.c @@ -1,7 +1,7 @@ /* packet-ip.c * Routines for IP and miscellaneous IP protocol packet disassembly * - * $Id: packet-ip.c,v 1.99 2000/08/05 05:24:01 guy Exp $ + * $Id: packet-ip.c,v 1.100 2000/08/07 03:20:40 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -58,8 +58,7 @@ #include "packet-ipsec.h" static void dissect_icmp(const u_char *, int, frame_data *, proto_tree *); -static void dissect_igmp(const u_char *, int, frame_data *, proto_tree *); - +static void dissect_igmp(tvbuff_t *, packet_info *, proto_tree *); /* Decode the old IPv4 TOS field as the DiffServ DS Field */ gboolean g_ip_dscp_actif = TRUE; @@ -835,7 +834,7 @@ dissect_ip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { /* To do: check for errs, etc. */ if (!BYTES_ARE_IN_FRAME(offset, IPH_MIN_LEN)) { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return; } @@ -951,18 +950,18 @@ dissect_ip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (check_col(fd, COL_INFO)) col_add_fstr(fd, COL_INFO, "Fragmented IP protocol (proto=%s 0x%02x, off=%u)", ipprotostr(iph.ip_p), iph.ip_p, (iph.ip_off & IP_OFFSET) * 8); - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return; } /* do lookup with the subdissector table */ - if (!dissector_try_port(ip_dissector_table, nxt, pd, offset, fd, tree)) { + if (!old_dissector_try_port(ip_dissector_table, nxt, pd, offset, fd, tree)) { /* Unknown protocol */ if (check_col(fd, COL_PROTOCOL)) col_add_str(fd, COL_PROTOCOL, "IP"); if (check_col(fd, COL_INFO)) col_add_fstr(fd, COL_INFO, "%s (0x%02x)", ipprotostr(iph.ip_p), iph.ip_p); - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } } @@ -1166,12 +1165,12 @@ dissect_icmp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { XXX - for now, just display it as data; not all dissection routines can handle a short packet without exploding. */ - dissect_data(pd, offset + 8, fd, icmp_tree); + old_dissect_data(pd, offset + 8, fd, icmp_tree); break; case ICMP_ECHOREPLY: case ICMP_ECHO: - dissect_data(pd, offset + 8, fd, icmp_tree); + old_dissect_data(pd, offset + 8, fd, icmp_tree); break; case ICMP_RTRADVERT: @@ -1184,7 +1183,7 @@ dissect_icmp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { "Preference level: %u", pntohl(&pd[offset + 12 + (i*8)])); } } else - dissect_data(pd, offset + 8, fd, icmp_tree); + old_dissect_data(pd, offset + 8, fd, icmp_tree); break; case ICMP_TSTAMP: @@ -1207,18 +1206,12 @@ dissect_icmp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { } static void -#if 0 dissect_igmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) -#else -dissect_igmp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) -#endif { e_igmp ih; proto_tree *igmp_tree; proto_item *ti; gchar *type_str; - packet_info *pinfo = π - tvbuff_t *tvb = tvb_create_from_top(offset); pinfo->current_proto = "IGMP"; if (check_col(pinfo->fd, COL_PROTOCOL)) @@ -1447,11 +1440,11 @@ proto_register_ip(void) void proto_reg_handoff_ip(void) { - dissector_add("ethertype", ETHERTYPE_IP, dissect_ip); - dissector_add("ppp.protocol", PPP_IP, dissect_ip); - dissector_add("llc.dsap", SAP_IP, dissect_ip); - dissector_add("ip.proto", IP_PROTO_IPV4, dissect_ip); - dissector_add("ip.proto", IP_PROTO_IPIP, dissect_ip); + old_dissector_add("ethertype", ETHERTYPE_IP, dissect_ip); + old_dissector_add("ppp.protocol", PPP_IP, dissect_ip); + old_dissector_add("llc.dsap", SAP_IP, dissect_ip); + old_dissector_add("ip.proto", IP_PROTO_IPV4, dissect_ip); + old_dissector_add("ip.proto", IP_PROTO_IPIP, dissect_ip); } void @@ -1484,5 +1477,5 @@ proto_register_icmp(void) void proto_reg_handoff_icmp(void) { - dissector_add("ip.proto", IP_PROTO_ICMP, dissect_icmp); + old_dissector_add("ip.proto", IP_PROTO_ICMP, dissect_icmp); } diff --git a/packet-ipp.c b/packet-ipp.c index 8bd685005a..7cfd73e90b 100644 --- a/packet-ipp.c +++ b/packet-ipp.c @@ -3,7 +3,7 @@ * * Guy Harris * - * $Id: packet-ipp.c,v 1.10 2000/05/31 05:07:09 guy Exp $ + * $Id: packet-ipp.c,v 1.11 2000/08/07 03:20:41 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -228,7 +228,7 @@ void dissect_ipp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) offset = parse_attributes(pd, offset, fd, ipp_tree); if (IS_DATA_IN_FRAME(offset)) - dissect_data(pd, offset, fd, ipp_tree); + old_dissect_data(pd, offset, fd, ipp_tree); } } @@ -584,6 +584,6 @@ proto_reg_handoff_ipp(void) Or should the HTTP dissector decide that the payload is IPP based on the MIME headers? */ - dissector_add("tcp.port", 631, dissect_http); + old_dissector_add("tcp.port", 631, dissect_http); } diff --git a/packet-ipsec.c b/packet-ipsec.c index 05b8cb3d1a..5cb757c101 100644 --- a/packet-ipsec.c +++ b/packet-ipsec.c @@ -1,7 +1,7 @@ /* packet-ipsec.c * Routines for IPsec/IPComp packet disassembly * - * $Id: packet-ipsec.c,v 1.18 2000/07/08 10:46:20 gram Exp $ + * $Id: packet-ipsec.c,v 1.19 2000/08/07 03:20:41 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -198,8 +198,8 @@ dissect_ah(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) } /* do lookup with the subdissector table */ - if (!dissector_try_port(ip_dissector_table, ah.ah_nxt, pd, offset, fd, next_tree)) { - dissect_data(pd, offset, fd, next_tree); + if (!old_dissector_try_port(ip_dissector_table, ah.ah_nxt, pd, offset, fd, next_tree)) { + old_dissect_data(pd, offset, fd, next_tree); } } @@ -236,7 +236,7 @@ dissect_esp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) proto_tree_add_uint(esp_tree, hf_esp_sequence, NullTVB, offset + offsetof(struct newesp, esp_seq), 4, (guint32)ntohl(esp.esp_seq)); - dissect_data(pd, offset + sizeof(struct newesp), fd, esp_tree); + old_dissect_data(pd, offset + sizeof(struct newesp), fd, esp_tree); } } @@ -293,7 +293,7 @@ dissect_ipcomp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) "CPI: %s (0x%04x)", p, ntohs(ipcomp.comp_cpi)); } - dissect_data(pd, offset + sizeof(struct ipcomp), fd, ipcomp_tree); + old_dissect_data(pd, offset + sizeof(struct ipcomp), fd, ipcomp_tree); } } @@ -357,7 +357,7 @@ proto_register_ipsec(void) void proto_reg_handoff_ipsec(void) { - dissector_add("ip.proto", IP_PROTO_AH, dissect_ah); - dissector_add("ip.proto", IP_PROTO_ESP, dissect_esp); - dissector_add("ip.proto", IP_PROTO_IPCOMP, dissect_ipcomp); + old_dissector_add("ip.proto", IP_PROTO_AH, dissect_ah); + old_dissector_add("ip.proto", IP_PROTO_ESP, dissect_esp); + old_dissector_add("ip.proto", IP_PROTO_IPCOMP, dissect_ipcomp); } diff --git a/packet-ipv6.c b/packet-ipv6.c index 6f5cd881b9..b0fc9ab514 100644 --- a/packet-ipv6.c +++ b/packet-ipv6.c @@ -1,7 +1,7 @@ /* packet-ipv6.c * Routines for IPv6 packet disassembly * - * $Id: packet-ipv6.c,v 1.39 2000/06/05 03:21:03 gram Exp $ + * $Id: packet-ipv6.c,v 1.40 2000/08/07 03:20:42 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -370,16 +370,16 @@ again: if (check_col(fd, COL_PROTOCOL)) col_add_str(fd, COL_PROTOCOL, "IPv6"); /* COL_INFO was filled in by "dissect_frag6()" */ - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } else { /* do lookup with the subdissector table */ - if (!dissector_try_port(ip_dissector_table, nxt, pd, offset, fd, tree)) { + if (!old_dissector_try_port(ip_dissector_table, nxt, pd, offset, fd, tree)) { /* Unknown protocol */ if (check_col(fd, COL_PROTOCOL)) col_add_str(fd, COL_PROTOCOL, "IPv6"); if (check_col(fd, COL_INFO)) col_add_fstr(fd, COL_INFO, "%s (0x%02x)", ipprotostr(nxt), nxt); - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } } } @@ -440,8 +440,8 @@ proto_register_ipv6(void) void proto_reg_handoff_ipv6(void) { - dissector_add("ethertype", ETHERTYPE_IPv6, dissect_ipv6); - dissector_add("ppp.protocol", PPP_IPV6, dissect_ipv6); - dissector_add("ip.proto", IP_PROTO_IPV6, dissect_ipv6); - dissector_add("ip.proto", IP_PROTO_NONE, dissect_ipv6_none); + old_dissector_add("ethertype", ETHERTYPE_IPv6, dissect_ipv6); + old_dissector_add("ppp.protocol", PPP_IPV6, dissect_ipv6); + old_dissector_add("ip.proto", IP_PROTO_IPV6, dissect_ipv6); + old_dissector_add("ip.proto", IP_PROTO_NONE, dissect_ipv6_none); } diff --git a/packet-ipx.c b/packet-ipx.c index c45c8ab013..f28ce4aeb8 100644 --- a/packet-ipx.c +++ b/packet-ipx.c @@ -2,7 +2,7 @@ * Routines for NetWare's IPX * Gilbert Ramirez * - * $Id: packet-ipx.c,v 1.62 2000/06/15 03:48:40 gram Exp $ + * $Id: packet-ipx.c,v 1.63 2000/08/07 03:20:42 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -102,16 +102,16 @@ static int hf_msg_conn = -1; static int hf_msg_sigchar = -1; static void -dissect_spx(const u_char *pd, int offset, frame_data *fd, proto_tree *tree); +dissect_spx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); static void -dissect_ipxrip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree); +dissect_ipxrip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); static void -dissect_ipxsap(const u_char *pd, int offset, frame_data *fd, proto_tree *tree); +dissect_ipxsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); static void -dissect_ipxmsg(const u_char *pd, int offset, frame_data *fd, proto_tree *tree); +dissect_ipxmsg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); #define UDP_PORT_IPX 213 /* RFC 1234 */ @@ -270,17 +270,9 @@ capture_ipx(const u_char *pd, int offset, packet_counts *ld) ld->ipx++; } -#if 0 void dissect_ipx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { -#else -void -dissect_ipx(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) -{ - packet_info *pinfo = π - tvbuff_t *tvb = tvb_create_from_top(offset); -#endif tvbuff_t *next_tvb; const guint8 *this_pd; int this_offset, len; @@ -368,8 +360,8 @@ dissect_ipx(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) tvb_compat(next_tvb, &next_pd, &next_offset); - if (dissector_try_port(ipx_type_dissector_table, ipx_type, next_pd, - next_offset, pinfo->fd, tree)) + if (dissector_try_port(ipx_type_dissector_table, ipx_type, next_tvb, + pinfo, tree)) return; switch (ipx_type) { @@ -387,13 +379,13 @@ dissect_ipx(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) break; } - if (dissector_try_port(ipx_socket_dissector_table, ipx_dsocket, next_pd, - next_offset, pinfo->fd, tree)) + if (dissector_try_port(ipx_socket_dissector_table, ipx_dsocket, + next_tvb, pinfo, tree)) return; - if (dissector_try_port(ipx_socket_dissector_table, ipx_ssocket, next_pd, - next_offset, pinfo->fd, tree)) + if (dissector_try_port(ipx_socket_dissector_table, ipx_ssocket, + next_tvb, pinfo, tree)) return; - dissect_data_tvb(next_tvb, pinfo, tree); + dissect_data(next_tvb, pinfo, tree); } @@ -438,17 +430,9 @@ spx_datastream(guint8 type) #define SPX_HEADER_LEN 12 -#if 0 static void dissect_spx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { -#else -static void -dissect_spx(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) -{ - packet_info *pinfo = π - tvbuff_t *tvb = tvb_create_from_top(offset); -#endif proto_tree *spx_tree; proto_item *ti; tvbuff_t *next_tvb; @@ -485,24 +469,16 @@ dissect_spx(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) proto_tree_add_item(spx_tree, hf_spx_all_nr, tvb, 10, 2, FALSE); next_tvb = tvb_new_subset(tvb, SPX_HEADER_LEN, -1, -1); - dissect_data_tvb(next_tvb, pinfo, tree); + dissect_data(next_tvb, pinfo, tree); } } /* ================================================================= */ /* IPX Message */ /* ================================================================= */ -#if 0 static void dissect_ipxmsg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { -#else -static void -dissect_ipxmsg(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) -{ - packet_info *pinfo = π - tvbuff_t *tvb = tvb_create_from_top(offset); -#endif proto_tree *msg_tree; proto_item *ti; guint8 conn_number, sig_char; @@ -534,17 +510,9 @@ dissect_ipxmsg(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) /* ================================================================= */ /* IPX RIP */ /* ================================================================= */ -#if 0 static void dissect_ipxrip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { -#else -static void -dissect_ipxrip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) -{ - packet_info *pinfo = π - tvbuff_t *tvb = tvb_create_from_top(offset); -#endif proto_tree *rip_tree; proto_item *ti; guint16 operation; @@ -688,18 +656,9 @@ server_type(guint16 type) } } -#if 0 static void dissect_ipxsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { -#else -static void -dissect_ipxsap(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) -{ - packet_info *pinfo = π - tvbuff_t *tvb = tvb_create_from_top(offset); -#endif - proto_tree *sap_tree, *s_tree; proto_item *ti; int cursor; diff --git a/packet-ipx.h b/packet-ipx.h index b29e72e1ca..2e0ffbbc16 100644 --- a/packet-ipx.h +++ b/packet-ipx.h @@ -2,7 +2,7 @@ * Routines for NetWare's IPX * Gilbert Ramirez * - * $Id: packet-ipx.h,v 1.8 2000/06/15 03:48:41 gram Exp $ + * $Id: packet-ipx.h,v 1.9 2000/08/07 03:20:45 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -142,5 +142,5 @@ gchar* ipxnet_to_string(const guint8 *ad); gchar* ipxnet_to_str_punct(const guint32 ad, char punct); void capture_ipx(const u_char *, int, packet_counts *); -void dissect_ipx(const u_char *, int, frame_data*, proto_tree *); +void dissect_ipx(tvbuff_t *, packet_info *, proto_tree *); diff --git a/packet-irc.c b/packet-irc.c index 4236e24d1b..765acc4327 100644 --- a/packet-irc.c +++ b/packet-irc.c @@ -1,7 +1,7 @@ /* packet-irc.c * Routines for MSX irc packet dissection * - * $Id: packet-irc.c,v 1.6 2000/05/31 05:07:11 guy Exp $ + * $Id: packet-irc.c,v 1.7 2000/08/07 03:20:45 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -165,6 +165,6 @@ proto_register_irc(void) void proto_reg_handoff_irc(void) { - dissector_add("tcp.port", TCP_PORT_IRC, dissect_irc); + old_dissector_add("tcp.port", TCP_PORT_IRC, dissect_irc); } diff --git a/packet-isakmp.c b/packet-isakmp.c index b08e1cc97b..f62d5e3cc5 100644 --- a/packet-isakmp.c +++ b/packet-isakmp.c @@ -3,7 +3,7 @@ * (ISAKMP) (RFC 2408) * Brad Robel-Forrest * - * $Id: packet-isakmp.c,v 1.23 2000/07/02 03:25:48 guy Exp $ + * $Id: packet-isakmp.c,v 1.24 2000/08/07 03:20:45 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -433,7 +433,7 @@ dissect_isakmp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { (*strfuncs[hdr->next_payload].func)(pd, offset, fd, isakmp_tree); } else - dissect_data(pd, offset, fd, isakmp_tree); + old_dissect_data(pd, offset, fd, isakmp_tree); } } } @@ -483,7 +483,7 @@ dissect_sa(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { (*strfuncs[hdr->next_payload].func)(pd, offset, fd, tree); } else - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } static void @@ -539,7 +539,7 @@ dissect_proposal(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) (*strfuncs[hdr->next_payload].func)(pd, next_hdr_offset, fd, tree); } else - dissect_data(pd, next_hdr_offset, fd, tree); + old_dissect_data(pd, next_hdr_offset, fd, tree); } static void @@ -629,7 +629,7 @@ dissect_transform(const u_char *pd, int offset, frame_data *fd, (*strfuncs[hdr->next_payload].func)(pd, offset, fd, tree); } else - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } static void @@ -661,7 +661,7 @@ dissect_key_exch(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) (*strfuncs[hdr->next_payload].func)(pd, offset, fd, tree); } else - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } static void @@ -718,7 +718,7 @@ dissect_id(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { (*strfuncs[hdr->next_payload].func)(pd, offset, fd, tree); } else - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } static void @@ -754,7 +754,7 @@ dissect_cert(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { (*strfuncs[hdr->next_payload].func)(pd, offset, fd, tree); } else - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } static void @@ -790,7 +790,7 @@ dissect_certreq(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) (*strfuncs[hdr->next_payload].func)(pd, offset, fd, tree); } else - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } static void @@ -822,7 +822,7 @@ dissect_hash(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { (*strfuncs[hdr->next_payload].func)(pd, offset, fd, tree); } else - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } static void @@ -854,7 +854,7 @@ dissect_sig(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { (*strfuncs[hdr->next_payload].func)(pd, offset, fd, tree); } else - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } static void @@ -886,7 +886,7 @@ dissect_nonce(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { (*strfuncs[hdr->next_payload].func)(pd, offset, fd, tree); } else - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } static void @@ -945,7 +945,7 @@ dissect_notif(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { (*strfuncs[hdr->next_payload].func)(pd, offset, fd, tree); } else - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } static void @@ -1000,7 +1000,7 @@ dissect_delete(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { (*strfuncs[hdr->next_payload].func)(pd, offset, fd, tree); } else - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } static void @@ -1032,7 +1032,7 @@ dissect_vid(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { (*strfuncs[hdr->next_payload].func)(pd, offset, fd, tree); } else - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } static void @@ -1091,7 +1091,7 @@ dissect_config(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { (*strfuncs[hdr->next_payload].func)(pd, offset, fd, tree); } else - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } @@ -1432,5 +1432,5 @@ proto_register_isakmp(void) void proto_reg_handoff_isakmp(void) { - dissector_add("udp.port", UDP_PORT_ISAKMP, dissect_isakmp); + old_dissector_add("udp.port", UDP_PORT_ISAKMP, dissect_isakmp); } diff --git a/packet-isis.c b/packet-isis.c index 7b0e1153b7..0dd57dc239 100644 --- a/packet-isis.c +++ b/packet-isis.c @@ -2,7 +2,7 @@ * Routines for ISO/OSI network and transport protocol packet disassembly, core * bits. * - * $Id: packet-isis.c,v 1.11 2000/06/19 08:33:50 guy Exp $ + * $Id: packet-isis.c,v 1.12 2000/08/07 03:20:46 guy Exp $ * Stuart Stanley * * Ethereal - Network traffic analyzer @@ -335,5 +335,5 @@ proto_register_isis(void) { void proto_reg_handoff_isis(void) { - dissector_add("osinl", NLPID_ISO10589_ISIS, dissect_isis); + old_dissector_add("osinl", NLPID_ISO10589_ISIS, dissect_isis); } diff --git a/packet-isl.c b/packet-isl.c index 27fb46f0c3..3d4dc51498 100644 --- a/packet-isl.c +++ b/packet-isl.c @@ -1,7 +1,7 @@ /* packet-isl.c * Routines for Cisco ISL Ethernet header disassembly * - * $Id: packet-isl.c,v 1.13 2000/06/15 03:48:41 gram Exp $ + * $Id: packet-isl.c,v 1.14 2000/08/07 03:20:46 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -147,7 +147,7 @@ dissect_isl(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) tvbuff_t *next_tvb; if (!BYTES_ARE_IN_FRAME(offset, ISL_HEADER_SIZE)) { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return; } @@ -232,7 +232,7 @@ dissect_isl(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) default: next_tvb = tvb_create_from_top(offset+26); - dissect_data_tvb(next_tvb, &pi, tree); + dissect_data(next_tvb, &pi, tree); break; } } diff --git a/packet-l2tp.c b/packet-l2tp.c index a83ccaa76c..c912bfddd4 100644 --- a/packet-l2tp.c +++ b/packet-l2tp.c @@ -7,7 +7,7 @@ * Laurent Cazalet * Thomas Parvais * - * $Id: packet-l2tp.c,v 1.13 2000/06/15 03:48:41 gram Exp $ + * $Id: packet-l2tp.c,v 1.14 2000/08/07 03:20:47 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -830,5 +830,5 @@ proto_register_l2tp(void) void proto_reg_handoff_l2tp(void) { - dissector_add("udp.port", UDP_PORT_L2TP, dissect_l2tp); + old_dissector_add("udp.port", UDP_PORT_L2TP, dissect_l2tp); } diff --git a/packet-lapd.c b/packet-lapd.c index 9808d7f57c..021394dc8b 100644 --- a/packet-lapd.c +++ b/packet-lapd.c @@ -2,7 +2,7 @@ * Routines for LAPD frame disassembly * Gilbert Ramirez * - * $Id: packet-lapd.c,v 1.11 2000/05/31 05:07:16 guy Exp $ + * $Id: packet-lapd.c,v 1.12 2000/08/07 03:20:48 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -151,11 +151,11 @@ dissect_lapd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; default: - dissect_data_tvb(next_tvb, pinfo, tree); + dissect_data(next_tvb, pinfo, tree); break; } } else - dissect_data_tvb(next_tvb, pinfo, tree); + dissect_data(next_tvb, pinfo, tree); } void diff --git a/packet-ldap.c b/packet-ldap.c index 3fdda66fbd..8dc04d06e0 100644 --- a/packet-ldap.c +++ b/packet-ldap.c @@ -1,7 +1,7 @@ /* packet-ldap.c * Routines for ldap packet dissection * - * $Id: packet-ldap.c,v 1.12 2000/05/31 05:07:16 guy Exp $ + * $Id: packet-ldap.c,v 1.13 2000/08/07 03:20:48 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -1165,5 +1165,5 @@ proto_register_ldap(void) void proto_reg_handoff_ldap(void) { - dissector_add("tcp.port", TCP_PORT_LDAP, dissect_ldap); + old_dissector_add("tcp.port", TCP_PORT_LDAP, dissect_ldap); } diff --git a/packet-llc.c b/packet-llc.c index 1f060a9b7d..3373c77420 100644 --- a/packet-llc.c +++ b/packet-llc.c @@ -2,7 +2,7 @@ * Routines for IEEE 802.2 LLC layer * Gilbert Ramirez * - * $Id: packet-llc.c,v 1.65 2000/05/31 05:07:17 guy Exp $ + * $Id: packet-llc.c,v 1.66 2000/08/07 03:20:48 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -360,7 +360,7 @@ dissect_llc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ethertype(etype, tvb, 8, pinfo, tree, llc_tree, hf_llc_type); } else - dissect_data_tvb(next_tvb, pinfo, tree); + dissect_data(next_tvb, pinfo, tree); break; case OUI_CISCO: @@ -395,11 +395,11 @@ dissect_llc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; default: - dissect_data_tvb(next_tvb, pinfo, tree); + dissect_data(next_tvb, pinfo, tree); break; } } else - dissect_data_tvb(next_tvb, pinfo, tree); + dissect_data(next_tvb, pinfo, tree); break; case OUI_CABLE_BPDU: /* DOCSIS cable modem spanning tree BPDU */ @@ -415,7 +415,7 @@ dissect_llc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_uint(llc_tree, hf_llc_pid, tvb, 6, 2, etype); } - dissect_data_tvb(next_tvb, pinfo, tree); + dissect_data(next_tvb, pinfo, tree); break; } } @@ -434,17 +434,16 @@ dissect_llc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) next_tvb = tvb_new_subset(tvb, llc_header_len, -1, -1); if (XDLC_IS_INFORMATION(control)) { - tvb_compat(tvb, &pd, &offset); /* non-SNAP */ offset += llc_header_len; /* do lookup with the subdissector table */ if (!dissector_try_port(subdissector_table, dsap, - pd, offset, pinfo->fd, tree)) { - dissect_data_tvb(next_tvb, pinfo, tree); + next_tvb, pinfo, tree)) { + dissect_data(next_tvb, pinfo, tree); } } else { - dissect_data_tvb(next_tvb, pinfo, tree); + dissect_data(next_tvb, pinfo, tree); } } } diff --git a/packet-lpd.c b/packet-lpd.c index d457f5bf7f..aad54d273e 100644 --- a/packet-lpd.c +++ b/packet-lpd.c @@ -2,7 +2,7 @@ * Routines for LPR and LPRng packet disassembly * Gilbert Ramirez * - * $Id: packet-lpd.c,v 1.20 2000/05/31 05:07:17 guy Exp $ + * $Id: packet-lpd.c,v 1.21 2000/08/07 03:20:51 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -124,7 +124,7 @@ dissect_lpd(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) strlen(printer), "Printer/options: %s", printer); } else { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } if (printer) @@ -138,11 +138,11 @@ dissect_lpd(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) lpd_server_code[response]); } else { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } } else { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } } } @@ -200,5 +200,5 @@ proto_register_lpd(void) void proto_reg_handoff_lpd(void) { - dissector_add("tcp.port", TCP_PORT_PRINTER, &dissect_lpd); + old_dissector_add("tcp.port", TCP_PORT_PRINTER, &dissect_lpd); } diff --git a/packet-mapi.c b/packet-mapi.c index b0c1e0bff0..5a75090276 100644 --- a/packet-mapi.c +++ b/packet-mapi.c @@ -1,7 +1,7 @@ /* packet-mapi.c * Routines for MSX mapi packet dissection * - * $Id: packet-mapi.c,v 1.7 2000/05/31 05:07:18 guy Exp $ + * $Id: packet-mapi.c,v 1.8 2000/08/07 03:20:51 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -112,5 +112,5 @@ proto_register_mapi(void) void proto_reg_handoff_mapi(void) { - dissector_add("tcp.port", TCP_PORT_MAPI, dissect_mapi); + old_dissector_add("tcp.port", TCP_PORT_MAPI, dissect_mapi); } diff --git a/packet-mip.c b/packet-mip.c index 88827f2924..66d2a0a712 100644 --- a/packet-mip.c +++ b/packet-mip.c @@ -2,7 +2,7 @@ * Routines for Mobile IP dissection * Copyright 2000, Stefan Raab * - * $Id: packet-mip.c,v 1.5 2000/06/15 03:48:42 gram Exp $ + * $Id: packet-mip.c,v 1.6 2000/08/07 03:20:51 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -299,5 +299,5 @@ void proto_register_mip(void) void proto_reg_handoff_mip(void) { - dissector_add("udp.port", UDP_PORT_MIP, dissect_mip); + old_dissector_add("udp.port", UDP_PORT_MIP, dissect_mip); } diff --git a/packet-mpls.c b/packet-mpls.c index 23c385241a..a895b6bc42 100644 --- a/packet-mpls.c +++ b/packet-mpls.c @@ -3,7 +3,7 @@ * * (c) Copyright Ashok Narayanan * - * $Id: packet-mpls.c,v 1.7 2000/05/31 05:07:19 guy Exp $ + * $Id: packet-mpls.c,v 1.8 2000/08/07 03:20:51 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -145,7 +145,7 @@ dissect_mpls(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) /* Start Decoding Here. */ while (1) { if (!BYTES_ARE_IN_FRAME(offset, 4)) { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return; } @@ -193,5 +193,5 @@ proto_register_mpls(void) void proto_reg_handoff_mpls(void) { - dissector_add("ethertype", ETHERTYPE_MPLS, dissect_mpls); + old_dissector_add("ethertype", ETHERTYPE_MPLS, dissect_mpls); } diff --git a/packet-msproxy.c b/packet-msproxy.c index 6ac41a644f..09a97a953e 100644 --- a/packet-msproxy.c +++ b/packet-msproxy.c @@ -2,7 +2,7 @@ * Routines for Microsoft Proxy packet dissection * Copyright 2000, Jeffrey C. Foster * - * $Id: packet-msproxy.c,v 1.6 2000/08/06 10:04:13 guy Exp $ + * $Id: packet-msproxy.c,v 1.7 2000/08/07 03:20:52 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -282,7 +282,7 @@ static void add_msproxy_conversation( hash_entry_t *hash_info){ /* conversation data structure with the info needed to call the TCP or */ /* UDP port decoder. */ -/* NOTE: Currently this assume that the conversataion will be created */ +/* NOTE: Currently this assume that the conversation will be created */ /* during a packet from the server. If that changes, the pi.src */ /* and pi.dst will not be correct and this routine will have to */ /* change. */ @@ -309,7 +309,8 @@ static void add_msproxy_conversation( hash_entry_t *hash_info){ new_conv_info->server_int_port = hash_info->server_int_port; new_conv_info->proto = hash_info->proto; - conversation->dissector = msproxy_sub_dissector; + conversation->is_old_dissector = TRUE; + conversation->dissector.old = msproxy_sub_dissector; } @@ -1354,5 +1355,5 @@ proto_reg_handoff_msproxy(void) { /* dissector install routine */ - dissector_add("udp.port", UDP_PORT_MSPROXY, dissect_msproxy); + old_dissector_add("udp.port", UDP_PORT_MSPROXY, dissect_msproxy); } diff --git a/packet-nbipx.c b/packet-nbipx.c index 4840291eee..81a2204652 100644 --- a/packet-nbipx.c +++ b/packet-nbipx.c @@ -2,7 +2,7 @@ * Routines for NetBIOS over IPX packet disassembly * Gilbert Ramirez * - * $Id: packet-nbipx.c,v 1.21 2000/05/31 05:07:21 guy Exp $ + * $Id: packet-nbipx.c,v 1.22 2000/08/07 03:20:52 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -417,7 +417,7 @@ dissect_nwlink_dg(const u_char *pd, int offset, frame_data *fd, proto_tree *tree break; default: - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); break; } } @@ -443,5 +443,5 @@ proto_register_nbipx(void) void proto_reg_handoff_nbipx(void) { - dissector_add("ipx.socket", IPX_SOCKET_NWLINK_SMB_DGRAM, dissect_nwlink_dg); + old_dissector_add("ipx.socket", IPX_SOCKET_NWLINK_SMB_DGRAM, dissect_nwlink_dg); } diff --git a/packet-nbns.c b/packet-nbns.c index 48d1f40cd0..d342502d5d 100644 --- a/packet-nbns.c +++ b/packet-nbns.c @@ -4,7 +4,7 @@ * Gilbert Ramirez * Much stuff added by Guy Harris * - * $Id: packet-nbns.c,v 1.43 2000/05/31 05:07:21 guy Exp $ + * $Id: packet-nbns.c,v 1.44 2000/08/07 03:20:53 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -1140,7 +1140,7 @@ dissect_nbns(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) if (pi.captured_len < NBNS_HDRLEN) { col_add_str(fd, COL_INFO, "Short NBNS packet"); - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return; } @@ -1759,8 +1759,8 @@ proto_register_nbt(void) void proto_reg_handoff_nbt(void) { - dissector_add("udp.port", UDP_PORT_NBNS, dissect_nbns); - dissector_add("udp.port", UDP_PORT_NBDGM, dissect_nbdgm); - dissector_add("tcp.port", TCP_PORT_NBSS, dissect_nbss); - dissector_add("tcp.port", TCP_PORT_CIFS, dissect_nbss); + old_dissector_add("udp.port", UDP_PORT_NBNS, dissect_nbns); + old_dissector_add("udp.port", UDP_PORT_NBDGM, dissect_nbdgm); + old_dissector_add("tcp.port", TCP_PORT_NBSS, dissect_nbss); + old_dissector_add("tcp.port", TCP_PORT_CIFS, dissect_nbss); } diff --git a/packet-ncp.c b/packet-ncp.c index 83e6b0334c..15ce9c670b 100644 --- a/packet-ncp.c +++ b/packet-ncp.c @@ -3,7 +3,7 @@ * Gilbert Ramirez * Modified to allow NCP over TCP/IP decodes by James Coe * - * $Id: packet-ncp.c,v 1.38 2000/07/28 20:03:42 gram Exp $ + * $Id: packet-ncp.c,v 1.39 2000/08/07 03:20:54 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -247,17 +247,9 @@ ncp_hash_lookup(conversation_t *conversation, guint8 nw_sequence, } } -#if 0 -void +static void dissect_ncp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { -#else -void -dissect_ncp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) -{ - packet_info *pinfo = π - tvbuff_t *tvb = tvb_create_from_top(offset); -#endif proto_tree *ncp_tree = NULL; proto_item *ti; struct ncp_ip_header ncpiph; diff --git a/packet-netbios.c b/packet-netbios.c index 6d7ec36bd9..56cf58491f 100644 --- a/packet-netbios.c +++ b/packet-netbios.c @@ -5,7 +5,7 @@ * * derived from the packet-nbns.c * - * $Id: packet-netbios.c,v 1.20 2000/05/31 05:07:23 guy Exp $ + * $Id: packet-netbios.c,v 1.21 2000/08/07 03:20:55 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -509,7 +509,7 @@ static void dissect_netb_unknown(const u_char *data_ptr, int offset, {/* Handle any unknow commands, do nothing */ -/* dissect_data( data_ptr, offset + NB_COMMAND + 1, fd, tree); */ +/* old_dissect_data( data_ptr, offset + NB_COMMAND + 1, fd, tree); */ } @@ -1086,5 +1086,5 @@ void proto_register_netbios(void) void proto_reg_handoff_netbios(void) { - dissector_add("llc.dsap", SAP_NETBIOS, dissect_netbios); + old_dissector_add("llc.dsap", SAP_NETBIOS, dissect_netbios); } diff --git a/packet-nntp.c b/packet-nntp.c index eab360e222..723904a3a0 100644 --- a/packet-nntp.c +++ b/packet-nntp.c @@ -2,7 +2,7 @@ * Routines for nntp packet dissection * Copyright 1999, Richard Sharpe * - * $Id: packet-nntp.c,v 1.10 2000/05/31 05:07:26 guy Exp $ + * $Id: packet-nntp.c,v 1.11 2000/08/07 03:20:56 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -147,5 +147,5 @@ proto_register_nntp(void) void proto_reg_handoff_nntp(void) { - dissector_add("tcp.port", TCP_PORT_NNTP, dissect_nntp); + old_dissector_add("tcp.port", TCP_PORT_NNTP, dissect_nntp); } diff --git a/packet-ntp.c b/packet-ntp.c index 7c1aa92d95..a9a5f6384b 100644 --- a/packet-ntp.c +++ b/packet-ntp.c @@ -2,7 +2,7 @@ * Routines for NTP packet dissection * Copyright 1999, Nathan Neulinger * - * $Id: packet-ntp.c,v 1.13 2000/05/31 05:07:26 guy Exp $ + * $Id: packet-ntp.c,v 1.14 2000/08/07 03:20:57 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -441,6 +441,6 @@ proto_register_ntp(void) void proto_reg_handoff_ntp(void) { - dissector_add("udp.port", UDP_PORT_NTP, dissect_ntp); - dissector_add("tcp.port", TCP_PORT_NTP, dissect_ntp); + old_dissector_add("udp.port", UDP_PORT_NTP, dissect_ntp); + old_dissector_add("tcp.port", TCP_PORT_NTP, dissect_ntp); } diff --git a/packet-null.c b/packet-null.c index 39f4253ec0..a8b1f3c808 100644 --- a/packet-null.c +++ b/packet-null.c @@ -1,7 +1,7 @@ /* packet-null.c * Routines for null packet disassembly * - * $Id: packet-null.c,v 1.25 2000/05/31 05:07:27 guy Exp $ + * $Id: packet-null.c,v 1.26 2000/08/07 03:20:57 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -300,7 +300,7 @@ dissect_null(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; case BSD_AF_IPX: - dissect_ipx(next_pd, next_offset, pinfo->fd, tree); + dissect_ipx(next_tvb, pinfo, tree); break; case BSD_AF_ISO: @@ -313,7 +313,7 @@ dissect_null(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; default: - dissect_data_tvb(next_tvb, pinfo, tree); + dissect_data(next_tvb, pinfo, tree); break; } } diff --git a/packet-osi.c b/packet-osi.c index 3bca500086..ab3ab43f59 100644 --- a/packet-osi.c +++ b/packet-osi.c @@ -2,7 +2,7 @@ * Routines for ISO/OSI network and transport protocol packet disassembly * Main entrance point and common functions * - * $Id: packet-osi.c,v 1.33 2000/04/17 01:36:31 guy Exp $ + * $Id: packet-osi.c,v 1.34 2000/08/07 03:20:58 guy Exp $ * Laurent Deniel * Ralf Schneider * @@ -225,7 +225,7 @@ void dissect_osi(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { /* do lookup with the subdissector table */ - if (dissector_try_port(subdissector_table, pd[offset], pd, offset, fd, tree)) + if (old_dissector_try_port(subdissector_table, pd[offset], pd, offset, fd, tree)) return; switch (pd[offset]) { @@ -236,13 +236,13 @@ void dissect_osi(const u_char *pd, int offset, frame_data *fd, if (check_col(fd, COL_PROTOCOL)) { col_add_str(fd, COL_PROTOCOL, "ESIS (X.25)"); } - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); break; case NLPID_ISO10747_IDRP: if (check_col(fd, COL_PROTOCOL)) { col_add_str(fd, COL_PROTOCOL, "IDRP"); } - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); break; default: if (check_col(fd, COL_PROTOCOL)) { @@ -251,7 +251,7 @@ void dissect_osi(const u_char *pd, int offset, frame_data *fd, if (check_col(fd, COL_INFO)) { col_add_fstr(fd, COL_INFO, "Unknown ISO protocol (%02x)", pd[offset]); } - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); break; } } /* dissect_osi */ @@ -268,5 +268,5 @@ proto_register_osi(void) void proto_reg_handoff_osi(void) { - dissector_add("llc.dsap", SAP_OSINL, dissect_osi); + old_dissector_add("llc.dsap", SAP_OSINL, dissect_osi); } diff --git a/packet-ospf.c b/packet-ospf.c index 52a0418a81..9c18ed5f2a 100644 --- a/packet-ospf.c +++ b/packet-ospf.c @@ -2,7 +2,7 @@ * Routines for OSPF packet disassembly * (c) Copyright Hannes R. Boehm * - * $Id: packet-ospf.c,v 1.25 2000/07/14 03:23:40 guy Exp $ + * $Id: packet-ospf.c,v 1.26 2000/08/07 03:20:58 guy Exp $ * * At this time, this module is able to analyze OSPF * packets as specified in RFC2328. MOSPF (RFC1584) and other @@ -197,7 +197,7 @@ dissect_ospf(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { break; default: pi.captured_len = saved_len; - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } pi.captured_len = saved_len; } @@ -908,5 +908,5 @@ proto_register_ospf(void) void proto_reg_handoff_ospf(void) { - dissector_add("ip.proto", IP_PROTO_OSPF, dissect_ospf); + old_dissector_add("ip.proto", IP_PROTO_OSPF, dissect_ospf); } diff --git a/packet-pim.c b/packet-pim.c index 658c58ad2e..b377aef654 100644 --- a/packet-pim.c +++ b/packet-pim.c @@ -2,7 +2,7 @@ * Routines for PIM disassembly * (c) Copyright Jun-ichiro itojun Hagino * - * $Id: packet-pim.c,v 1.14 2000/05/31 05:07:28 guy Exp $ + * $Id: packet-pim.c,v 1.15 2000/08/07 03:20:59 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -605,6 +605,6 @@ proto_register_pim(void) void proto_reg_handoff_pim(void) { - dissector_add("ip.proto", IP_PROTO_PIM, dissect_pim); + old_dissector_add("ip.proto", IP_PROTO_PIM, dissect_pim); } diff --git a/packet-pop.c b/packet-pop.c index 47b4a303c8..d152212b8b 100644 --- a/packet-pop.c +++ b/packet-pop.c @@ -2,7 +2,7 @@ * Routines for pop packet dissection * Copyright 1999, Richard Sharpe * - * $Id: packet-pop.c,v 1.15 2000/05/31 05:07:29 guy Exp $ + * $Id: packet-pop.c,v 1.16 2000/08/07 03:20:59 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -116,7 +116,7 @@ dissect_pop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) proto_tree_add_boolean_hidden(pop_tree, hf_pop_response, NullTVB, offset, i1, TRUE); if (is_continuation(pd+offset)) - dissect_data(pd, offset, fd, pop_tree); + old_dissect_data(pd, offset, fd, pop_tree); else { proto_tree_add_text(pop_tree, NullTVB, offset, i1, "Response: %s", rr); @@ -166,5 +166,5 @@ proto_register_pop(void) void proto_reg_handoff_pop(void) { - dissector_add("tcp.port", TCP_PORT_POP, dissect_pop); + old_dissector_add("tcp.port", TCP_PORT_POP, dissect_pop); } diff --git a/packet-ppp.c b/packet-ppp.c index 399706bda1..38a459b66b 100644 --- a/packet-ppp.c +++ b/packet-ppp.c @@ -1,7 +1,7 @@ /* packet-ppp.c * Routines for ppp packet disassembly * - * $Id: packet-ppp.c,v 1.37 2000/06/15 03:48:42 gram Exp $ + * $Id: packet-ppp.c,v 1.38 2000/08/07 03:21:00 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -996,7 +996,7 @@ dissect_ppp_stuff( tvbuff_t *tvb, packet_info *pinfo, tvb_compat(next_tvb, &next_pd, &next_offset); /* do lookup with the subdissector table */ - if (dissector_try_port(subdissector_table, ppp_prot, next_pd, next_offset, pinfo->fd, tree)) + if (old_dissector_try_port(subdissector_table, ppp_prot, next_pd, next_offset, pinfo->fd, tree)) return TRUE; /* XXX - make "dissect_lcp()" and "dissect_ipcp()", have them just @@ -1019,7 +1019,7 @@ dissect_ppp_stuff( tvbuff_t *tvb, packet_info *pinfo, if (check_col(pinfo->fd, COL_INFO)) col_add_fstr(pinfo->fd, COL_INFO, "PPP %s (0x%04x)", val_to_str(ppp_prot, ppp_vals, "Unknown"), ppp_prot); - dissect_data_tvb(next_tvb, pinfo, tree); + dissect_data(next_tvb, pinfo, tree); return FALSE; } } diff --git a/packet-pppoe.c b/packet-pppoe.c index 1d0695e548..fd0eaacfb4 100644 --- a/packet-pppoe.c +++ b/packet-pppoe.c @@ -1,7 +1,7 @@ /* packet-arp.c * Routines for ARP packet disassembly * - * $Id: packet-pppoe.c,v 1.8 2000/05/11 08:15:35 gram Exp $ + * $Id: packet-pppoe.c,v 1.9 2000/08/07 03:21:01 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -251,6 +251,6 @@ proto_register_pppoed(void) void proto_reg_handoff_pppoe(void) { - dissector_add("ethertype", ETHERTYPE_PPPOED, dissect_pppoed); - dissector_add("ethertype", ETHERTYPE_PPPOES, dissect_pppoes); + old_dissector_add("ethertype", ETHERTYPE_PPPOED, dissect_pppoed); + old_dissector_add("ethertype", ETHERTYPE_PPPOES, dissect_pppoes); } diff --git a/packet-pptp.c b/packet-pptp.c index 243fe4164f..1dbeba5152 100644 --- a/packet-pptp.c +++ b/packet-pptp.c @@ -2,7 +2,7 @@ * Routines for the Point-to-Point Tunnelling Protocol (PPTP) (RFC 2637) * Brad Robel-Forrest * - * $Id: packet-pptp.c,v 1.10 2000/05/11 08:15:35 gram Exp $ + * $Id: packet-pptp.c,v 1.11 2000/08/07 03:21:01 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -426,13 +426,13 @@ dissect_pptp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { if (cntrl_type < NUM_CNTRL_TYPES) ( *(strfuncs[cntrl_type].func))(pd, offset, fd, pptp_tree); else - dissect_data(pd, offset, fd, pptp_tree); + old_dissect_data(pd, offset, fd, pptp_tree); } } static void dissect_unknown(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } static void @@ -903,5 +903,5 @@ proto_register_pptp(void) void proto_reg_handoff_pptp(void) { - dissector_add("tcp.port", TCP_PORT_PPTP, dissect_pptp); + old_dissector_add("tcp.port", TCP_PORT_PPTP, dissect_pptp); } diff --git a/packet-quake.c b/packet-quake.c index dbf648c392..ceec72b180 100644 --- a/packet-quake.c +++ b/packet-quake.c @@ -4,7 +4,7 @@ * Uwe Girlich * http://www.idsoftware.com/q1source/q1source.zip * - * $Id: packet-quake.c,v 1.2 2000/07/31 12:59:51 girlich Exp $ + * $Id: packet-quake.c,v 1.3 2000/08/07 03:21:02 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -151,11 +151,7 @@ static const value_string names_colors[] = { }; -#if 0 static void dissect_quake(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); -#else -static void dissect_quake(const u_char *pd, int offset, frame_data *fd, proto_tree *tree); -#endif static gint @@ -271,7 +267,8 @@ dissect_quake_CCREP_ACCEPT port = tvb_get_letohl(tvb, 0); c = conversation_new( &pi.src, &pi.dst, PT_UDP, port, pi.destport, NULL); if (c) { - c->dissector = dissect_quake; + c->is_old_dissector = FALSE; + c->dissector.new = dissect_quake; } if (tree) { proto_tree_add_uint(tree, hf_quake_CCREP_ACCEPT_port, @@ -529,23 +526,15 @@ dissect_quake_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) (next_tvb, pinfo, control_tree); break; default: - dissect_data_tvb(next_tvb, pinfo, control_tree); + dissect_data(next_tvb, pinfo, control_tree); break; } } -#if 0 static void dissect_quake(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { -#else -static void -dissect_quake(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) -{ - tvbuff_t *tvb = tvb_create_from_top(offset); - packet_info *pinfo = π -#endif proto_tree *quake_tree = NULL; proto_item *quake_item = NULL; guint32 length; @@ -622,7 +611,7 @@ dissect_quake(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) rest_length = tvb_reported_length(tvb) - 8; next_tvb = tvb_new_subset(tvb, 8, rest_length , rest_length); - dissect_data_tvb(next_tvb, pinfo, quake_tree); + dissect_data(next_tvb, pinfo, quake_tree); } void @@ -753,4 +742,3 @@ proto_reg_handoff_quake(void) { dissector_add("udp.port", DEFAULTnet_hostport, dissect_quake); } - diff --git a/packet-radius.c b/packet-radius.c index 0e5a01be35..6ef47248d2 100644 --- a/packet-radius.c +++ b/packet-radius.c @@ -1,7 +1,7 @@ /* packet-radius.c * Routines for RADIUS packet disassembly * - * $Id: packet-radius.c,v 1.15 2000/07/30 08:11:46 guy Exp $ + * $Id: packet-radius.c,v 1.16 2000/08/07 03:21:03 guy Exp $ * * Ethereal - Network traffic analyzer * By Johan Feyaerts @@ -772,8 +772,8 @@ proto_register_radius(void) void proto_reg_handoff_radius(void) { - dissector_add("udp.port", UDP_PORT_RADIUS, dissect_radius); - dissector_add("udp.port", UDP_PORT_RADIUS_NEW, dissect_radius); - dissector_add("udp.port", UDP_PORT_RADACCT, dissect_radius); - dissector_add("udp.port", UDP_PORT_RADACCT_NEW, dissect_radius); + old_dissector_add("udp.port", UDP_PORT_RADIUS, dissect_radius); + old_dissector_add("udp.port", UDP_PORT_RADIUS_NEW, dissect_radius); + old_dissector_add("udp.port", UDP_PORT_RADACCT, dissect_radius); + old_dissector_add("udp.port", UDP_PORT_RADACCT_NEW, dissect_radius); } diff --git a/packet-rip.c b/packet-rip.c index ad68cd60b7..24fb0c1d43 100644 --- a/packet-rip.c +++ b/packet-rip.c @@ -2,7 +2,7 @@ * Routines for RIPv1 and RIPv2 packet disassembly * (c) Copyright Hannes R. Boehm * - * $Id: packet-rip.c,v 1.16 2000/05/31 05:07:34 guy Exp $ + * $Id: packet-rip.c,v 1.17 2000/08/07 03:21:04 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -72,7 +72,7 @@ dissect_rip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { case RIPv1: /* the domain field has to be set to zero for RIPv1 */ if(!(rip_header.domain == 0)){ - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return; } /* the RIPv2 checks are also made for v1 packets */ @@ -81,13 +81,13 @@ dissect_rip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { * (range checking for index of char* packet_type is done at the same time) */ if( !( (rip_header.command > 0) && (rip_header.command <= 7) )){ - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return; } break; default: /* we only know RIPv1 and RIPv2 */ - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return; } @@ -202,5 +202,5 @@ proto_register_rip(void) void proto_reg_handoff_rip(void) { - dissector_add("udp.port", UDP_PORT_RIP, dissect_rip); + old_dissector_add("udp.port", UDP_PORT_RIP, dissect_rip); } diff --git a/packet-ripng.c b/packet-ripng.c index 7eb34a7618..d32022832d 100644 --- a/packet-ripng.c +++ b/packet-ripng.c @@ -3,7 +3,7 @@ * (c) Copyright Jun-ichiro itojun Hagino * derived from packet-rip.c * - * $Id: packet-ripng.c,v 1.12 2000/05/31 05:07:34 guy Exp $ + * $Id: packet-ripng.c,v 1.13 2000/08/07 03:21:04 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -156,5 +156,5 @@ proto_register_ripng(void) void proto_reg_handoff_ripng(void) { - dissector_add("udp.port", UDP_PORT_RIPNG, dissect_ripng); + old_dissector_add("udp.port", UDP_PORT_RIPNG, dissect_ripng); } diff --git a/packet-rlogin.c b/packet-rlogin.c index 2fdacff27d..5bbec53a04 100644 --- a/packet-rlogin.c +++ b/packet-rlogin.c @@ -2,7 +2,7 @@ * Routines for unix rlogin packet dissection * Copyright 2000, Jeffrey C. Foster * - * $Id: packet-rlogin.c,v 1.6 2000/08/06 08:53:44 guy Exp $ + * $Id: packet-rlogin.c,v 1.7 2000/08/07 03:21:04 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -496,5 +496,5 @@ proto_reg_handoff_rlogin(void) { /* dissector install routine */ - dissector_add("tcp.port", TCP_PORT_RLOGIN, dissect_rlogin); + old_dissector_add("tcp.port", TCP_PORT_RLOGIN, dissect_rlogin); } diff --git a/packet-rpc.c b/packet-rpc.c index 270d8bfcc0..d365b83348 100644 --- a/packet-rpc.c +++ b/packet-rpc.c @@ -2,7 +2,7 @@ * Routines for rpc dissection * Copyright 1999, Uwe Girlich * - * $Id: packet-rpc.c,v 1.33 2000/07/17 20:33:51 guy Exp $ + * $Id: packet-rpc.c,v 1.34 2000/08/07 03:21:05 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -1428,7 +1428,7 @@ dissect_rpc_prog: /* dissect any remaining bytes (incomplete dissection) as pure data in the ptree */ - dissect_data(pd, offset, fd, ptree); + old_dissect_data(pd, offset, fd, ptree); return TRUE; } @@ -1596,8 +1596,8 @@ proto_register_rpc(void) void proto_reg_handoff_rpc(void) { - heur_dissector_add("tcp", dissect_rpc); - heur_dissector_add("udp", dissect_rpc); + old_heur_dissector_add("tcp", dissect_rpc); + old_heur_dissector_add("udp", dissect_rpc); } diff --git a/packet-rsvp.c b/packet-rsvp.c index 8dd63cc498..b50e874b9f 100644 --- a/packet-rsvp.c +++ b/packet-rsvp.c @@ -3,7 +3,7 @@ * * (c) Copyright Ashok Narayanan * - * $Id: packet-rsvp.c,v 1.24 2000/06/02 13:24:12 gram Exp $ + * $Id: packet-rsvp.c,v 1.25 2000/08/07 03:21:06 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -2037,5 +2037,5 @@ proto_register_rsvp(void) void proto_reg_handoff_rsvp(void) { - dissector_add("ip.proto", IP_PROTO_RSVP, dissect_rsvp); + old_dissector_add("ip.proto", IP_PROTO_RSVP, dissect_rsvp); } diff --git a/packet-rtsp.c b/packet-rtsp.c index f250e9e341..398f1a0a13 100644 --- a/packet-rtsp.c +++ b/packet-rtsp.c @@ -4,7 +4,7 @@ * Jason Lango * Liberally copied from packet-http.c, by Guy Harris * - * $Id: packet-rtsp.c,v 1.14 2000/05/31 05:07:37 guy Exp $ + * $Id: packet-rtsp.c,v 1.15 2000/08/07 03:21:07 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -125,14 +125,16 @@ rtsp_create_conversation(const u_char *trans_begin, const u_char *trans_end) conv = conversation_new(&pi.src, &pi.dst, PT_UDP, s_data_port, c_data_port, 0); - conv->dissector = dissect_rtp; + conv->is_old_dissector = TRUE; + conv->dissector.old = dissect_rtp; if (!c_mon_port || !s_mon_port) return; conv = conversation_new(&pi.src, &pi.dst, PT_UDP, s_mon_port, c_mon_port, 0); - conv->dissector = dissect_rtcp; + conv->is_old_dissector = TRUE; + conv->dissector.old = dissect_rtcp; } static void dissect_rtsp(const u_char *pd, int offset, frame_data *fd, @@ -386,5 +388,5 @@ proto_register_rtsp(void) void proto_reg_handoff_rtsp(void) { - dissector_add("tcp.port", TCP_PORT_RTSP, dissect_rtsp); + old_dissector_add("tcp.port", TCP_PORT_RTSP, dissect_rtsp); } diff --git a/packet-rx.c b/packet-rx.c index 54ae5ff8fa..2b67c25ddb 100644 --- a/packet-rx.c +++ b/packet-rx.c @@ -4,7 +4,7 @@ * Based on routines from tcpdump patches by * Ken Hornstein * - * $Id: packet-rx.c,v 1.12 2000/05/31 05:07:38 guy Exp $ + * $Id: packet-rx.c,v 1.13 2000/08/07 03:21:07 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -250,6 +250,6 @@ proto_reg_handoff_rx(void) /* Ports in the range UDP_PORT_RX_LOW to UDP_PORT_RX_HIGH are all used for various AFS services. */ for (port = UDP_PORT_RX_LOW; port <= UDP_PORT_RX_HIGH; port++) - dissector_add("udp.port", port, dissect_rx); - dissector_add("udp.port", UDP_PORT_RX_AFS_BACKUPS, dissect_rx); + old_dissector_add("udp.port", port, dissect_rx); + old_dissector_add("udp.port", UDP_PORT_RX_AFS_BACKUPS, dissect_rx); } diff --git a/packet-sap.c b/packet-sap.c index 61723e45ee..56ed067ede 100644 --- a/packet-sap.c +++ b/packet-sap.c @@ -4,7 +4,7 @@ * * Heikki Vatiainen * - * $Id: packet-sap.c,v 1.8 2000/05/31 05:07:39 guy Exp $ + * $Id: packet-sap.c,v 1.9 2000/08/07 03:21:08 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -323,5 +323,5 @@ void proto_register_sap(void) void proto_reg_handoff_sap(void) { - dissector_add("udp.port", UDP_PORT_SAP, dissect_sap); + old_dissector_add("udp.port", UDP_PORT_SAP, dissect_sap); } diff --git a/packet-sctp.c b/packet-sctp.c index 7db76e9610..2fd807552f 100644 --- a/packet-sctp.c +++ b/packet-sctp.c @@ -2,7 +2,7 @@ * Routines for Stream Control Transmission Protocol dissection * Copyright 2000, Michael Tüxen * - * $Id: packet-sctp.c,v 1.2 2000/07/31 04:12:04 guy Exp $ + * $Id: packet-sctp.c,v 1.3 2000/08/07 03:21:09 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -959,7 +959,7 @@ dissect_error_cause(tvbuff_t *cause_tvb, proto_tree *chunk_tree) * Code to actually dissect the packets */ -void +static void dissect_data_chunk(tvbuff_t *chunk_tvb, proto_tree *chunk_tree, proto_item *chunk_item, proto_item *flags_item) { @@ -1479,18 +1479,9 @@ dissect_sctp_chunks(tvbuff_t *tvb, proto_tree *sctp_tree) * For the handling of the chunks dissect_sctp_chunks is called. */ -#if 0 static void dissect_sctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { -#else -static void -dissect_sctp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) -{ - tvbuff_t *tvb = tvb_create_from_top(offset); - packet_info *pinfo = π -#endif - guint16 source_port, destination_port; guint32 verification_tag, checksum; proto_item *ti; @@ -1505,12 +1496,12 @@ dissect_sctp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) checksum = tvb_get_ntohl(tvb, CHECKSUM_OFFSET); /* make entry in the Protocol column on summary display */ - if (check_col(fd, COL_PROTOCOL)) - col_add_str(fd, COL_PROTOCOL, "SCTP"); + if (check_col(pinfo->fd, COL_PROTOCOL)) + col_add_str(pinfo->fd, COL_PROTOCOL, "SCTP"); /* Make entries in Info column on summary display */ - if (check_col(fd, COL_INFO)) - col_add_fstr(fd, COL_INFO, "%u > %u: tag 0x%x", + if (check_col(pinfo->fd, COL_INFO)) + col_add_fstr(pinfo->fd, COL_INFO, "%u > %u: tag 0x%x", source_port, destination_port, verification_tag); /* In the interest of speed, if "tree" is NULL, don't do any work not diff --git a/packet-sna.c b/packet-sna.c index 4baf87f603..dd3a35f326 100644 --- a/packet-sna.c +++ b/packet-sna.c @@ -2,7 +2,7 @@ * Routines for SNA * Gilbert Ramirez * - * $Id: packet-sna.c,v 1.16 2000/05/31 05:07:44 guy Exp $ + * $Id: packet-sna.c,v 1.17 2000/08/07 03:21:10 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -364,7 +364,7 @@ dissect_sna(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { th_header_len = dissect_fidf(pd, offset, fd, th_tree); break; default: - dissect_data(pd, offset+1, fd, tree); + old_dissect_data(pd, offset+1, fd, tree); } sna_header_len += th_header_len; @@ -397,7 +397,7 @@ dissect_sna(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { } if (IS_DATA_IN_FRAME(offset+1)) { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } } @@ -1206,5 +1206,5 @@ proto_register_sna(void) void proto_reg_handoff_sna(void) { - dissector_add("llc.dsap", SAP_SNA_PATHCTRL, dissect_sna); + old_dissector_add("llc.dsap", SAP_SNA_PATHCTRL, dissect_sna); } diff --git a/packet-snmp.c b/packet-snmp.c index 22885d8781..502cf649ba 100644 --- a/packet-snmp.c +++ b/packet-snmp.c @@ -2,7 +2,7 @@ * Routines for SNMP (simple network management protocol) * D.Jorand (c) 1998 * - * $Id: packet-snmp.c,v 1.45 2000/07/25 17:30:47 guy Exp $ + * $Id: packet-snmp.c,v 1.46 2000/08/07 03:21:11 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -548,7 +548,7 @@ dissect_snmp_parse_error(const u_char *pd, int offset, frame_data *fd, "ERROR: Couldn't parse %s: %s", field_name, errstr); } - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } static void @@ -558,7 +558,7 @@ dissect_snmp_error(const u_char *pd, int offset, frame_data *fd, if (check_col(fd, COL_INFO)) col_add_str(fd, COL_INFO, message); - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } static gchar * @@ -2035,10 +2035,10 @@ proto_register_snmp(void) void proto_reg_handoff_snmp(void) { - dissector_add("udp.port", UDP_PORT_SNMP, dissect_snmp); - dissector_add("udp.port", UDP_PORT_SNMP_TRAP, dissect_snmp); - dissector_add("tcp.port", TCP_PORT_SMUX, dissect_smux); - dissector_add("ethertype", ETHERTYPE_SNMP, dissect_snmp); - dissector_add("ipx.socket", IPX_SOCKET_SNMP_AGENT, dissect_snmp); - dissector_add("ipx.socket", IPX_SOCKET_SNMP_SINK, dissect_snmp); + old_dissector_add("udp.port", UDP_PORT_SNMP, dissect_snmp); + old_dissector_add("udp.port", UDP_PORT_SNMP_TRAP, dissect_snmp); + old_dissector_add("tcp.port", TCP_PORT_SMUX, dissect_smux); + old_dissector_add("ethertype", ETHERTYPE_SNMP, dissect_snmp); + old_dissector_add("ipx.socket", IPX_SOCKET_SNMP_AGENT, dissect_snmp); + old_dissector_add("ipx.socket", IPX_SOCKET_SNMP_SINK, dissect_snmp); } diff --git a/packet-socks.c b/packet-socks.c index aae33c7c96..11df2e982c 100644 --- a/packet-socks.c +++ b/packet-socks.c @@ -2,7 +2,7 @@ * Routines for socks versions 4 &5 packet dissection * Copyright 2000, Jeffrey C. Foster * - * $Id: packet-socks.c,v 1.7 2000/08/06 10:04:15 guy Exp $ + * $Id: packet-socks.c,v 1.8 2000/08/07 03:21:12 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -438,7 +438,8 @@ void new_udp_conversation( socks_hash_entry_t *hash_info){ g_assert( conversation); - conversation->dissector = socks_udp_dissector; + conversation->is_old_dissector = TRUE; + conversation->dissector.old = socks_udp_dissector; } @@ -1150,5 +1151,5 @@ proto_reg_handoff_socks(void) { /* dissector install routine */ - dissector_add("tcp.port", TCP_PORT_SOCKS, dissect_socks); + old_dissector_add("tcp.port", TCP_PORT_SOCKS, dissect_socks); } diff --git a/packet-srvloc.c b/packet-srvloc.c index e7d0e3d5cb..79ee7590e2 100644 --- a/packet-srvloc.c +++ b/packet-srvloc.c @@ -6,7 +6,7 @@ * In particular I have not had an opportunity to see how it * responds to SRVLOC over TCP. * - * $Id: packet-srvloc.c,v 1.11 2000/08/04 22:56:18 guy Exp $ + * $Id: packet-srvloc.c,v 1.12 2000/08/07 03:21:13 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -532,7 +532,7 @@ proto_register_srvloc(void) void proto_reg_handoff_srvloc(void) { - dissector_add("tcp.port", TCP_PORT_SRVLOC, dissect_srvloc); - dissector_add("udp.port", UDP_PORT_SRVLOC, dissect_srvloc); + old_dissector_add("tcp.port", TCP_PORT_SRVLOC, dissect_srvloc); + old_dissector_add("udp.port", UDP_PORT_SRVLOC, dissect_srvloc); } diff --git a/packet-sscop.c b/packet-sscop.c index 100a1e8d0d..6d39b6b4e6 100644 --- a/packet-sscop.c +++ b/packet-sscop.c @@ -2,7 +2,7 @@ * Routines for SSCOP (Q.2110, Q.SAAL) frame disassembly * Guy Harris * - * $Id: packet-sscop.c,v 1.8 2000/05/29 08:57:40 guy Exp $ + * $Id: packet-sscop.c,v 1.9 2000/08/07 03:21:13 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -308,7 +308,7 @@ dissect_sscop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (pdu_type == SSCOP_SD) dissect_q2931(next_tvb, pinfo, tree); else - dissect_data_tvb(next_tvb, pinfo, tree); + dissect_data(next_tvb, pinfo, tree); } break; } diff --git a/packet-syslog.c b/packet-syslog.c index d04530b181..1935d2a997 100644 --- a/packet-syslog.c +++ b/packet-syslog.c @@ -3,7 +3,7 @@ * * Copyright 2000, Gerald Combs * - * $Id: packet-syslog.c,v 1.4 2000/06/18 22:12:14 gerald Exp $ + * $Id: packet-syslog.c,v 1.5 2000/08/07 03:21:14 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -136,20 +136,8 @@ static gint ett_syslog = -1; upper five bits are the facility. T is the message text. */ -#if 0 static void dissect_syslog(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - gint pri = -1, lev, fac; - gint msg_off = 0, msg_len; - gint ellipsis_len = (COL_INFO_LEN - strlen(ELLIPSIS)) - 1; - proto_item *ti; - proto_tree *syslog_tree; - gchar msg_str[COL_INFO_LEN]; -#else -static void dissect_syslog(const u_char *pd, int o, frame_data *fd, proto_tree *tree) -{ - packet_info *pinfo = π - tvbuff_t *tvb = tvb_create_from_top(o); gint pri = -1, lev = -1, fac = -1; gint msg_off = 0, msg_len; gint ellipsis_len = (COL_INFO_LEN - strlen(ELLIPSIS)) - 1; @@ -157,8 +145,6 @@ static void dissect_syslog(const u_char *pd, int o, frame_data *fd, proto_tree * proto_tree *syslog_tree; gchar msg_str[COL_INFO_LEN]; -#endif - pinfo->current_proto = "Syslog"; msg_len = tvb_length(tvb); diff --git a/packet-tacacs.c b/packet-tacacs.c index a748cb19eb..0b13adecaf 100644 --- a/packet-tacacs.c +++ b/packet-tacacs.c @@ -1,7 +1,7 @@ /* packet-tacacs.c * Routines for cisco tacacs/tacplus/AAA packet dissection * - * $Id: packet-tacacs.c,v 1.5 2000/05/31 05:07:49 guy Exp $ + * $Id: packet-tacacs.c,v 1.6 2000/08/07 03:21:15 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -157,6 +157,6 @@ proto_register_tacacs(void) void proto_reg_handoff_tacacs(void) { - dissector_add("udp.port", UDP_PORT_TACACS, dissect_tacacs); - dissector_add("tcp.port", TCP_PORT_TACACS, dissect_tacplus); + old_dissector_add("udp.port", UDP_PORT_TACACS, dissect_tacacs); + old_dissector_add("tcp.port", TCP_PORT_TACACS, dissect_tacplus); } diff --git a/packet-tcp.c b/packet-tcp.c index 863367bf92..1cfd0ab604 100644 --- a/packet-tcp.c +++ b/packet-tcp.c @@ -1,7 +1,7 @@ /* packet-tcp.c * Routines for TCP packet disassembly * - * $Id: packet-tcp.c,v 1.78 2000/07/30 08:20:52 guy Exp $ + * $Id: packet-tcp.c,v 1.79 2000/08/07 03:21:15 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -362,19 +362,15 @@ static const true_false_string flags_set_truth = { /* can call to it, ie. socks */ void -decode_tcp_ports( const u_char *pd, int offset, frame_data *fd, proto_tree *tree, - int src_port, int dst_port) { - dissector_t sub_dissector; - +decode_tcp_ports(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, + int src_port, int dst_port) +{ /* determine if this packet is part of a conversation and call dissector */ /* for the conversation if available */ - sub_dissector = find_conversation_dissector( &pi.src, &pi.dst, PT_TCP, - src_port, dst_port); - if (sub_dissector){ - (sub_dissector)(pd, offset, fd, tree); + if (old_try_conversation_dissector(&pi.src, &pi.dst, PT_TCP, + src_port, dst_port, pd, offset, fd, tree)) return; - } /* try to apply the plugins */ #ifdef HAVE_PLUGINS @@ -395,16 +391,16 @@ decode_tcp_ports( const u_char *pd, int offset, frame_data *fd, proto_tree *tree #endif /* do lookup with the subdissector table */ - if (dissector_try_port(subdissector_table, src_port, pd, offset, fd, tree) || - dissector_try_port(subdissector_table, dst_port, pd, offset, fd, tree)) + if (old_dissector_try_port(subdissector_table, src_port, pd, offset, fd, tree) || + old_dissector_try_port(subdissector_table, dst_port, pd, offset, fd, tree)) return; /* do lookup with the heuristic subdissector table */ - if (dissector_try_heuristic(heur_subdissector_list, pd, offset, fd, tree)) + if (old_dissector_try_heuristic(heur_subdissector_list, pd, offset, fd, tree)) return; /* Oh, well, we don't know this; dissect it as data. */ - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } @@ -662,5 +658,5 @@ proto_register_tcp(void) void proto_reg_handoff_tcp(void) { - dissector_add("ip.proto", IP_PROTO_TCP, dissect_tcp); + old_dissector_add("ip.proto", IP_PROTO_TCP, dissect_tcp); } diff --git a/packet-telnet.c b/packet-telnet.c index c78b55d5b2..7f07e45a95 100644 --- a/packet-telnet.c +++ b/packet-telnet.c @@ -2,7 +2,7 @@ * Routines for telnet packet dissection * Copyright 1999, Richard Sharpe * - * $Id: packet-telnet.c,v 1.13 2000/05/31 05:07:50 guy Exp $ + * $Id: packet-telnet.c,v 1.14 2000/08/07 03:21:16 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -373,5 +373,5 @@ proto_register_telnet(void) void proto_reg_handoff_telnet(void) { - dissector_add("tcp.port", TCP_PORT_TELNET, dissect_telnet); + old_dissector_add("tcp.port", TCP_PORT_TELNET, dissect_telnet); } diff --git a/packet-time.c b/packet-time.c index 801c160e9e..f8e1c3348a 100644 --- a/packet-time.c +++ b/packet-time.c @@ -5,7 +5,7 @@ * Craig Newell * RFC2347 TIME Option Extension * - * $Id: packet-time.c,v 1.6 2000/05/31 05:07:50 guy Exp $ + * $Id: packet-time.c,v 1.7 2000/08/07 03:21:17 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -92,5 +92,5 @@ proto_register_time(void) void proto_reg_handoff_time(void) { - dissector_add("udp.port", UDP_PORT_TIME, dissect_time); + old_dissector_add("udp.port", UDP_PORT_TIME, dissect_time); } diff --git a/packet-tns.c b/packet-tns.c index 244e542b19..e90b8f3c69 100644 --- a/packet-tns.c +++ b/packet-tns.c @@ -1,7 +1,7 @@ /* packet-tns.c * Routines for MSX tns packet dissection * - * $Id: packet-tns.c,v 1.7 2000/05/31 05:07:50 guy Exp $ + * $Id: packet-tns.c,v 1.8 2000/08/07 03:21:17 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -76,7 +76,7 @@ static const value_string tns_type_vals[] = { /* Handy macro for checking for truncated packet */ #define TRUNC(length) if ( ! BYTES_ARE_IN_FRAME(offset, length)) { \ - dissect_data(pd,offset,fd,tree); return; } + old_dissect_data(pd,offset,fd,tree); return; } static void dissect_tns_sns(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, proto_tree *tns_tree) @@ -98,7 +98,7 @@ static void dissect_tns_sns(const u_char *pd, int offset, frame_data *fd, if ( sns_tree ) { - dissect_data(pd,offset,fd,sns_tree); + old_dissect_data(pd,offset,fd,sns_tree); } } @@ -124,7 +124,7 @@ static void dissect_tns_data(const u_char *pd, int offset, frame_data *fd, } } - dissect_data(pd,offset,fd,tree); + old_dissect_data(pd,offset,fd,tree); return; } @@ -173,7 +173,7 @@ static void dissect_tns_connect(const u_char *pd, int offset, frame_data *fd, if ( connect_tree ) { - dissect_data(pd,offset,fd,connect_tree); + old_dissect_data(pd,offset,fd,connect_tree); } return; } @@ -181,7 +181,7 @@ static void dissect_tns_connect(const u_char *pd, int offset, frame_data *fd, static void dissect_tns_accept(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, proto_tree *tns_tree) { - dissect_data(pd,offset,fd,tns_tree); + old_dissect_data(pd,offset,fd,tns_tree); return; } @@ -286,7 +286,7 @@ dissect_tns(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) dissect_tns_data(pd,offset,fd,tree,tns_tree); break; default: - dissect_data(pd,offset,fd,tns_tree); + old_dissect_data(pd,offset,fd,tns_tree); } } @@ -349,5 +349,5 @@ void proto_register_tns(void) void proto_reg_handoff_tns(void) { - dissector_add("tcp.port", TCP_PORT_TNS, dissect_tns); + old_dissector_add("tcp.port", TCP_PORT_TNS, dissect_tns); } diff --git a/packet-tr.c b/packet-tr.c index c6ff509986..2dc54bd2e7 100644 --- a/packet-tr.c +++ b/packet-tr.c @@ -2,7 +2,7 @@ * Routines for Token-Ring packet disassembly * Gilbert Ramirez * - * $Id: packet-tr.c,v 1.44 2000/06/20 03:05:35 gram Exp $ + * $Id: packet-tr.c,v 1.45 2000/08/07 03:21:17 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -528,7 +528,7 @@ dissect_tr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; default: /* non-MAC, non-LLC, i.e., "Reserved" */ - dissect_data_tvb(next_tvb, pinfo, tree); + dissect_data(next_tvb, pinfo, tree); break; } } diff --git a/packet-udp.c b/packet-udp.c index 12094266ae..2ddbe16155 100644 --- a/packet-udp.c +++ b/packet-udp.c @@ -1,7 +1,7 @@ /* packet-udp.c * Routines for UDP packet disassembly * - * $Id: packet-udp.c,v 1.73 2000/07/14 12:53:00 girlich Exp $ + * $Id: packet-udp.c,v 1.74 2000/08/07 03:21:18 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -83,19 +83,15 @@ static heur_dissector_list_t heur_subdissector_list; /* can call to it, ie. socks */ void -decode_udp_ports( const u_char *pd, int offset, frame_data *fd, - proto_tree *tree, int uh_sport, int uh_dport){ - dissector_t sub_dissector; - +decode_udp_ports(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, + int uh_sport, int uh_dport) +{ /* determine if this packet is part of a conversation and call dissector */ /* for the conversation if available */ - sub_dissector = find_conversation_dissector( &pi.src, &pi.dst, PT_UDP, - uh_sport, uh_dport); - if (sub_dissector){ - (sub_dissector)(pd, offset, fd, tree); + if (old_try_conversation_dissector(&pi.src, &pi.dst, PT_UDP, + uh_sport, uh_dport, pd, offset, fd, tree)) return; - } /* try to apply the plugins */ #ifdef HAVE_PLUGINS @@ -116,12 +112,12 @@ decode_udp_ports( const u_char *pd, int offset, frame_data *fd, #endif /* do lookup with the subdissector table */ - if (dissector_try_port(udp_dissector_table, uh_sport, pd, offset, fd, tree) || - dissector_try_port(udp_dissector_table, uh_dport, pd, offset, fd, tree)) + if (old_dissector_try_port(udp_dissector_table, uh_sport, pd, offset, fd, tree) || + old_dissector_try_port(udp_dissector_table, uh_dport, pd, offset, fd, tree)) return; /* do lookup with the heuristic subdissector table */ - if (dissector_try_heuristic(heur_subdissector_list, pd, offset, fd, tree)) + if (old_dissector_try_heuristic(heur_subdissector_list, pd, offset, fd, tree)) return; /* XXX - we should do these with the subdissector table as well. */ @@ -131,10 +127,10 @@ decode_udp_ports( const u_char *pd, int offset, frame_data *fd, dissect_vines_frp(pd, offset, fd, tree); } else if (PORT_IS(UDP_PORT_TFTP)) { /* This is the first point of call, but it adds a dynamic call */ - dissector_add("udp.port", MAX(uh_sport, uh_dport), dissect_tftp); /* Add to table */ + old_dissector_add("udp.port", MAX(uh_sport, uh_dport), dissect_tftp); /* Add to table */ dissect_tftp(pd, offset, fd, tree); } else - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } @@ -146,7 +142,7 @@ dissect_udp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { proto_item *ti; if (!BYTES_ARE_IN_FRAME(offset, sizeof(e_udphdr))) { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return; } @@ -232,5 +228,5 @@ proto_register_udp(void) void proto_reg_handoff_udp(void) { - dissector_add("ip.proto", IP_PROTO_UDP, dissect_udp); + old_dissector_add("ip.proto", IP_PROTO_UDP, dissect_udp); } diff --git a/packet-v120.c b/packet-v120.c index b6134411a1..5953324766 100644 --- a/packet-v120.c +++ b/packet-v120.c @@ -2,7 +2,7 @@ * Routines for v120 frame disassembly * Bert Driehuis * - * $Id: packet-v120.c,v 1.10 2000/08/06 07:22:38 guy Exp $ + * $Id: packet-v120.c,v 1.11 2000/08/07 03:21:18 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -143,7 +143,7 @@ dissect_v120(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) v120len += dissect_v120_header(tvb, v120len, pinfo, v120_tree); proto_item_set_len(ti, v120len); next_tvb = tvb_new_subset(tvb, v120len, -1, -1); - dissect_data_tvb(next_tvb, pinfo, v120_tree); + dissect_data(next_tvb, pinfo, v120_tree); } } diff --git a/packet-vines.c b/packet-vines.c index daa89958da..23889a993f 100644 --- a/packet-vines.c +++ b/packet-vines.c @@ -1,7 +1,7 @@ /* packet-vines.c * Routines for Banyan VINES protocol packet disassembly * - * $Id: packet-vines.c,v 1.16 2000/05/11 08:15:54 gram Exp $ + * $Id: packet-vines.c,v 1.17 2000/08/07 03:21:18 guy Exp $ * * Don Lafontaine * @@ -249,7 +249,7 @@ dissect_vines(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) dissect_vines_spp(pd, offset, fd, tree); break; default: - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); break; } } @@ -335,7 +335,7 @@ void dissect_vines_spp(const u_char *pd, int offset, frame_data *fd, proto_tree proto_tree_add_text(vspp_tree, NullTVB, offset+14, 2, "Window: 0x%04x", viph.vspp_win); } offset += 16; /* sizeof SPP */ - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } void @@ -353,7 +353,7 @@ proto_register_vines(void) void proto_reg_handoff_vines(void) { - dissector_add("ethertype", ETHERTYPE_VINES, dissect_vines); - dissector_add("ppp.protocol", PPP_VINES, dissect_vines); - dissector_add("ip.proto", IP_PROTO_VINES, dissect_vines_frp); + old_dissector_add("ethertype", ETHERTYPE_VINES, dissect_vines); + old_dissector_add("ppp.protocol", PPP_VINES, dissect_vines); + old_dissector_add("ip.proto", IP_PROTO_VINES, dissect_vines_frp); } diff --git a/packet-vlan.c b/packet-vlan.c index 9b3f5c0fbd..2f47436b5b 100644 --- a/packet-vlan.c +++ b/packet-vlan.c @@ -1,7 +1,7 @@ /* packet-vlan.c * Routines for VLAN 802.1Q ethernet header disassembly * - * $Id: packet-vlan.c,v 1.17 2000/06/15 03:48:43 gram Exp $ + * $Id: packet-vlan.c,v 1.18 2000/08/07 03:21:19 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -101,8 +101,8 @@ dissect_vlan(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { next_tvb = tvb_create_from_top(offset+4); /* XXX - should TRY() like dissect_eth() */ if ( encap_proto <= IEEE_802_3_MAX_LEN) { if ( pd[offset+4] == 0xff && pd[offset+5] == 0xff ) { - dissect_ipx(pd,offset+4,fd,tree); - } else { + dissect_ipx(next_tvb, &pi, tree); + } else { dissect_llc(next_tvb, &pi, tree); } } else { @@ -139,5 +139,5 @@ proto_register_vlan(void) void proto_reg_handoff_vlan(void) { - dissector_add("ethertype", ETHERTYPE_VLAN, dissect_vlan); + old_dissector_add("ethertype", ETHERTYPE_VLAN, dissect_vlan); } diff --git a/packet-vrrp.c b/packet-vrrp.c index 7b2f955489..3d23add2b5 100644 --- a/packet-vrrp.c +++ b/packet-vrrp.c @@ -4,7 +4,7 @@ * * Heikki Vatiainen * - * $Id: packet-vrrp.c,v 1.6 2000/05/31 05:07:53 guy Exp $ + * $Id: packet-vrrp.c,v 1.7 2000/08/07 03:21:19 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -128,7 +128,7 @@ dissect_vrrp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) guint8 ip_count, auth_len, auth_buf[VRRP_AUTH_DATA_LEN+1]; if (short_hdr) { - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); return; } @@ -156,7 +156,7 @@ dissect_vrrp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) offset+=2; if (short_packet) { - dissect_data(pd, offset, fd, vrrp_tree); + old_dissect_data(pd, offset, fd, vrrp_tree); return; } @@ -217,5 +217,5 @@ void proto_register_vrrp(void) void proto_reg_handoff_vrrp(void) { - dissector_add("ip.proto", IP_PROTO_VRRP, dissect_vrrp); + old_dissector_add("ip.proto", IP_PROTO_VRRP, dissect_vrrp); } diff --git a/packet-wccp.c b/packet-wccp.c index 87583163b1..8c173d209a 100644 --- a/packet-wccp.c +++ b/packet-wccp.c @@ -2,7 +2,7 @@ * Routines for Web Cache Coordination Protocol dissection * Jerry Talkington * - * $Id: packet-wccp.c,v 1.8 2000/05/31 05:07:54 guy Exp $ + * $Id: packet-wccp.c,v 1.9 2000/08/07 03:21:19 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -195,7 +195,7 @@ dissect_wccp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) proto_tree_add_uint(wccp_tree, hf_wccp_version, NullTVB, offset, 4, wccp_version); offset += 4; - dissect_data(pd, offset, fd, wccp_tree); + old_dissect_data(pd, offset, fd, wccp_tree); break; } } @@ -341,5 +341,5 @@ proto_register_wccp(void) void proto_reg_handoff_wccp(void) { - dissector_add("udp.port", UDP_PORT_WCCP, dissect_wccp); + old_dissector_add("udp.port", UDP_PORT_WCCP, dissect_wccp); } diff --git a/packet-who.c b/packet-who.c index 38df766d87..06b1438878 100644 --- a/packet-who.c +++ b/packet-who.c @@ -2,7 +2,7 @@ * Routines for who protocol (see man rwhod) * Gilbert Ramirez * - * $Id: packet-who.c,v 1.7 2000/05/31 05:07:54 guy Exp $ + * $Id: packet-who.c,v 1.8 2000/08/07 03:21:20 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -299,5 +299,5 @@ proto_register_who(void) void proto_reg_handoff_who(void) { - dissector_add("udp.port", UDP_PORT_WHO, dissect_who); + old_dissector_add("udp.port", UDP_PORT_WHO, dissect_who); } diff --git a/packet-x11.c b/packet-x11.c index 12bea807f1..0d05a8c478 100644 --- a/packet-x11.c +++ b/packet-x11.c @@ -2,7 +2,7 @@ * Routines for X11 dissection * Copyright 2000, Christophe Tronche * - * $Id: packet-x11.c,v 1.9 2000/06/17 03:05:02 guy Exp $ + * $Id: packet-x11.c,v 1.10 2000/08/07 03:21:20 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -2874,7 +2874,7 @@ dissect_x11_request(const u_char *pd, int offset, frame_data *fd, proto_tree *tr little_endian = guess_byte_ordering(tvb); left = dissect_x11_request_loop(x11_tree); if (left) - dissect_data(pd, offset + cur_offset, fd, x11_tree); + old_dissect_data(pd, offset + cur_offset, fd, x11_tree); } static void @@ -2912,7 +2912,7 @@ dissect_x11_event(const u_char *pd, int offset, frame_data *fd, proto_tree *tree /* Code to process the packet goes here */ - dissect_data(pd, offset, fd, tree); + old_dissect_data(pd, offset, fd, tree); } } @@ -2966,7 +2966,7 @@ void proto_register_x11(void) void proto_reg_handoff_x11(void) { - dissector_add("tcp.port", TCP_PORT_X11, dissect_x11); - dissector_add("tcp.port", TCP_PORT_X11_2, dissect_x11); - dissector_add("tcp.port", TCP_PORT_X11_3, dissect_x11); + old_dissector_add("tcp.port", TCP_PORT_X11, dissect_x11); + old_dissector_add("tcp.port", TCP_PORT_X11_2, dissect_x11); + old_dissector_add("tcp.port", TCP_PORT_X11_3, dissect_x11); } diff --git a/packet-x25.c b/packet-x25.c index 0d8fe93df1..eb94c96f81 100644 --- a/packet-x25.c +++ b/packet-x25.c @@ -2,7 +2,7 @@ * Routines for x25 packet disassembly * Olivier Abad * - * $Id: packet-x25.c,v 1.33 2000/07/01 08:55:28 guy Exp $ + * $Id: packet-x25.c,v 1.34 2000/08/07 03:21:23 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -1927,7 +1927,7 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_ip(next_pd, next_offset, pinfo->fd, tree); } else { - dissect_data(next_pd, next_offset, pinfo->fd, tree); + dissect_data(next_tvb, pinfo, tree); } } } diff --git a/packet-yhoo.c b/packet-yhoo.c index 2299985bf8..30fe4a279e 100644 --- a/packet-yhoo.c +++ b/packet-yhoo.c @@ -2,7 +2,7 @@ * Routines for yahoo messenger packet dissection * Copyright 1999, Nathan Neulinger * - * $Id: packet-yhoo.c,v 1.8 2000/05/31 05:07:55 guy Exp $ + * $Id: packet-yhoo.c,v 1.9 2000/08/07 03:21:24 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -220,5 +220,5 @@ proto_register_yhoo(void) void proto_reg_handoff_yhoo(void) { - heur_dissector_add("tcp", dissect_yhoo); + old_heur_dissector_add("tcp", dissect_yhoo); } diff --git a/packet.c b/packet.c index bcc5a71162..a7084e925c 100644 --- a/packet.c +++ b/packet.c @@ -1,7 +1,7 @@ /* packet.c * Routines for packet disassembly * - * $Id: packet.c,v 1.96 2000/07/08 10:46:21 gram Exp $ + * $Id: packet.c,v 1.97 2000/08/07 03:21:24 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -1345,6 +1345,23 @@ proto_register_frame(void) static GHashTable *dissector_tables = NULL; +/* + * XXX - for now, we support having both "old" dissectors, with packet + * data pointer, packet offset, frame_data pointer, and protocol tree + * pointer arguments, and "new" dissectors, with tvbuff pointer, + * packet_info pointer, and protocol tree pointer arguments. + * + * Nuke this and go back to storing a pointer to the dissector when + * the last old-style dissector is gone. + */ +typedef struct { + gboolean is_old_dissector; + union { + old_dissector_t old; + dissector_t new; + } dissector; +} dtbl_entry_t; + /* Finds a dissector table by field name. */ static dissector_table_t find_dissector_table(const char *name) @@ -1353,27 +1370,42 @@ find_dissector_table(const char *name) return g_hash_table_lookup( dissector_tables, name ); } -/* lookup a dissector based upon pattern. */ -dissector_t -dissector_lookup( dissector_table_t table, guint32 pattern) -{ - return g_hash_table_lookup( table, GUINT_TO_POINTER( pattern)); -} - - /* add an entry, lookup the dissector table for the specified field name, */ /* if a valid table found, add the subdissector */ void -dissector_add(const char *name, guint32 pattern, dissector_t dissector) +old_dissector_add(const char *name, guint32 pattern, old_dissector_t dissector) { dissector_table_t sub_dissectors = find_dissector_table( name); + dtbl_entry_t *dtbl_entry; /* sanity check */ g_assert( sub_dissectors); + dtbl_entry = g_malloc(sizeof (dtbl_entry_t)); + dtbl_entry->is_old_dissector = TRUE; + dtbl_entry->dissector.old = dissector; + /* do the table insertion */ g_hash_table_insert( sub_dissectors, GUINT_TO_POINTER( pattern), - (gpointer)dissector); + (gpointer)dtbl_entry); +} + +void +dissector_add(const char *name, guint32 pattern, dissector_t dissector) +{ + dissector_table_t sub_dissectors = find_dissector_table( name); + dtbl_entry_t *dtbl_entry; + +/* sanity check */ + g_assert( sub_dissectors); + + dtbl_entry = g_malloc(sizeof (dtbl_entry_t)); + dtbl_entry->is_old_dissector = FALSE; + dtbl_entry->dissector.new = dissector; + +/* do the table insertion */ + g_hash_table_insert( sub_dissectors, GUINT_TO_POINTER( pattern), + (gpointer)dtbl_entry); } /* delete the entry for this dissector at this pattern */ @@ -1384,30 +1416,120 @@ dissector_add(const char *name, guint32 pattern, dissector_t dissector) /* If temporary dissectors are deleted, then the original dissector must */ /* be available. */ void -dissector_delete(const char *name, guint32 pattern, dissector_t dissector) +old_dissector_delete(const char *name, guint32 pattern, old_dissector_t dissector) { dissector_table_t sub_dissectors = find_dissector_table( name); + dtbl_entry_t *dtbl_entry; /* sanity check */ g_assert( sub_dissectors); -/* remove the hash table entry */ - g_hash_table_remove( sub_dissectors, GUINT_TO_POINTER( pattern)); + /* + * Find the entry. + */ + dtbl_entry = g_hash_table_lookup(sub_dissectors, + GUINT_TO_POINTER(pattern)); + + if (dtbl_entry != NULL) { + /* + * Found - remove it. + */ + g_hash_table_remove(sub_dissectors, GUINT_TO_POINTER(pattern)); + + /* + * Now free up the entry. + */ + g_free(dtbl_entry); + } +} + +void +dissector_delete(const char *name, guint32 pattern, dissector_t dissector) +{ + dissector_table_t sub_dissectors = find_dissector_table( name); + dtbl_entry_t *dtbl_entry; + +/* sanity check */ + g_assert( sub_dissectors); + + /* + * Find the entry. + */ + dtbl_entry = g_hash_table_lookup(sub_dissectors, + GUINT_TO_POINTER(pattern)); + + if (dtbl_entry != NULL) { + /* + * Found - remove it. + */ + g_hash_table_remove(sub_dissectors, GUINT_TO_POINTER(pattern)); + + /* + * Now free up the entry. + */ + g_free(dtbl_entry); + } } /* Look for a given port in a given dissector table and, if found, call the dissector with the arguments supplied, and return TRUE, otherwise - return FALSE. */ + return FALSE. + + If the arguments supplied don't match the arguments to the dissector, + do the appropriate translation. */ gboolean -dissector_try_port(dissector_table_t sub_dissectors, guint32 port, +old_dissector_try_port(dissector_table_t sub_dissectors, guint32 port, const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { - dissector_t subdissector; + dtbl_entry_t *dtbl_entry; + tvbuff_t *tvb; - subdissector = dissector_lookup(sub_dissectors, port); - if (subdissector != NULL) { + dtbl_entry = g_hash_table_lookup(sub_dissectors, + GUINT_TO_POINTER(port)); + if (dtbl_entry != NULL) { pi.match_port = port; - (subdissector)(pd, offset, fd, tree); + if (dtbl_entry->is_old_dissector) + (*dtbl_entry->dissector.old)(pd, offset, fd, tree); + else { + /* + * Old dissector calling new dissector; use + * "tvb_create_from_top()" to remap. + * + * XXX - what about the "pd" argument? Do + * any dissectors not just pass that along and + * let the "offset" argument handle stepping + * through the packet? + */ + tvb = tvb_create_from_top(offset); + (*dtbl_entry->dissector.new)(tvb, &pi, tree); + } + return TRUE; + } else + return FALSE; +} + +gboolean +dissector_try_port(dissector_table_t sub_dissectors, guint32 port, + tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + dtbl_entry_t *dtbl_entry; + const guint8 *pd; + int offset; + + dtbl_entry = g_hash_table_lookup(sub_dissectors, + GUINT_TO_POINTER(port)); + if (dtbl_entry != NULL) { + pi.match_port = port; + if (dtbl_entry->is_old_dissector) { + /* + * New dissector calling old dissector; use + * "tvb_compat()" to remap. + */ + tvb_compat(tvb, &pd, &offset); + (*dtbl_entry->dissector.old)(pd, offset, pinfo->fd, + tree); + } else + (*dtbl_entry->dissector.new)(tvb, pinfo, tree); return TRUE; } else return FALSE; @@ -1436,6 +1558,23 @@ register_dissector_table(const char *name) static GHashTable *heur_dissector_lists = NULL; +/* + * XXX - for now, we support having both "old" dissectors, with packet + * data pointer, packet offset, frame_data pointer, and protocol tree + * pointer arguments, and "new" dissectors, with tvbuff pointer, + * packet_info pointer, and protocol tree pointer arguments. + * + * Nuke this and go back to storing a pointer to the dissector when + * the last old-style dissector is gone. + */ +typedef struct { + gboolean is_old_dissector; + union { + old_heur_dissector_t old; + heur_dissector_t new; + } dissector; +} heur_dtbl_entry_t; + /* Finds a heuristic dissector table by field name. */ static heur_dissector_list_t * find_heur_dissector_list(const char *name) @@ -1445,28 +1584,96 @@ find_heur_dissector_list(const char *name) } void -heur_dissector_add(const char *name, heur_dissector_t dissector) +old_heur_dissector_add(const char *name, old_heur_dissector_t dissector) { heur_dissector_list_t *sub_dissectors = find_heur_dissector_list(name); + heur_dtbl_entry_t *dtbl_entry; /* sanity check */ g_assert(sub_dissectors != NULL); + dtbl_entry = g_malloc(sizeof (heur_dtbl_entry_t)); + dtbl_entry->is_old_dissector = TRUE; + dtbl_entry->dissector.old = dissector; + /* do the table insertion */ - *sub_dissectors = g_slist_append(*sub_dissectors, (gpointer)dissector); + *sub_dissectors = g_slist_append(*sub_dissectors, (gpointer)dtbl_entry); +} + +void +heur_dissector_add(const char *name, heur_dissector_t dissector) +{ + heur_dissector_list_t *sub_dissectors = find_heur_dissector_list(name); + heur_dtbl_entry_t *dtbl_entry; + + /* sanity check */ + g_assert(sub_dissectors != NULL); + + dtbl_entry = g_malloc(sizeof (heur_dtbl_entry_t)); + dtbl_entry->is_old_dissector = FALSE; + dtbl_entry->dissector.new = dissector; + + /* do the table insertion */ + *sub_dissectors = g_slist_append(*sub_dissectors, (gpointer)dtbl_entry); +} + +gboolean +old_dissector_try_heuristic(heur_dissector_list_t sub_dissectors, + const u_char *pd, int offset, frame_data *fd, proto_tree *tree) +{ + GSList *entry; + heur_dtbl_entry_t *dtbl_entry; + tvbuff_t *tvb = NULL; + + for (entry = sub_dissectors; entry != NULL; entry = g_slist_next(entry)) { + dtbl_entry = (heur_dtbl_entry_t *)entry->data; + if (dtbl_entry->is_old_dissector) { + if ((*dtbl_entry->dissector.old)(pd, offset, fd, tree)) + return TRUE; + } else { + /* + * Old dissector calling new dissector; use + * "tvb_create_from_top()" to remap. + * + * XXX - what about the "pd" argument? Do + * any dissectors not just pass that along and + * let the "offset" argument handle stepping + * through the packet? + */ + if (tvb == NULL) + tvb = tvb_create_from_top(offset); + if ((*dtbl_entry->dissector.new)(tvb, &pi, tree)) + return TRUE; + } + } + return FALSE; } gboolean dissector_try_heuristic(heur_dissector_list_t sub_dissectors, - const u_char *pd, int offset, frame_data *fd, proto_tree *tree) + tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - heur_dissector_t subdissector; GSList *entry; + heur_dtbl_entry_t *dtbl_entry; + const guint8 *pd = NULL; + int offset; for (entry = sub_dissectors; entry != NULL; entry = g_slist_next(entry)) { - subdissector = (heur_dissector_t)entry->data; - if ((subdissector)(pd, offset, fd, tree)) - return TRUE; + dtbl_entry = (heur_dtbl_entry_t *)entry->data; + if (dtbl_entry->is_old_dissector) { + /* + * New dissector calling old dissector; use + * "tvb_compat()" to remap. + */ + if (pd == NULL) + tvb_compat(tvb, &pd, &offset); + if ((*dtbl_entry->dissector.old)(pd, offset, pinfo->fd, + tree)) + return TRUE; + } else { + if ((*dtbl_entry->dissector.new)(tvb, pinfo, tree)) + return TRUE; + } } return FALSE; } diff --git a/packet.h b/packet.h index 0159eed182..84f358c9f5 100644 --- a/packet.h +++ b/packet.h @@ -1,7 +1,7 @@ /* packet.h * Definitions for packet disassembly structures and routines * - * $Id: packet.h,v 1.190 2000/07/08 10:46:23 gram Exp $ + * $Id: packet.h,v 1.191 2000/08/07 03:21:25 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -73,7 +73,7 @@ /* Useful when highlighting regions inside a dissect_*() function. With this * macro, you can highlight from an arbitrary offset to the end of the * packet (which may come before the end of the frame). - * See dissect_data() for an example. + * See old_dissect_data() for an example. */ #define END_OF_FRAME (pi.captured_len - offset) @@ -224,27 +224,29 @@ typedef struct true_false_string { typedef GHashTable* dissector_table_t; /* types for sub-dissector lookup */ -typedef void (*dissector_t)(const u_char *, int, frame_data *, proto_tree *); +typedef void (*old_dissector_t)(const u_char *, int, frame_data *, proto_tree *); +typedef void (*dissector_t)(tvbuff_t *, packet_info *, proto_tree *); /* a protocol uses the function to register a sub-dissector table */ dissector_table_t register_dissector_table(const char *name); -/* dissector lookup routine. called by protocol dissector to find a sub-dissector */ -dissector_t dissector_lookup( dissector_table_t table, guint32 pattern); - /* Add a sub-dissector to a dissector table. Called by the protocol routine */ /* that wants to register a sub-dissector. */ +void old_dissector_add(const char *abbrev, guint32 pattern, old_dissector_t dissector); void dissector_add(const char *abbrev, guint32 pattern, dissector_t dissector); /* Add a sub-dissector to a dissector table. Called by the protocol routine */ /* that wants to de-register a sub-dissector. */ +void old_dissector_delete(const char *name, guint32 pattern, old_dissector_t dissector); void dissector_delete(const char *name, guint32 pattern, dissector_t dissector); /* Look for a given port in a given dissector table and, if found, call the dissector with the arguments supplied, and return TRUE, otherwise return FALSE. */ -gboolean dissector_try_port(dissector_table_t sub_dissectors, guint32 port, +gboolean old_dissector_try_port(dissector_table_t sub_dissectors, guint32 port, const u_char *pd, int offset, frame_data *fd, proto_tree *tree); +gboolean dissector_try_port(dissector_table_t sub_dissectors, guint32 port, + tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); /* List of "heuristic" dissectors (which get handed a packet, look at it, and either recognize it as being for their protocol, dissect it, and @@ -253,7 +255,9 @@ gboolean dissector_try_port(dissector_table_t sub_dissectors, guint32 port, typedef GSList *heur_dissector_list_t; /* Type of a heuristic dissector */ -typedef gboolean (*heur_dissector_t)(const u_char *, int, frame_data *, +typedef gboolean (*old_heur_dissector_t)(const u_char *, int, frame_data *, + proto_tree *); +typedef gboolean (*heur_dissector_t)(tvbuff_t *, packet_info *, proto_tree *); /* A protocol uses this function to register a heuristic dissector list */ @@ -261,13 +265,16 @@ void register_heur_dissector_list(const char *name, heur_dissector_list_t *list) /* Add a sub-dissector to a heuristic dissector list. Called by the protocol routine that wants to register a sub-dissector. */ +void old_heur_dissector_add(const char *name, old_heur_dissector_t dissector); void heur_dissector_add(const char *name, heur_dissector_t dissector); /* Try all the dissectors in a given heuristic dissector list until we find one that recognizes the protocol, in which case we return TRUE, or we run out of dissectors, in which case we return FALSE. */ -gboolean dissector_try_heuristic(heur_dissector_list_t sub_dissectors, +gboolean old_dissector_try_heuristic(heur_dissector_list_t sub_dissectors, const u_char *pd, int offset, frame_data *fd, proto_tree *tree); +gboolean dissector_try_heuristic(heur_dissector_list_t sub_dissectors, + tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); /* Many of the structs and definitions below and in packet-*.c files * were taken from include files in the Linux distribution. */ @@ -348,8 +355,8 @@ void init_dissect_rpc(void); */ void dissect_packet(union wtap_pseudo_header *, const u_char *, frame_data *, proto_tree *); -void dissect_data(const u_char *, int, frame_data *, proto_tree *); -void dissect_data_tvb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +void old_dissect_data(const u_char *, int, frame_data *, proto_tree *); +void dissect_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); /* These functions are in ethertype.c */