From 799d6fd057b0c20a7692a1181d811a8ff3a88d04 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Sun, 15 Nov 2015 16:51:45 -0500 Subject: create_dissector_handle -> new_create_dissector_handle Picking off "easy" dissectors that only have one or two exit points at most. Change-Id: I96aa9cf53533cbb07105aa400d42922baf3016b3 Reviewed-on: https://code.wireshark.org/review/11860 Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- epan/dissectors/packet-h221_nonstd.c | 7 +- epan/dissectors/packet-h223.c | 7 +- epan/dissectors/packet-h261.c | 7 +- epan/dissectors/packet-hcrt.c | 5 +- epan/dissectors/packet-hip.c | 34 ++- epan/dissectors/packet-homeplug-av.c | 7 +- epan/dissectors/packet-homeplug.c | 7 +- epan/dissectors/packet-hp-erm.c | 7 +- epan/dissectors/packet-hsr-prp-supervision.c | 7 +- epan/dissectors/packet-hsr.c | 7 +- epan/dissectors/packet-http.c | 14 +- epan/dissectors/packet-i2c.c | 7 +- epan/dissectors/packet-iapp.c | 29 ++- epan/dissectors/packet-icap.c | 8 +- epan/dissectors/packet-icp.c | 20 +- epan/dissectors/packet-idp.c | 17 +- epan/dissectors/packet-iec104.c | 11 +- epan/dissectors/packet-ieee1722.c | 48 ++-- epan/dissectors/packet-ieee17221.c | 9 +- epan/dissectors/packet-ieee1722a.c | 5 +- epan/dissectors/packet-ieee80211-airopeek.c | 15 +- epan/dissectors/packet-ieee80211-prism.c | 43 ++-- epan/dissectors/packet-ieee80211.c | 14 +- epan/dissectors/packet-ieee8021ah.c | 25 +- epan/dissectors/packet-ieee802a.c | 19 +- epan/dissectors/packet-igmp.c | 7 +- epan/dissectors/packet-igrp.c | 8 +- epan/dissectors/packet-infiniband.c | 16 +- epan/dissectors/packet-ipfc.c | 7 +- epan/dissectors/packet-ipnet.c | 7 +- epan/dissectors/packet-ipoib.c | 7 +- epan/dissectors/packet-ipp.c | 85 ++++--- epan/dissectors/packet-ipsec-udp.c | 7 +- epan/dissectors/packet-ipsec.c | 13 +- epan/dissectors/packet-ipsi-ctl.c | 9 +- epan/dissectors/packet-ipvs-syncd.c | 8 +- epan/dissectors/packet-ipxwan.c | 346 +++++++++++++-------------- epan/dissectors/packet-irc.c | 7 +- epan/dissectors/packet-isdn.c | 8 +- epan/dissectors/packet-isi.c | 43 ++-- epan/dissectors/packet-ismacryp.c | 15 +- epan/dissectors/packet-ismp.c | 8 +- epan/dissectors/packet-jpeg.c | 7 +- epan/dissectors/packet-juniper.c | 14 +- epan/dissectors/packet-kdp.c | 8 +- epan/dissectors/packet-kink.c | 7 +- epan/dissectors/packet-kpasswd.c | 7 +- epan/dissectors/packet-l2tp.c | 8 +- epan/dissectors/packet-lacp.c | 7 +- epan/dissectors/packet-lapbether.c | 7 +- epan/dissectors/packet-lbmpdmtcp.c | 9 +- epan/dissectors/packet-lge_monitor.c | 12 +- epan/dissectors/packet-linx.c | 14 +- epan/dissectors/packet-llt.c | 7 +- epan/dissectors/packet-lmi.c | 7 +- epan/dissectors/packet-loop.c | 7 +- epan/dissectors/packet-lpd.c | 8 +- epan/dissectors/packet-lwapp.c | 30 ++- epan/dissectors/packet-lwres.c | 9 +- epan/dissectors/packet-m2tp.c | 7 +- epan/dissectors/packet-m2ua.c | 7 +- epan/dissectors/packet-maap.c | 8 +- epan/dissectors/packet-maccontrol.c | 7 +- epan/dissectors/packet-manolito.c | 7 +- epan/dissectors/packet-marker.c | 7 +- epan/dissectors/packet-mdshdr.c | 7 +- epan/dissectors/packet-megaco.c | 6 +- epan/dissectors/packet-mih.c | 20 +- epan/dissectors/packet-mip6.c | 9 +- epan/dissectors/packet-mmse.c | 18 +- epan/dissectors/packet-mpeg-ca.c | 8 +- epan/dissectors/packet-mpeg-pat.c | 10 +- epan/dissectors/packet-mpeg1.c | 7 +- epan/dissectors/packet-mpls-pm.c | 39 +-- epan/dissectors/packet-mpls-psc.c | 9 +- epan/dissectors/packet-mplstp-oam.c | 20 +- epan/dissectors/packet-mq.c | 7 +- epan/dissectors/packet-mqtt-sn.c | 5 +- epan/dissectors/packet-mrp-mmrp.c | 8 +- epan/dissectors/packet-mrp-msrp.c | 7 +- epan/dissectors/packet-mrp-mvrp.c | 7 +- epan/dissectors/packet-msdp.c | 10 +- epan/dissectors/packet-msn-messenger.c | 7 +- epan/dissectors/packet-msnlb.c | 7 +- epan/dissectors/packet-msproxy.c | 14 +- epan/dissectors/packet-mtp2.c | 8 +- epan/dissectors/packet-nasdaq-soup.c | 9 +- epan/dissectors/packet-nbipx.c | 7 +- epan/dissectors/packet-nbt.c | 15 +- epan/dissectors/packet-ncp.c | 7 +- epan/dissectors/packet-ncs.c | 7 +- epan/dissectors/packet-netanalyzer.c | 14 +- epan/dissectors/packet-netdump.c | 12 +- epan/dissectors/packet-netrom.c | 8 +- epan/dissectors/packet-nettl.c | 9 +- epan/dissectors/packet-nfs.c | 54 +++-- epan/dissectors/packet-nhrp.c | 5 +- epan/dissectors/packet-nlsp.c | 7 +- epan/dissectors/packet-nntp.c | 7 +- epan/dissectors/packet-nsrp.c | 7 +- epan/dissectors/packet-nstrace.c | 8 +- epan/dissectors/packet-ntp.c | 7 +- epan/dissectors/packet-null.c | 14 +- 103 files changed, 855 insertions(+), 766 deletions(-) (limited to 'epan') diff --git a/epan/dissectors/packet-h221_nonstd.c b/epan/dissectors/packet-h221_nonstd.c index 759f2bddf0..2725523b2a 100644 --- a/epan/dissectors/packet-h221_nonstd.c +++ b/epan/dissectors/packet-h221_nonstd.c @@ -51,8 +51,8 @@ const value_string ms_codec_vals[] = { { 0, NULL } }; -static void -dissect_ms_nonstd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) +static int +dissect_ms_nonstd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) { proto_item *it; proto_tree *tr; @@ -96,6 +96,7 @@ dissect_ms_nonstd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) } } + return tvb_captured_length(tvb); } /* Register all the bits needed with the filtering engine */ @@ -131,7 +132,7 @@ proto_reg_handoff_nonstd(void) static dissector_handle_t ms_nonstd_handle; - ms_nonstd_handle = create_dissector_handle(dissect_ms_nonstd, proto_nonstd); + ms_nonstd_handle = new_create_dissector_handle(dissect_ms_nonstd, proto_nonstd); dissector_add_uint("h245.nsp.h221",0xb500534c, ms_nonstd_handle); dissector_add_uint("h225.nsp.h221",0xb500534c, ms_nonstd_handle); diff --git a/epan/dissectors/packet-h223.c b/epan/dissectors/packet-h223.c index 0587c815ff..eea65ba644 100644 --- a/epan/dissectors/packet-h223.c +++ b/epan/dissectors/packet-h223.c @@ -1369,10 +1369,11 @@ dissect_h223_circuit_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v return tvb_captured_length(tvb); } -static void -dissect_h223(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_h223(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { dissect_h223_common(tvb, pinfo, tree, CT_NONE, 0); + return tvb_captured_length(tvb); } /* H.223 specifies that the least-significant bit is transmitted first; @@ -1663,7 +1664,7 @@ void proto_reg_handoff_h223(void) data_handle = find_dissector("data"); srp_handle = find_dissector("srp"); - dissector_add_for_decode_as("tcp.port", create_dissector_handle( dissect_h223, proto_h223)); + dissector_add_for_decode_as("tcp.port", new_create_dissector_handle( dissect_h223, proto_h223)); dissector_add_for_decode_as("tcp.port", h223_bitswapped); dissector_add_string("rtp_dyn_payload_type","CLEARMODE", h223_bitswapped); dissector_add_uint("iax2.dataformat", AST_DATAFORMAT_H223_H245, new_create_dissector_handle(dissect_h223_bitswapped_circuit_data, proto_h223_bitswapped)); diff --git a/epan/dissectors/packet-h261.c b/epan/dissectors/packet-h261.c index 810f3c64cd..62cde4d80e 100644 --- a/epan/dissectors/packet-h261.c +++ b/epan/dissectors/packet-h261.c @@ -56,8 +56,8 @@ static int hf_h261_data = -1; /* H.261 fields defining a sub tree */ static gint ett_h261 = -1; -static void -dissect_h261( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) +static int +dissect_h261( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ ) { proto_item *ti = NULL; proto_tree *h261_tree = NULL; @@ -109,6 +109,7 @@ dissect_h261( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) /* The rest of the packet is the H.261 stream */ proto_tree_add_item( h261_tree, hf_h261_data, tvb, offset, -1, ENC_NA ); } + return tvb_captured_length(tvb); } void @@ -255,7 +256,7 @@ proto_reg_handoff_h261(void) { dissector_handle_t h261_handle; - h261_handle = create_dissector_handle(dissect_h261, proto_h261); + h261_handle = new_create_dissector_handle(dissect_h261, proto_h261); dissector_add_uint("rtp.pt", PT_H261, h261_handle); dissector_add_uint("iax2.codec", AST_FORMAT_H261, h261_handle); } diff --git a/epan/dissectors/packet-hcrt.c b/epan/dissectors/packet-hcrt.c index 8c51c05e94..d0bb94d03a 100644 --- a/epan/dissectors/packet-hcrt.c +++ b/epan/dissectors/packet-hcrt.c @@ -303,7 +303,7 @@ static gboolean dissect_hcrt_message(tvbuff_t* tvb, packet_info* pinfo, proto_tr return last; } -static void dissect_hcrt(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) +static int dissect_hcrt(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U_) { guint8 type; proto_item* ti; @@ -343,6 +343,7 @@ static void dissect_hcrt(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) while (!dissect_hcrt_message(tvb, pinfo, hcrt_tree, &offset, b0_first, i)) { i++; } + return tvb_captured_length(tvb); } void proto_register_hcrt(void) @@ -496,7 +497,7 @@ void proto_reg_handoff_hcrt(void) static gint hcrt_ethertype; if (!hcrt_prefs_initialized) { - hcrt_handle = create_dissector_handle(dissect_hcrt, proto_hcrt); + hcrt_handle = new_create_dissector_handle(dissect_hcrt, proto_hcrt); /* Also register as a dissector that can be selected by a TCP port number via "decode as" */ dissector_add_for_decode_as("tcp.port", hcrt_handle); diff --git a/epan/dissectors/packet-hip.c b/epan/dissectors/packet-hip.c index c6dcf43c05..b52a8202b6 100644 --- a/epan/dissectors/packet-hip.c +++ b/epan/dissectors/packet-hip.c @@ -578,22 +578,30 @@ dissect_hip_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean } } -static void -dissect_hip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_hip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { dissect_hip_common(tvb, pinfo, tree, FALSE); + return tvb_captured_length(tvb); } -static void -dissect_hip_in_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_hip_in_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { - guint32 nullbytes; - nullbytes = tvb_get_ntohl(tvb, 0); - if (nullbytes == 0) - { - tvbuff_t *newtvb = tvb_new_subset_remaining(tvb, 4); - dissect_hip_common(newtvb, pinfo, tree, TRUE); - } + guint32 nullbytes; + tvbuff_t *newtvb; + + if (tvb_captured_length(tvb) < 4) + return 0; + + nullbytes = tvb_get_ntohl(tvb, 0); + if (nullbytes != 0) + return 0; + + newtvb = tvb_new_subset_remaining(tvb, 4); + dissect_hip_common(newtvb, pinfo, tree, TRUE); + + return tvb_captured_length(tvb); } @@ -1602,10 +1610,10 @@ proto_reg_handoff_hip(void) dissector_handle_t hip_handle; dissector_handle_t hip_handle2; - hip_handle = create_dissector_handle(dissect_hip, proto_hip); + hip_handle = new_create_dissector_handle(dissect_hip, proto_hip); dissector_add_uint("ip.proto", IP_PROTO_HIP, hip_handle); - hip_handle2 = create_dissector_handle(dissect_hip_in_udp, proto_hip); + hip_handle2 = new_create_dissector_handle(dissect_hip_in_udp, proto_hip); dissector_add_uint("udp.port", 10500, hip_handle2); } /* diff --git a/epan/dissectors/packet-homeplug-av.c b/epan/dissectors/packet-homeplug-av.c index aa3f138f44..7419c52093 100644 --- a/epan/dissectors/packet-homeplug-av.c +++ b/epan/dissectors/packet-homeplug-av.c @@ -3189,8 +3189,8 @@ dissect_homeplug_av_mme(ptvcursor_t *cursor, guint8 homeplug_av_mmver, guint16 h return; } -static void -dissect_homeplug_av(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_homeplug_av(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *homeplug_av_tree; @@ -3218,6 +3218,7 @@ dissect_homeplug_av(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } ptvcursor_free(cursor); + return tvb_captured_length(tvb); } void @@ -4744,7 +4745,7 @@ proto_reg_handoff_homeplug_av(void) { dissector_handle_t homeplug_av_handle; - homeplug_av_handle = create_dissector_handle(dissect_homeplug_av, proto_homeplug_av); + homeplug_av_handle = new_create_dissector_handle(dissect_homeplug_av, proto_homeplug_av); dissector_add_uint("ethertype", ETHERTYPE_HOMEPLUG_AV, homeplug_av_handle); } diff --git a/epan/dissectors/packet-homeplug.c b/epan/dissectors/packet-homeplug.c index 55cec5d2e4..b0799263ae 100644 --- a/epan/dissectors/packet-homeplug.c +++ b/epan/dissectors/packet-homeplug.c @@ -1297,8 +1297,8 @@ static int check_tvb_length(ptvcursor_t *cursor, const gint length) return TVB_LEN_GREATEST; } -static void -dissect_homeplug(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +static int +dissect_homeplug(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_) { proto_item * it; proto_tree * homeplug_tree; @@ -1343,6 +1343,7 @@ dissect_homeplug(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) } ptvcursor_free(cursor); + return tvb_captured_length(tvb); } static void @@ -1356,7 +1357,7 @@ proto_reg_handoff_homeplug(void) { dissector_handle_t homeplug_handle; - homeplug_handle = create_dissector_handle(dissect_homeplug, proto_homeplug); + homeplug_handle = new_create_dissector_handle(dissect_homeplug, proto_homeplug); dissector_add_uint("ethertype", ETHERTYPE_HOMEPLUG, homeplug_handle); } diff --git a/epan/dissectors/packet-hp-erm.c b/epan/dissectors/packet-hp-erm.c index 6ff3df0a12..0582c1cd55 100644 --- a/epan/dissectors/packet-hp-erm.c +++ b/epan/dissectors/packet-hp-erm.c @@ -85,8 +85,8 @@ static const value_string hp_erm_cfi_vals[] = { static dissector_handle_t eth_withoutfcs_handle; -static void -dissect_hp_erm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_hp_erm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *hp_erm_tree; @@ -112,6 +112,7 @@ dissect_hp_erm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) eth_tvb = tvb_new_subset_remaining(tvb, offset); call_dissector(eth_withoutfcs_handle, eth_tvb, pinfo, tree); + return tvb_captured_length(tvb); } void @@ -172,7 +173,7 @@ proto_reg_handoff_hp_erm(void) if (!initialized) { eth_withoutfcs_handle = find_dissector("eth_withoutfcs"); - hp_erm_handle = create_dissector_handle(dissect_hp_erm, proto_hp_erm); + hp_erm_handle = new_create_dissector_handle(dissect_hp_erm, proto_hp_erm); initialized = TRUE; } else { if (hp_erm_udp_port != 0) diff --git a/epan/dissectors/packet-hsr-prp-supervision.c b/epan/dissectors/packet-hsr-prp-supervision.c index c495cbcaa9..ddde483542 100644 --- a/epan/dissectors/packet-hsr-prp-supervision.c +++ b/epan/dissectors/packet-hsr-prp-supervision.c @@ -67,8 +67,8 @@ static int hf_hsr_prp_supervision_vdan_mac_address = -1; static gint ett_hsr_prp_supervision = -1; /* Code to actually dissect the packets */ -static void -dissect_hsr_prp_supervision(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_hsr_prp_supervision(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *hsr_prp_supervision_tree; @@ -172,6 +172,7 @@ dissect_hsr_prp_supervision(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Adjust the length of this tvbuff to include only the supervision data. This allows the rest to be marked as padding. */ tvb_set_reported_length(tvb, offset); + return tvb_captured_length(tvb); } @@ -252,7 +253,7 @@ void proto_register_hsr_prp_supervision(void) void proto_reg_handoff_hsr_prp_supervision(void) { dissector_handle_t hsr_prp_supervision_handle; - hsr_prp_supervision_handle = create_dissector_handle(dissect_hsr_prp_supervision, proto_hsr_prp_supervision); + hsr_prp_supervision_handle = new_create_dissector_handle(dissect_hsr_prp_supervision, proto_hsr_prp_supervision); dissector_add_uint("ethertype", ETHERTYPE_PRP, hsr_prp_supervision_handle); } diff --git a/epan/dissectors/packet-hsr.c b/epan/dissectors/packet-hsr.c index 660e97d924..8a063c1897 100644 --- a/epan/dissectors/packet-hsr.c +++ b/epan/dissectors/packet-hsr.c @@ -72,8 +72,8 @@ static gint ett_hsr_frame = -1; static dissector_handle_t data_handle; /* Code to actually dissect the packets */ -static void -dissect_hsr_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_hsr_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *hsr_tree; @@ -126,6 +126,7 @@ dissect_hsr_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (!dissector_try_uint(ethertype_subdissector_table, etype, next_tvb, pinfo, tree)) call_dissector(data_handle, next_tvb, pinfo, hsr_tree); + return tvb_captured_length(tvb); } @@ -188,7 +189,7 @@ void proto_register_hsr(void) void proto_reg_handoff_hsr(void) { dissector_handle_t hsr_frame_handle; - hsr_frame_handle = create_dissector_handle(dissect_hsr_frame, proto_hsr); + hsr_frame_handle = new_create_dissector_handle(dissect_hsr_frame, proto_hsr); dissector_add_uint("ethertype", ETHERTYPE_HSR, hsr_frame_handle); ethertype_subdissector_table = find_dissector_table("ethertype"); diff --git a/epan/dissectors/packet-http.c b/epan/dissectors/packet-http.c index 6e57020286..03c231bebf 100644 --- a/epan/dissectors/packet-http.c +++ b/epan/dissectors/packet-http.c @@ -2982,14 +2982,15 @@ dissect_http_heur_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void return FALSE; } -static void -dissect_ssdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ssdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { conversation_t *conversation; http_conv_t *conv_data; conv_data = get_http_conversation_data(pinfo, &conversation); dissect_http_message(tvb, 0, pinfo, tree, conv_data, "SSDP", proto_ssdp); + return tvb_captured_length(tvb); } static void @@ -3445,7 +3446,7 @@ proto_reg_handoff_http(void) * XXX - is there anything to dissect in the body of an SSDP * request or reply? I.e., should there be an SSDP dissector? */ - ssdp_handle = create_dissector_handle(dissect_ssdp, proto_ssdp); + ssdp_handle = new_create_dissector_handle(dissect_ssdp, proto_ssdp); dissector_add_uint("udp.port", UDP_PORT_SSDP, ssdp_handle); ntlmssp_handle = find_dissector("ntlmssp"); @@ -3465,8 +3466,8 @@ proto_reg_handoff_http(void) static gint proto_message_http = -1; static gint ett_message_http = -1; -static void -dissect_message_http(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_message_http(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *subtree; proto_item *ti; @@ -3488,6 +3489,7 @@ dissect_message_http(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset = next_offset; } } + return tvb_captured_length(tvb); } void @@ -3510,7 +3512,7 @@ proto_reg_handoff_message_http(void) { dissector_handle_t message_http_handle; - message_http_handle = create_dissector_handle(dissect_message_http, + message_http_handle = new_create_dissector_handle(dissect_message_http, proto_message_http); dissector_add_string("media_type", "message/http", message_http_handle); diff --git a/epan/dissectors/packet-i2c.c b/epan/dissectors/packet-i2c.c index 1754040ddd..5a8656dc7c 100644 --- a/epan/dissectors/packet-i2c.c +++ b/epan/dissectors/packet-i2c.c @@ -164,8 +164,8 @@ i2c_get_event_desc(guint32 event) return desc; } -static void -dissect_i2c(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_i2c(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *i2c_tree; @@ -221,6 +221,7 @@ dissect_i2c(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) call_dissector(data_handle, tvb, pinfo, tree); } } + return tvb_captured_length(tvb); } void @@ -262,7 +263,7 @@ proto_reg_handoff_i2c(void) data_handle = find_dissector("data"); - i2c_handle = create_dissector_handle(dissect_i2c, proto_i2c); + i2c_handle = new_create_dissector_handle(dissect_i2c, proto_i2c); dissector_add_uint("wtap_encap", WTAP_ENCAP_I2C, i2c_handle); } diff --git a/epan/dissectors/packet-iapp.c b/epan/dissectors/packet-iapp.c index 1cb6c8148e..8591408b32 100644 --- a/epan/dissectors/packet-iapp.c +++ b/epan/dissectors/packet-iapp.c @@ -349,8 +349,8 @@ dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *pdutree, } /* code to dissect an IAPP packet */ -static void -dissect_iapp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_iapp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti, *pduitem; proto_tree *iapp_tree, *pdutree; @@ -368,22 +368,21 @@ dissect_iapp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) codestrval = val_to_str_const(ia_type, iapp_vals, "Unknown Packet"); col_add_fstr(pinfo->cinfo, COL_INFO, "%s(%d) (version=%d)", codestrval, ia_type, ia_version); - if (tree) - { - ti = proto_tree_add_item(tree, proto_iapp, tvb, 0, -1, ENC_NA); - iapp_tree = proto_item_add_subtree(ti, ett_iapp); + ti = proto_tree_add_item(tree, proto_iapp, tvb, 0, -1, ENC_NA); + iapp_tree = proto_item_add_subtree(ti, ett_iapp); - /* common header for all IAPP frames */ + /* common header for all IAPP frames */ - proto_tree_add_item(iapp_tree, hf_iapp_version, tvb, 0, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(iapp_tree, hf_iapp_type, tvb, 1, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(iapp_tree, hf_iapp_version, tvb, 0, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(iapp_tree, hf_iapp_type, tvb, 1, 1, ENC_BIG_ENDIAN); - pdutree = proto_tree_add_subtree(iapp_tree, tvb, 2, -1, - ett_iapp_pdu, &pduitem, "Protocol data units"); + pdutree = proto_tree_add_subtree(iapp_tree, tvb, 2, -1, + ett_iapp_pdu, &pduitem, "Protocol data units"); - dissect_pdus(tvb, pinfo, 2, pdutree, pduitem, - tvb_captured_length_remaining(tvb, 2)); - } + dissect_pdus(tvb, pinfo, 2, pdutree, pduitem, + tvb_captured_length_remaining(tvb, 2)); + + return tvb_captured_length(tvb); } @@ -480,7 +479,7 @@ proto_reg_handoff_iapp(void) { dissector_handle_t iapp_handle; - iapp_handle = create_dissector_handle(dissect_iapp, proto_iapp); + iapp_handle = new_create_dissector_handle(dissect_iapp, proto_iapp); dissector_add_uint("udp.port", UDP_PORT_IAPP, iapp_handle); } /* diff --git a/epan/dissectors/packet-icap.c b/epan/dissectors/packet-icap.c index 92d68202b0..8f0d5bb4f7 100644 --- a/epan/dissectors/packet-icap.c +++ b/epan/dissectors/packet-icap.c @@ -54,8 +54,8 @@ static dissector_handle_t http_handle; #define TCP_PORT_ICAP 1344 static int is_icap_message(const guchar *data, int linelen, icap_type_t *type); -static void -dissect_icap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_icap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *icap_tree = NULL; proto_item *ti = NULL; @@ -245,6 +245,8 @@ is_icap_header: call_dissector(http_handle, new_tvb, pinfo, icap_tree); } } + + return tvb_captured_length(tvb); } @@ -322,7 +324,7 @@ proto_reg_handoff_icap(void) data_handle = find_dissector("data"); http_handle = find_dissector("http"); - icap_handle = create_dissector_handle(dissect_icap, proto_icap); + icap_handle = new_create_dissector_handle(dissect_icap, proto_icap); dissector_add_uint("tcp.port", TCP_PORT_ICAP, icap_handle); } diff --git a/epan/dissectors/packet-icp.c b/epan/dissectors/packet-icp.c index 3d0cdf7063..6a573fcb1a 100644 --- a/epan/dissectors/packet-icp.c +++ b/epan/dissectors/packet-icp.c @@ -144,7 +144,7 @@ static void dissect_icp_payload(tvbuff_t *tvb, packet_info *pinfo, int offset, } } -static void dissect_icp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_icp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *icp_tree , *payload_tree; proto_item *ti; @@ -164,12 +164,11 @@ static void dissect_icp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) val_to_str_const(opcode, opcode_vals, "Unknown"), opcode, request_number); + ti = proto_tree_add_item(tree,proto_icp, tvb, 0, message_length, ENC_NA); + icp_tree = proto_item_add_subtree(ti, ett_icp); + if (tree) { - - ti = proto_tree_add_item(tree,proto_icp, tvb, 0, message_length, ENC_NA); - icp_tree = proto_item_add_subtree(ti, ett_icp); - proto_tree_add_uint(icp_tree,hf_icp_opcode, tvb, 0, 1, opcode); proto_tree_add_item(icp_tree,hf_icp_version, tvb, 1, 1, ENC_BIG_ENDIAN); @@ -195,13 +194,16 @@ static void dissect_icp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } proto_tree_add_item(icp_tree, hf_icp_sender_host_ip_address, tvb, 16, 4, ENC_BIG_ENDIAN); + } - payload_tree = proto_tree_add_subtree(icp_tree, tvb, + payload_tree = proto_tree_add_subtree(icp_tree, tvb, 20, message_length - 20, ett_icp_payload, NULL, "Payload"); - dissect_icp_payload(tvb, pinfo, 20, payload_tree, opcode); - } + dissect_icp_payload(tvb, pinfo, 20, payload_tree, opcode); + + return tvb_captured_length(tvb); } + void proto_register_icp(void) { @@ -255,7 +257,7 @@ proto_reg_handoff_icp(void) { dissector_handle_t icp_handle; - icp_handle = create_dissector_handle(dissect_icp, proto_icp); + icp_handle = new_create_dissector_handle(dissect_icp, proto_icp); dissector_add_uint("udp.port", UDP_PORT_ICP, icp_handle); } diff --git a/epan/dissectors/packet-idp.c b/epan/dissectors/packet-idp.c index 598a8c73a9..01a520724c 100644 --- a/epan/dissectors/packet-idp.c +++ b/epan/dissectors/packet-idp.c @@ -75,8 +75,8 @@ static const value_string idp_socket_vals[] = { { 0, NULL } }; -static void -dissect_idp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_idp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *idp_tree; proto_item *ti; @@ -122,11 +122,12 @@ dissect_idp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* * Hand off to the dissector for the packet type. */ - if (dissector_try_uint(idp_type_dissector_table, type, next_tvb, - pinfo, tree)) - return; - - call_dissector(data_handle, next_tvb, pinfo, tree); + if (!dissector_try_uint(idp_type_dissector_table, type, next_tvb, + pinfo, tree)) + { + call_dissector(data_handle, next_tvb, pinfo, tree); + } + return tvb_captured_length(tvb); } void @@ -205,7 +206,7 @@ proto_reg_handoff_idp(void) { dissector_handle_t idp_handle; - idp_handle = create_dissector_handle(dissect_idp, proto_idp); + idp_handle = new_create_dissector_handle(dissect_idp, proto_idp); dissector_add_uint("ethertype", ETHERTYPE_XNS_IDP, idp_handle); dissector_add_uint("chdlc.protocol", ETHERTYPE_XNS_IDP, idp_handle); diff --git a/epan/dissectors/packet-iec104.c b/epan/dissectors/packet-iec104.c index abdbe98b61..ae1fc419d0 100644 --- a/epan/dissectors/packet-iec104.c +++ b/epan/dissectors/packet-iec104.c @@ -1054,7 +1054,7 @@ static guint get_iec104apdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, /* Is is called twice: For 'Packet List' and for 'Packet Details' */ -static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint Len = tvb_reported_length(tvb); guint8 Bytex; @@ -1196,7 +1196,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr /* check length */ if(Len < (guint)(offset + 3)) { expert_add_info(pinfo, itSignal, &ei_iec104_short_asdu); - return; + return offset; } get_InfoObjectAddress(&asdu_info_obj_addr, tvb, &offset, trSignal); } else { @@ -1212,7 +1212,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr /* check length */ if(Len < (guint)(offset + 3)) { expert_add_info(pinfo, itSignal, &ei_iec104_short_asdu); - return; + return offset; } get_InfoObjectAddress(&asdu_info_obj_addr, tvb, &offset, trSignal); } @@ -1223,7 +1223,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr /* check length */ if(Len < (guint)(offset + asduh.DataLength)) { expert_add_info(pinfo, itSignal, &ei_iec104_short_asdu); - return; + return offset; } switch (asduh.TypeId) { @@ -1371,6 +1371,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr break; } /* end 'switch (asdu_typeid)' */ + return tvb_captured_length(tvb); } @@ -1855,7 +1856,7 @@ proto_reg_handoff_iec104(void) dissector_handle_t iec104apci_handle; iec104apci_handle = new_create_dissector_handle(dissect_iec104reas, proto_iec104apci); - iec104asdu_handle = create_dissector_handle(dissect_iec104asdu, proto_iec104asdu); + iec104asdu_handle = new_create_dissector_handle(dissect_iec104asdu, proto_iec104asdu); dissector_add_uint("tcp.port", IEC104_PORT, iec104apci_handle); } diff --git a/epan/dissectors/packet-ieee1722.c b/epan/dissectors/packet-ieee1722.c index fe5996e17a..2a51acffc9 100644 --- a/epan/dissectors/packet-ieee1722.c +++ b/epan/dissectors/packet-ieee1722.c @@ -122,8 +122,8 @@ static expert_field ei_1722_incorrect_dbs = EI_INIT; static dissector_table_t avb_dissector_table; -static void -dissect_1722(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_1722(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *ieee1722_tree = NULL; @@ -139,11 +139,10 @@ dissect_1722(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_INFO, "AVB Transportation Protocol"); - if (tree) { - ti = proto_tree_add_item(tree, proto_1722, tvb, 0, -1, ENC_NA); - - ieee1722_tree = proto_item_add_subtree(ti, ett_1722); + ti = proto_tree_add_item(tree, proto_1722, tvb, 0, -1, ENC_NA); + ieee1722_tree = proto_item_add_subtree(ti, ett_1722); + if (tree) { /* Add the CD and Subtype fields * CD field is 1 bit * Subtype field is 7 bits @@ -161,7 +160,8 @@ dissect_1722(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) subtype &= 0x7F; /* call any registered subtype dissectors which use only the common AVTPDU (e.g. 1722.1 and MAAP) */ - if (dissector_try_uint(avb_dissector_table, subtype, tvb, pinfo, tree)) return; + if (dissector_try_uint(avb_dissector_table, subtype, tvb, pinfo, tree)) + return tvb_captured_length(tvb); if (tree) { proto_tree_add_item(ieee1722_tree, hf_1722_mrfield, tvb, IEEE_1722_VERSION_OFFSET, 1, ENC_BIG_ENDIAN); @@ -221,27 +221,28 @@ dissect_1722(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(ieee1722_tree, hf_1722_syt, tvb, IEEE_1722_SYT_OFFSET, 2, ENC_BIG_ENDIAN); + } - /* Calculate the remaining size by subtracting the CIP header size + /* Calculate the remaining size by subtracting the CIP header size from the value in the packet data length field */ - datalen = tvb_get_ntohs(tvb, IEEE_1722_PKT_DATA_LENGTH_OFFSET); - datalen -= IEEE_1722_CIP_HEADER_SIZE; - - /* Make the Audio sample tree. */ - ti = proto_tree_add_item(ieee1722_tree, hf_1722_data, tvb, - IEEE_1722_DATA_OFFSET, datalen, ENC_NA); + datalen = tvb_get_ntohs(tvb, IEEE_1722_PKT_DATA_LENGTH_OFFSET); + datalen -= IEEE_1722_CIP_HEADER_SIZE; - audio_tree = proto_item_add_subtree(ti, ett_1722_audio); + /* Make the Audio sample tree. */ + ti = proto_tree_add_item(ieee1722_tree, hf_1722_data, tvb, + IEEE_1722_DATA_OFFSET, datalen, ENC_NA); - /* Need to get the offset of where the audio data starts */ - offset = IEEE_1722_DATA_OFFSET; - dbs = tvb_get_guint8(tvb, IEEE_1722_DBS_OFFSET); + audio_tree = proto_item_add_subtree(ti, ett_1722_audio); - /* If the DBS is ever 0 for whatever reason, then just add the rest of packet as unknown */ - if(dbs == 0) - expert_add_info(pinfo, ti, &ei_1722_incorrect_dbs); + /* Need to get the offset of where the audio data starts */ + offset = IEEE_1722_DATA_OFFSET; + dbs = tvb_get_guint8(tvb, IEEE_1722_DBS_OFFSET); - else { + /* If the DBS is ever 0 for whatever reason, then just add the rest of packet as unknown */ + if(dbs == 0) + expert_add_info(pinfo, ti, &ei_1722_incorrect_dbs); + else { + if (audio_tree) { /* Loop through all samples and add them to the audio tree. */ for (j = 0; j < (datalen / (dbs*4)); j++) { sample_tree = proto_tree_add_subtree_format(audio_tree, tvb, offset, 1, ett_1722_sample, NULL, "Sample %d", j+1); @@ -255,6 +256,7 @@ dissect_1722(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } } + return tvb_captured_length(tvb); } /* Register the protocol with Wireshark */ @@ -409,7 +411,7 @@ void proto_reg_handoff_1722(void) { dissector_handle_t avbtp_handle; - avbtp_handle = create_dissector_handle(dissect_1722, proto_1722); + avbtp_handle = new_create_dissector_handle(dissect_1722, proto_1722); dissector_add_uint("ethertype", ETHERTYPE_AVBTP, avbtp_handle); } diff --git a/epan/dissectors/packet-ieee17221.c b/epan/dissectors/packet-ieee17221.c index 3b7f2970ac..4034ec94ea 100644 --- a/epan/dissectors/packet-ieee17221.c +++ b/epan/dissectors/packet-ieee17221.c @@ -4692,8 +4692,8 @@ dissect_17221_acmp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *acmp_tree) proto_tree_add_item(acmp_tree, hf_acmp_vlan_id, tvb, ACMP_VLAN_ID_OFFSET, 2, ENC_BIG_ENDIAN); } -static void -dissect_17221(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_17221(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint8 subtype = 0; proto_item *ieee17221_item; @@ -4734,10 +4734,11 @@ dissect_17221(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { /* Shouldn't get here */ col_set_str(pinfo->cinfo, COL_INFO, "1722.1 Unknown"); - return; + return 0; } } + return tvb_captured_length(tvb); } /* Register the protocol with Wireshark */ @@ -7019,7 +7020,7 @@ proto_reg_handoff_17221(void) /* avb17221_handle = find_dissector("ieee1722"); */ - avb17221_handle = create_dissector_handle(dissect_17221, proto_17221); + avb17221_handle = new_create_dissector_handle(dissect_17221, proto_17221); dissector_add_uint("ieee1722.subtype", 0x7A, avb17221_handle); dissector_add_uint("ieee1722.subtype", 0x7B, avb17221_handle); dissector_add_uint("ieee1722.subtype", 0x7C, avb17221_handle); diff --git a/epan/dissectors/packet-ieee1722a.c b/epan/dissectors/packet-ieee1722a.c index 7fe82ad11b..84c6ee3a01 100644 --- a/epan/dissectors/packet-ieee1722a.c +++ b/epan/dissectors/packet-ieee1722a.c @@ -228,7 +228,7 @@ static expert_field ei_format_info = EI_INIT; static expert_field ei_clock_reference_type = EI_INIT; -static void dissect_1722a (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_1722a (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti = NULL; proto_tree *ieee1722a_tree = NULL; @@ -382,6 +382,7 @@ static void dissect_1722a (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) DISSECTOR_ASSERT_NOT_REACHED(); break; } + return tvb_captured_length(tvb); } /* Register the protocol with Wireshark */ @@ -512,7 +513,7 @@ void proto_reg_handoff_1722a(void) { dissector_handle_t avb1722a_handle; - avb1722a_handle = create_dissector_handle(dissect_1722a, proto_1722a); + avb1722a_handle = new_create_dissector_handle(dissect_1722a, proto_1722a); dissector_add_uint("ieee1722.subtype", IEEE_1722A_SUBTYPE_AVTP_AUDIO, avb1722a_handle); dissector_add_uint("ieee1722.subtype", IEEE_1722A_SUBTYPE_CRF, avb1722a_handle); } diff --git a/epan/dissectors/packet-ieee80211-airopeek.c b/epan/dissectors/packet-ieee80211-airopeek.c index 72e2561aff..82864ec812 100644 --- a/epan/dissectors/packet-ieee80211-airopeek.c +++ b/epan/dissectors/packet-ieee80211-airopeek.c @@ -39,8 +39,8 @@ static int hf_signal_strength = -1; static gint ett_airopeek = -1; -static void -dissect_airopeek(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_airopeek(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *airopeek_tree = NULL; proto_item *ti; @@ -74,17 +74,15 @@ dissect_airopeek(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_add_fstr(pinfo->cinfo, COL_TX_RATE, "%u.%u", data_rate / 2, data_rate & 1 ? 5 : 0); - if (tree) { - proto_tree_add_uint64_format_value(airopeek_tree, hf_data_rate, tvb, 0, 1, + + proto_tree_add_uint64_format_value(airopeek_tree, hf_data_rate, tvb, 0, 1, (guint64)data_rate * 500000, "%u.%u Mb/s", data_rate / 2, data_rate & 1 ? 5 : 0); - } phdr.channel = tvb_get_guint8(tvb, 1); - if (tree) - proto_tree_add_item(airopeek_tree, hf_channel, tvb, 1, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(airopeek_tree, hf_channel, tvb, 1, 1, ENC_BIG_ENDIAN); signal_level = tvb_get_guint8(tvb, 2); /* @@ -109,6 +107,7 @@ dissect_airopeek(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) pinfo->current_proto = "IEEE 802.11"; next_tvb = tvb_new_subset_remaining(tvb, 4); call_dissector_with_data(ieee80211_radio_handle, next_tvb, pinfo, tree, &phdr); + return tvb_captured_length(tvb); } void proto_register_ieee80211_airopeek(void) @@ -143,7 +142,7 @@ void proto_reg_handoff_ieee80211_airopeek(void) dissector_handle_t airopeek_handle; /* Register handoff to airopeek-header dissectors */ - airopeek_handle = create_dissector_handle(dissect_airopeek, proto_airopeek); + airopeek_handle = new_create_dissector_handle(dissect_airopeek, proto_airopeek); dissector_add_uint("wtap_encap", WTAP_ENCAP_IEEE_802_11_AIROPEEK, airopeek_handle); ieee80211_radio_handle = find_dissector("wlan_radio"); diff --git a/epan/dissectors/packet-ieee80211-prism.c b/epan/dissectors/packet-ieee80211-prism.c index 504e00c78f..0a5c80df80 100644 --- a/epan/dissectors/packet-ieee80211-prism.c +++ b/epan/dissectors/packet-ieee80211-prism.c @@ -283,10 +283,10 @@ tvb_get_enctohl(tvbuff_t *tvb, int offset, guint encoding) return tvb_get_letohl(tvb, offset); } -static void -dissect_prism(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_prism(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { - proto_tree *prism_tree = NULL, *prism_did_tree = NULL; + proto_tree *prism_tree, *prism_did_tree = NULL; proto_item *ti = NULL, *ti_did = NULL; tvbuff_t *next_tvb; int offset; @@ -306,7 +306,7 @@ dissect_prism(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if ((msgcode == WLANCAP_MAGIC_COOKIE_V1) || (msgcode == WLANCAP_MAGIC_COOKIE_V2)) { call_dissector(wlancap_handle, tvb, pinfo, tree); - return; + return tvb_captured_length(tvb); } /* @@ -328,7 +328,7 @@ dissect_prism(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } else { /* neither matched - try it as just 802.11 with no Prism header */ call_dissector(ieee80211_handle, tvb, pinfo, tree); - return; + return tvb_captured_length(tvb); } /* We don't have any 802.11 metadata yet. */ @@ -341,29 +341,21 @@ dissect_prism(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "Prism"); col_clear(pinfo->cinfo, COL_INFO); - if(tree) { - ti = proto_tree_add_item(tree, proto_prism, tvb, 0, 144, ENC_NA); - prism_tree = proto_item_add_subtree(ti, ett_prism); - } + ti = proto_tree_add_item(tree, proto_prism, tvb, 0, 144, ENC_NA); + prism_tree = proto_item_add_subtree(ti, ett_prism); /* Message Code */ - if(tree) { - proto_tree_add_item(prism_tree, hf_ieee80211_prism_msgcode, tvb, offset, 4, byte_order); - } + proto_tree_add_item(prism_tree, hf_ieee80211_prism_msgcode, tvb, offset, 4, byte_order); msgcode = tvb_get_enctohl(tvb, offset, byte_order); offset += 4; /* Message Length */ - if(tree) { - proto_tree_add_item(prism_tree, hf_ieee80211_prism_msglen, tvb, offset, 4, byte_order); - } + proto_tree_add_item(prism_tree, hf_ieee80211_prism_msglen, tvb, offset, 4, byte_order); msglen = tvb_get_enctohl(tvb, offset, byte_order); offset += 4; /* Device Name */ - if(tree) { - proto_tree_add_item(prism_tree, hf_ieee80211_prism_devname, tvb, offset, 16, ENC_ASCII|ENC_NA); - } + proto_tree_add_item(prism_tree, hf_ieee80211_prism_devname, tvb, offset, 16, ENC_ASCII|ENC_NA); devname_p = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, 16, ENC_ASCII); offset += 16; @@ -385,15 +377,11 @@ dissect_prism(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Status */ status = tvb_get_enctohs(tvb, offset, byte_order); - if(tree) { - proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_status, tvb, offset, 2, byte_order); - } + proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_status, tvb, offset, 2, byte_order); offset += 2; /* Length */ - if(tree) { - proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_length, tvb, offset, 2, byte_order); - } + proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_length, tvb, offset, 2, byte_order); offset += 2; /* Data, if present... */ @@ -489,9 +477,7 @@ dissect_prism(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; default: - if(tree){ - proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_unknown, tvb, offset, 4, byte_order); - } + proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_unknown, tvb, offset, 4, byte_order); break; } } @@ -501,6 +487,7 @@ dissect_prism(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* dissect the 802.11 header next */ next_tvb = tvb_new_subset_remaining(tvb, offset); call_dissector_with_data(ieee80211_radio_handle, next_tvb, pinfo, tree, (void *)&phdr); + return tvb_captured_length(tvb); } static hf_register_info hf_prism[] = { @@ -596,7 +583,7 @@ void proto_reg_handoff_ieee80211_prism(void) { dissector_handle_t prism_handle; - prism_handle = create_dissector_handle(dissect_prism, proto_prism); + prism_handle = new_create_dissector_handle(dissect_prism, proto_prism); dissector_add_uint("wtap_encap", WTAP_ENCAP_IEEE_802_11_PRISM, prism_handle); ieee80211_handle = find_dissector("wlan"); ieee80211_radio_handle = find_dissector("wlan_radio"); diff --git a/epan/dissectors/packet-ieee80211.c b/epan/dissectors/packet-ieee80211.c index 917f227f5a..081f5e34c2 100644 --- a/epan/dissectors/packet-ieee80211.c +++ b/epan/dissectors/packet-ieee80211.c @@ -18429,8 +18429,8 @@ dissect_ieee80211_withoutfcs (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre * is already decrypted. I added a test in the code to accomodate this. * For TKIP it seems to stay encrypted. */ -static void -dissect_ieee80211_centrino(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ieee80211_centrino(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { struct ieee_802_11_phdr phdr; @@ -18441,6 +18441,7 @@ dissect_ieee80211_centrino(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) phdr.phy = PHDR_802_11_PHY_UNKNOWN; phdr.presence_flags = 0; dissect_ieee80211_common (tvb, pinfo, tree, FALSE, TRUE, &phdr); + return tvb_captured_length(tvb); } /* @@ -18905,8 +18906,8 @@ wlan_retransmit_init(void) } -static void -dissect_data_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_data_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int offset = 0; guint8 type; @@ -18935,6 +18936,7 @@ dissect_data_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } break; } + return tvb_captured_length(tvb); } void @@ -27268,7 +27270,7 @@ proto_reg_handoff_ieee80211(void) ieee80211_handle = find_dissector("wlan"); dissector_add_uint("wtap_encap", WTAP_ENCAP_IEEE_802_11, ieee80211_handle); - centrino_handle = create_dissector_handle( dissect_ieee80211_centrino, proto_centrino ); + centrino_handle = new_create_dissector_handle( dissect_ieee80211_centrino, proto_centrino ); dissector_add_uint("ethertype", ETHERTYPE_CENTRINO_PROMISC, centrino_handle); /* Register handoff to Aruba GRE */ @@ -27297,7 +27299,7 @@ proto_reg_handoff_ieee80211(void) dissector_add_uint("gre.proto", GRE_ARUBA_8360, ieee80211_handle); dissector_add_uint("gre.proto", GRE_ARUBA_8370, ieee80211_handle); - data_encap_handle = create_dissector_handle(dissect_data_encap, proto_wlan); + data_encap_handle = new_create_dissector_handle(dissect_data_encap, proto_wlan); dissector_add_uint("ethertype", ETHERTYPE_IEEE80211_DATA_ENCAP, data_encap_handle); diff --git a/epan/dissectors/packet-ieee8021ah.c b/epan/dissectors/packet-ieee8021ah.c index afadb086b3..51c84f65d8 100644 --- a/epan/dissectors/packet-ieee8021ah.c +++ b/epan/dissectors/packet-ieee8021ah.c @@ -101,9 +101,8 @@ capture_ieee8021ah(const guchar *pd, int offset, int len, packet_counts *ld) /* Dissector *************************************************************/ static -void -dissect_ieee8021ad(tvbuff_t *tvb, packet_info *pinfo, - proto_tree *tree) +int dissect_ieee8021ad(tvbuff_t *tvb, packet_info *pinfo, + proto_tree *tree, void* data _U_) { proto_tree *ptree = NULL; proto_tree *tagtree = NULL; @@ -130,12 +129,8 @@ dissect_ieee8021ad(tvbuff_t *tvb, packet_info *pinfo, (tci >> 13), ((tci >> 12) & 1), (tci & 0xFFF)); /* create the protocol tree */ - ieee8021ad_tree = NULL; - - if (tree) { - ptree = proto_tree_add_item(tree, proto_tree_index, tvb, 0, IEEE8021AD_LEN, ENC_NA); - ieee8021ad_tree = proto_item_add_subtree(ptree, ett_ieee8021ad); - } + ptree = proto_tree_add_item(tree, proto_tree_index, tvb, 0, IEEE8021AD_LEN, ENC_NA); + ieee8021ad_tree = proto_item_add_subtree(ptree, ett_ieee8021ad); encap_proto = tvb_get_ntohs(tvb, IEEE8021AD_LEN - 2); ethertype_data.fh_tree = ieee8021ad_tree; @@ -172,7 +167,6 @@ dissect_ieee8021ad(tvbuff_t *tvb, packet_info *pinfo, dissect_ieee8021ah_common(next_tvb, pinfo, tree, NULL, proto_tree_index); } - return; } else if (encap_proto == ETHERTYPE_IEEE_802_1AD) { /* two VLAN tags (i.e. Q-in-Q) */ ctci = tvb_get_ntohs(tvb, IEEE8021AD_LEN); @@ -220,6 +214,7 @@ dissect_ieee8021ad(tvbuff_t *tvb, packet_info *pinfo, dissector based on ethertype */ call_dissector_with_data(ethertype_handle, tvb, pinfo, tree, ðertype_data); } + return tvb_captured_length(tvb); } void @@ -295,9 +290,8 @@ dissect_ieee8021ah_common(tvbuff_t *tvb, packet_info *pinfo, } static -void -dissect_ieee8021ah(tvbuff_t *tvb, packet_info *pinfo, - proto_tree *tree) +int dissect_ieee8021ah(tvbuff_t *tvb, packet_info *pinfo, + proto_tree *tree, void* data _U_) { proto_item *pi; guint32 tci; @@ -326,6 +320,7 @@ dissect_ieee8021ah(tvbuff_t *tvb, packet_info *pinfo, } else { dissect_ieee8021ah_common(tvb, pinfo, tree, NULL, proto_tree_index); } + return tvb_captured_length(tvb); } /* Protocol Registration **************************************************/ @@ -428,9 +423,9 @@ proto_reg_handoff_ieee8021ah(void) if (!prefs_initialized){ dissector_handle_t ieee8021ad_handle; - ieee8021ah_handle = create_dissector_handle(dissect_ieee8021ah, + ieee8021ah_handle = new_create_dissector_handle(dissect_ieee8021ah, proto_ieee8021ah); - ieee8021ad_handle = create_dissector_handle(dissect_ieee8021ad, + ieee8021ad_handle = new_create_dissector_handle(dissect_ieee8021ad, proto_ieee8021ad); dissector_add_uint("ethertype", ETHERTYPE_IEEE_802_1AD, ieee8021ad_handle); ethertype_handle = find_dissector("ethertype"); diff --git a/epan/dissectors/packet-ieee802a.c b/epan/dissectors/packet-ieee802a.c index 465a5c55ab..1ee75ac476 100644 --- a/epan/dissectors/packet-ieee802a.c +++ b/epan/dissectors/packet-ieee802a.c @@ -76,8 +76,8 @@ ieee802a_add_oui(guint32 oui, const char *table_name, const char *table_ui_name, g_hash_table_insert(oui_info_table, GUINT_TO_POINTER(oui), new_info); } -static void -dissect_ieee802a(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ieee802a(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *ieee802a_tree; proto_item *ti; @@ -128,16 +128,15 @@ dissect_ieee802a(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) hf = hf_ieee802a_pid; subdissector_table = NULL; } - if (tree) - proto_tree_add_uint(ieee802a_tree, hf, tvb, 3, 2, pid); + + proto_tree_add_uint(ieee802a_tree, hf, tvb, 3, 2, pid); next_tvb = tvb_new_subset_remaining(tvb, 5); - if (subdissector_table != NULL) { + if ((subdissector_table == NULL) || /* do lookup with the subdissector table */ - if (dissector_try_uint(subdissector_table, pid, next_tvb, - pinfo, tree)) - return; + (!dissector_try_uint(subdissector_table, pid, next_tvb, pinfo, tree))) { + call_dissector(data_handle, next_tvb, pinfo, tree); } - call_dissector(data_handle, next_tvb, pinfo, tree); + return tvb_captured_length(tvb); } void @@ -176,7 +175,7 @@ proto_reg_handoff_ieee802a(void) data_handle = find_dissector("data"); - ieee802a_handle = create_dissector_handle(dissect_ieee802a, + ieee802a_handle = new_create_dissector_handle(dissect_ieee802a, proto_ieee802a); dissector_add_uint("ethertype", ETHERTYPE_IEEE802_OUI_EXTENDED, ieee802a_handle); diff --git a/epan/dissectors/packet-igmp.c b/epan/dissectors/packet-igmp.c index aba1e51b3e..ecd6505295 100644 --- a/epan/dissectors/packet-igmp.c +++ b/epan/dissectors/packet-igmp.c @@ -905,8 +905,8 @@ dissect_igmp_mtrace(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, return offset; } -static void -dissect_igmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_igmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) { int offset = 0; unsigned char type; @@ -917,6 +917,7 @@ dissect_igmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) { dissect_igmp_unknown(tvb, pinfo, parent_tree); } + return tvb_captured_length(tvb); } void @@ -1119,7 +1120,7 @@ proto_reg_handoff_igmp(void) igmp_mquery_handle, igmp_mtrace_handle, igmp_report_handle; range_t *igmpv0_range = NULL; - igmp_handle = create_dissector_handle(dissect_igmp, proto_igmp); + igmp_handle = new_create_dissector_handle(dissect_igmp, proto_igmp); dissector_add_uint("ip.proto", IP_PROTO_IGMP, igmp_handle); /* IGMP v0 */ diff --git a/epan/dissectors/packet-igrp.c b/epan/dissectors/packet-igrp.c index d880aedd87..ad79b4c87d 100644 --- a/epan/dissectors/packet-igrp.c +++ b/epan/dissectors/packet-igrp.c @@ -65,7 +65,7 @@ static expert_field ei_igrp_version = EI_INIT; static void dissect_vektor_igrp (tvbuff_t *tvb, proto_tree *igrp_vektor_tree, guint8 network); -static void dissect_igrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_igrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint8 ver_and_opcode,version,opcode,network; gint offset=IGRP_HEADER_LENGTH; @@ -80,7 +80,6 @@ static void dissect_igrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ver_and_opcode = tvb_get_guint8(tvb,0); - switch (ver_and_opcode) { case 0x11: col_set_str(pinfo->cinfo, COL_INFO, "Response" ); @@ -93,8 +92,6 @@ static void dissect_igrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } - - if (tree) { ti = proto_tree_add_protocol_format(tree, proto_igrp, tvb, 0, -1, "Cisco IGRP"); @@ -152,6 +149,7 @@ static void dissect_igrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(igrp_tree, hf_igrp_checksum, tvb, 10, 2, ENC_BIG_ENDIAN); } + return tvb_captured_length(tvb); } static void dissect_vektor_igrp (tvbuff_t *tvb, proto_tree *igrp_vektor_tree, guint8 network) @@ -258,7 +256,7 @@ proto_reg_handoff_igrp(void) { dissector_handle_t igrp_handle; - igrp_handle = create_dissector_handle(dissect_igrp, proto_igrp); + igrp_handle = new_create_dissector_handle(dissect_igrp, proto_igrp); dissector_add_uint("ip.proto", IP_PROTO_IGRP, igrp_handle); } diff --git a/epan/dissectors/packet-infiniband.c b/epan/dissectors/packet-infiniband.c index 8048ce2d51..10e8e0107e 100644 --- a/epan/dissectors/packet-infiniband.c +++ b/epan/dissectors/packet-infiniband.c @@ -134,8 +134,6 @@ typedef enum { /* Forward-declarations */ -static void dissect_roce(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); -static void dissect_rroce(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); static void dissect_infiniband_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, ib_packet_start_header starts_with); static gint32 find_next_header_sequence(struct infinibandinfo* ibInfo); static gboolean contains(guint32 value, guint32* arr, int length); @@ -1495,21 +1493,23 @@ static void table_destroy_notify(gpointer data) { /* Helper dissector for correctly dissecting RRoCE packets (encapsulated within an IP */ /* frame). The only difference from regular IB packets is that RRoCE packets do not contain */ /* a LRH, and always start with a BTH. */ -static void -dissect_rroce(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_rroce(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { /* this is a RRoCE packet, so signal the IB dissector not to look for LRH/GRH */ dissect_infiniband_common(tvb, pinfo, tree, IB_PACKET_STARTS_WITH_BTH); + return tvb_captured_length(tvb); } /* Helper dissector for correctly dissecting RoCE packets (encapsulated within an Ethernet */ /* frame). The only difference from regular IB packets is that RoCE packets do not contain */ /* a LRH, and always start with a GRH. */ -static void -dissect_roce(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_roce(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { /* this is a RoCE packet, so signal the IB dissector not to look for LRH */ dissect_infiniband_common(tvb, pinfo, tree, IB_PACKET_STARTS_WITH_GRH); + return tvb_captured_length(tvb); } static int @@ -7466,11 +7466,11 @@ void proto_reg_handoff_infiniband(void) dissector_add_uint("erf.types.type", ERF_TYPE_INFINIBAND_LINK, ib_link_handle); /* create and announce an anonymous RoCE dissector */ - roce_handle = create_dissector_handle(dissect_roce, proto_infiniband); + roce_handle = new_create_dissector_handle(dissect_roce, proto_infiniband); dissector_add_uint("ethertype", ETHERTYPE_ROCE, roce_handle); /* create and announce an anonymous RRoCE dissector */ - rroce_handle = create_dissector_handle(dissect_rroce, proto_infiniband); + rroce_handle = new_create_dissector_handle(dissect_rroce, proto_infiniband); if (!initialized) { initialized = TRUE; diff --git a/epan/dissectors/packet-ipfc.c b/epan/dissectors/packet-ipfc.c index 9108671239..b1bbee44bb 100644 --- a/epan/dissectors/packet-ipfc.c +++ b/epan/dissectors/packet-ipfc.c @@ -56,8 +56,8 @@ capture_ipfc (const guchar *pd, int len, packet_counts *ld) capture_llc(pd, 16, len, ld); } -static void -dissect_ipfc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ipfc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { /* Set up structures needed to add the protocol subtree and manage it */ @@ -80,6 +80,7 @@ dissect_ipfc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) next_tvb = tvb_new_subset_remaining (tvb, 16); call_dissector(llc_handle, next_tvb, pinfo, tree); + return tvb_captured_length(tvb); } /* Register the protocol with Wireshark */ @@ -124,7 +125,7 @@ proto_reg_handoff_ipfc (void) { dissector_handle_t ipfc_handle; - ipfc_handle = create_dissector_handle (dissect_ipfc, proto_ipfc); + ipfc_handle = new_create_dissector_handle (dissect_ipfc, proto_ipfc); dissector_add_uint("wtap_encap", WTAP_ENCAP_IP_OVER_FC, ipfc_handle); llc_handle = find_dissector ("llc"); diff --git a/epan/dissectors/packet-ipnet.c b/epan/dissectors/packet-ipnet.c index 88769310ce..34a48847a7 100644 --- a/epan/dissectors/packet-ipnet.c +++ b/epan/dissectors/packet-ipnet.c @@ -57,8 +57,8 @@ static const value_string htype_vals[] = { { 0, NULL } }; -static void -dissect_ipnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ipnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *fh_tree; proto_item *ti; @@ -100,6 +100,7 @@ dissect_ipnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) default: break; } + return tvb_captured_length(tvb); } void @@ -150,7 +151,7 @@ proto_reg_handoff_ipnet(void) ip_handle = find_dissector("ip"); ipv6_handle = find_dissector("ipv6"); - ipnet_handle = create_dissector_handle(dissect_ipnet, proto_ipnet); + ipnet_handle = new_create_dissector_handle(dissect_ipnet, proto_ipnet); dissector_add_uint("wtap_encap", WTAP_ENCAP_IPNET, ipnet_handle); } diff --git a/epan/dissectors/packet-ipoib.c b/epan/dissectors/packet-ipoib.c index 8604a357cb..6731556560 100644 --- a/epan/dissectors/packet-ipoib.c +++ b/epan/dissectors/packet-ipoib.c @@ -40,8 +40,8 @@ static dissector_handle_t arp_handle; static dissector_handle_t ip_handle; static dissector_handle_t ipv6_handle; -static void -dissect_ipoib(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ipoib(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *fh_tree; proto_item *ti; @@ -79,6 +79,7 @@ dissect_ipoib(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) default: break; } + return tvb_captured_length(tvb); } void @@ -116,7 +117,7 @@ proto_reg_handoff_ipoib(void) ip_handle = find_dissector("ip"); ipv6_handle = find_dissector("ipv6"); - ipoib_handle = create_dissector_handle(dissect_ipoib, proto_ipoib); + ipoib_handle = new_create_dissector_handle(dissect_ipoib, proto_ipoib); dissector_add_uint("wtap_encap", WTAP_ENCAP_IP_OVER_IB, ipoib_handle); } diff --git a/epan/dissectors/packet-ipp.c b/epan/dissectors/packet-ipp.c index 9c13c7b1dd..d8a074c206 100644 --- a/epan/dissectors/packet-ipp.c +++ b/epan/dissectors/packet-ipp.c @@ -190,8 +190,8 @@ static void add_charstring_value(const gchar *tag_desc, proto_tree *tree, static int add_value_head(const gchar *tag_desc, proto_tree *tree, tvbuff_t *tvb, int offset, int name_length, int value_length, char **name_val); -static void -dissect_ipp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ipp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *ipp_tree; proto_item *ti; @@ -207,59 +207,58 @@ dissect_ipp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) else col_set_str(pinfo->cinfo, COL_INFO, "IPP response"); - if (tree) { - ti = proto_tree_add_item(tree, proto_ipp, tvb, offset, -1, ENC_NA); - ipp_tree = proto_item_add_subtree(ti, ett_ipp); + ti = proto_tree_add_item(tree, proto_ipp, tvb, offset, -1, ENC_NA); + ipp_tree = proto_item_add_subtree(ti, ett_ipp); - proto_tree_add_item(ipp_tree, hf_ipp_version, tvb, offset, 2, ENC_BIG_ENDIAN); - offset += 2; + proto_tree_add_item(ipp_tree, hf_ipp_version, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; - if (is_request) { - proto_tree_add_item(ipp_tree, hf_ipp_operation_id, tvb, offset, 2, ENC_BIG_ENDIAN); - } else { - status_code = tvb_get_ntohs(tvb, offset); - switch (status_code & STATUS_TYPE_MASK) { + if (is_request) { + proto_tree_add_item(ipp_tree, hf_ipp_operation_id, tvb, offset, 2, ENC_BIG_ENDIAN); + } else { + status_code = tvb_get_ntohs(tvb, offset); + switch (status_code & STATUS_TYPE_MASK) { - case STATUS_SUCCESSFUL: - status_type = "Successful"; - break; + case STATUS_SUCCESSFUL: + status_type = "Successful"; + break; - case STATUS_INFORMATIONAL: - status_type = "Informational"; - break; + case STATUS_INFORMATIONAL: + status_type = "Informational"; + break; - case STATUS_REDIRECTION: - status_type = "Redirection"; - break; + case STATUS_REDIRECTION: + status_type = "Redirection"; + break; - case STATUS_CLIENT_ERROR: - status_type = "Client error"; - break; + case STATUS_CLIENT_ERROR: + status_type = "Client error"; + break; - case STATUS_SERVER_ERROR: - status_type = "Server error"; - break; + case STATUS_SERVER_ERROR: + status_type = "Server error"; + break; - default: - status_type = "Unknown"; - break; - } - proto_tree_add_uint_format_value(ipp_tree, hf_ipp_status_code, tvb, offset, 2, status_code, - "%s (%s)", status_type, val_to_str(status_code, status_vals, "0x804x")); + default: + status_type = "Unknown"; + break; } - offset += 2; + proto_tree_add_uint_format_value(ipp_tree, hf_ipp_status_code, tvb, offset, 2, status_code, + "%s (%s)", status_type, val_to_str(status_code, status_vals, "0x804x")); + } + offset += 2; - proto_tree_add_item(ipp_tree, hf_ipp_request_id, tvb, offset, 4, ENC_BIG_ENDIAN); - offset += 4; + proto_tree_add_item(ipp_tree, hf_ipp_request_id, tvb, offset, 4, ENC_BIG_ENDIAN); + offset += 4; - offset = parse_attributes(tvb, offset, ipp_tree); + offset = parse_attributes(tvb, offset, ipp_tree); - if (tvb_offset_exists(tvb, offset)) { - call_dissector(data_handle, - tvb_new_subset_remaining(tvb, offset), pinfo, - ipp_tree); - } + if (tvb_offset_exists(tvb, offset)) { + call_dissector(data_handle, + tvb_new_subset_remaining(tvb, offset), pinfo, + ipp_tree); } + return tvb_captured_length(tvb); } #define TAG_TYPE(x) ((x) & 0xF0) @@ -718,7 +717,7 @@ proto_reg_handoff_ipp(void) /* * Register ourselves as running atop HTTP and using port 631. */ - ipp_handle = create_dissector_handle(dissect_ipp, proto_ipp); + ipp_handle = new_create_dissector_handle(dissect_ipp, proto_ipp); http_dissector_add(631, ipp_handle); dissector_add_string("media_type", "application/ipp", ipp_handle); data_handle = find_dissector("data"); diff --git a/epan/dissectors/packet-ipsec-udp.c b/epan/dissectors/packet-ipsec-udp.c index 6239b099f0..01c17d79d2 100644 --- a/epan/dissectors/packet-ipsec-udp.c +++ b/epan/dissectors/packet-ipsec-udp.c @@ -43,8 +43,8 @@ static dissector_handle_t isakmp_handle; * UDP Encapsulation of IPsec Packets * draft-ietf-ipsec-udp-encaps-06.txt */ -static void -dissect_udpencap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_udpencap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { tvbuff_t *next_tvb; proto_tree *udpencap_tree; @@ -76,6 +76,7 @@ dissect_udpencap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) call_dissector(esp_handle, tvb, pinfo, tree); } } + return tvb_captured_length(tvb); } void @@ -106,7 +107,7 @@ proto_reg_handoff_udpencap(void) esp_handle = find_dissector("esp"); isakmp_handle = find_dissector("isakmp"); - udpencap_handle = create_dissector_handle(dissect_udpencap, proto_udpencap); + udpencap_handle = new_create_dissector_handle(dissect_udpencap, proto_udpencap); dissector_add_uint("udp.port", 4500, udpencap_handle); } diff --git a/epan/dissectors/packet-ipsec.c b/epan/dissectors/packet-ipsec.c index ff0063f355..4e52241fe6 100644 --- a/epan/dissectors/packet-ipsec.c +++ b/epan/dissectors/packet-ipsec.c @@ -2233,8 +2233,8 @@ dissect_esp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) } -static void -dissect_ipcomp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ipcomp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dissector_data _U_) { proto_tree *ipcomp_tree; proto_item *ti; @@ -2242,6 +2242,7 @@ dissect_ipcomp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) const char *p; dissector_handle_t dissector_handle; guint32 saved_match_uint; + tvbuff_t *data, *decomp; /* * load the top pane info. This should be overwritten by @@ -2263,9 +2264,6 @@ dissect_ipcomp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * populate a tree in the second pane with the status of the link layer * (ie none) */ - if (tree) { - tvbuff_t *data, *decomp; - ti = proto_tree_add_item(tree, proto_ipcomp, tvb, 0, -1, ENC_NA); ipcomp_tree = proto_item_add_subtree(ti, ett_ipcomp); @@ -2303,7 +2301,8 @@ dissect_ipcomp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) call_dissector(dissector_handle, decomp, pinfo, tree); pinfo->match_uint = saved_match_uint; } - } + + return tvb_captured_length(tvb); } static void ipsec_init_protocol(void) @@ -2554,7 +2553,7 @@ proto_reg_handoff_ipsec(void) dissector_add_uint("ip.proto", IP_PROTO_AH, ah_handle); esp_handle = find_dissector("esp"); dissector_add_uint("ip.proto", IP_PROTO_ESP, esp_handle); - ipcomp_handle = create_dissector_handle(dissect_ipcomp, proto_ipcomp); + ipcomp_handle = new_create_dissector_handle(dissect_ipcomp, proto_ipcomp); dissector_add_uint("ip.proto", IP_PROTO_IPCOMP, ipcomp_handle); ipv6_ah_handle = new_create_dissector_handle(dissect_ah_header, proto_ah ); dissector_add_uint("ipv6.nxt", IP_PROTO_AH, ipv6_ah_handle); diff --git a/epan/dissectors/packet-ipsi-ctl.c b/epan/dissectors/packet-ipsi-ctl.c index 3608106a29..3bbf9c1910 100644 --- a/epan/dissectors/packet-ipsi-ctl.c +++ b/epan/dissectors/packet-ipsi-ctl.c @@ -47,7 +47,7 @@ static int hf_ipsictl_data = -1; static gint ett_ipsictl = -1; static gint ett_ipsictl_pdu = -1; -static void dissect_ipsictl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_ipsictl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *ipsictl_tree; @@ -162,9 +162,7 @@ static void dissect_ipsictl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (!haspdus) { - if (tree) { - proto_tree_add_item(ipsictl_tree, hf_ipsictl_data, tvb, offset, -1, ENC_NA); - } + proto_tree_add_item(ipsictl_tree, hf_ipsictl_data, tvb, offset, -1, ENC_NA); } col_set_str(pinfo->cinfo, COL_PROTOCOL, "IPSICTL"); @@ -183,6 +181,7 @@ static void dissect_ipsictl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_INFO, "Initialization"); } + return tvb_captured_length(tvb); } /* dissect_ipsictl */ @@ -236,7 +235,7 @@ void proto_reg_handoff_ipsictl(void) dissector_handle_t ipsictl_handle = NULL; - ipsictl_handle = create_dissector_handle(dissect_ipsictl, proto_ipsictl); + ipsictl_handle = new_create_dissector_handle(dissect_ipsictl, proto_ipsictl); dissector_add_uint("tcp.port", IPSICTL_PORT, ipsictl_handle); diff --git a/epan/dissectors/packet-ipvs-syncd.c b/epan/dissectors/packet-ipvs-syncd.c index 56fe163268..036e2710e9 100644 --- a/epan/dissectors/packet-ipvs-syncd.c +++ b/epan/dissectors/packet-ipvs-syncd.c @@ -102,8 +102,8 @@ static const value_string connection_type_strings[] = { }; -static void -dissect_ipvs_syncd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_ipvs_syncd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) { proto_tree *tree; proto_item *item; @@ -200,6 +200,8 @@ dissect_ipvs_syncd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) } } + + return tvb_captured_length(tvb); } void @@ -331,7 +333,7 @@ proto_reg_handoff_ipvs_syncd(void) { dissector_handle_t ipvs_syncd_handle; - ipvs_syncd_handle = create_dissector_handle(dissect_ipvs_syncd, proto_ipvs_syncd); + ipvs_syncd_handle = new_create_dissector_handle(dissect_ipvs_syncd, proto_ipvs_syncd); dissector_add_uint("udp.port", IPVS_SYNCD_PORT, ipvs_syncd_handle); } diff --git a/epan/dissectors/packet-ipxwan.c b/epan/dissectors/packet-ipxwan.c index 0af70c0f63..113c55ef9f 100644 --- a/epan/dissectors/packet-ipxwan.c +++ b/epan/dissectors/packet-ipxwan.c @@ -122,8 +122,8 @@ static const value_string ipxwan_compression_type_vals[] = { { 0, NULL } }; -static void -dissect_ipxwan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ipxwan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *ipxwan_tree = NULL; @@ -142,194 +142,190 @@ dissect_ipxwan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "IPX WAN"); col_clear(pinfo->cinfo, COL_INFO); - if (tree) { - ti = proto_tree_add_item(tree, proto_ipxwan, tvb, 0, -1, - ENC_NA); - ipxwan_tree = proto_item_add_subtree(ti, ett_ipxwan); - } + ti = proto_tree_add_item(tree, proto_ipxwan, tvb, 0, -1, + ENC_NA); + ipxwan_tree = proto_item_add_subtree(ti, ett_ipxwan); - if (tree) { - proto_tree_add_item(ipxwan_tree, hf_ipxwan_identifier, tvb, + proto_tree_add_item(ipxwan_tree, hf_ipxwan_identifier, tvb, offset, 4, ENC_ASCII|ENC_NA); - } + offset += 4; packet_type = tvb_get_guint8(tvb, offset); col_add_str(pinfo->cinfo, COL_INFO, val_to_str(packet_type, ipxwan_packet_type_vals, "Unknown packet type %u")); - if (tree) { - proto_tree_add_uint(ipxwan_tree, hf_ipxwan_packet_type, tvb, - offset, 1, packet_type); - offset += 1; - proto_tree_add_item(ipxwan_tree, hf_ipxwan_node_id, tvb, - offset, 4, ENC_BIG_ENDIAN); - offset += 4; - proto_tree_add_item(ipxwan_tree, hf_ipxwan_sequence_number, tvb, - offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_uint(ipxwan_tree, hf_ipxwan_packet_type, tvb, + offset, 1, packet_type); + offset += 1; + proto_tree_add_item(ipxwan_tree, hf_ipxwan_node_id, tvb, + offset, 4, ENC_BIG_ENDIAN); + offset += 4; + proto_tree_add_item(ipxwan_tree, hf_ipxwan_sequence_number, tvb, + offset, 1, ENC_BIG_ENDIAN); + offset += 1; + num_options = tvb_get_guint8(tvb, offset); + proto_tree_add_uint(ipxwan_tree, hf_ipxwan_num_options, tvb, + offset, 1, num_options); + offset += 1; + + while (num_options != 0) { + option_number = tvb_get_guint8(tvb, offset); + option_tree = proto_tree_add_subtree_format(ipxwan_tree, tvb, offset, -1, + ett_ipxwan_option, &ti, "Option: %s", + val_to_str(option_number, ipxwan_option_num_vals, + "Unknown (%u)")); + + proto_tree_add_uint(option_tree, hf_ipxwan_option_num, + tvb, offset, 1, option_number); offset += 1; - num_options = tvb_get_guint8(tvb, offset); - proto_tree_add_uint(ipxwan_tree, hf_ipxwan_num_options, tvb, - offset, 1, num_options); + proto_tree_add_item(option_tree, hf_ipxwan_accept_option, + tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; - - while (num_options != 0) { - option_number = tvb_get_guint8(tvb, offset); - option_tree = proto_tree_add_subtree_format(ipxwan_tree, tvb, offset, -1, - ett_ipxwan_option, &ti, "Option: %s", - val_to_str(option_number, ipxwan_option_num_vals, - "Unknown (%u)")); - - proto_tree_add_uint(option_tree, hf_ipxwan_option_num, - tvb, offset, 1, option_number); - offset += 1; - proto_tree_add_item(option_tree, hf_ipxwan_accept_option, - tvb, offset, 1, ENC_BIG_ENDIAN); - offset += 1; - option_data_len = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(option_tree, hf_ipxwan_option_data_len, - tvb, offset, 2, option_data_len); - offset += 2; - proto_item_set_len(ti, option_data_len+4); - switch (option_number) { - - case OPT_ROUTING_TYPE: - if (option_data_len != 1) { - expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len, - "Bogus length: %u, should be 1", option_data_len); - } else { - proto_tree_add_item(option_tree, - hf_ipxwan_routing_type, tvb, - offset, 1, ENC_BIG_ENDIAN); - } - break; - - case OPT_RIP_SAP_INFO_EXCHANGE: - if (option_data_len != 54) { - expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len, - "Bogus length: %u, should be 54", option_data_len); - } else { - wan_link_delay = tvb_get_ntohs(tvb, - offset); - proto_tree_add_uint_format_value(option_tree, - hf_ipxwan_wan_link_delay, tvb, - offset, 2, wan_link_delay, - "%ums", - wan_link_delay); - proto_tree_add_item(option_tree, - hf_ipxwan_common_network_number, - tvb, offset+2, 4, ENC_NA); - proto_tree_add_item(option_tree, - hf_ipxwan_router_name, tvb, - offset+6, 48, ENC_ASCII|ENC_NA); - } - break; - - case OPT_NLSP_INFORMATION: - if (option_data_len != 8) { - expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len, - "Bogus length: %u, should be 8", option_data_len); - } else { - delay = tvb_get_ntohl(tvb, offset); - proto_tree_add_uint_format_value(option_tree, - hf_ipxwan_delay, tvb, - offset, 4, delay, - "%uus", delay); - throughput = tvb_get_ntohl(tvb, offset); - proto_tree_add_uint_format_value(option_tree, - hf_ipxwan_throughput, tvb, - offset, 4, throughput, - "%uus", - throughput); - } - break; - - case OPT_NLSP_RAW_THROUGHPUT_DATA: - if (option_data_len != 8) { - expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len, - "Bogus length: %u, should be 8", option_data_len); - } else { - proto_tree_add_item(option_tree, - hf_ipxwan_request_size, tvb, - offset, 4, ENC_BIG_ENDIAN); - delta_time = tvb_get_ntohl(tvb, offset); - proto_tree_add_uint_format_value(option_tree, - hf_ipxwan_delta_time, tvb, - offset, 4, delta_time, - "%uus", - delta_time); - } - break; - - case OPT_EXTENDED_NODE_ID: - if (option_data_len != 4) { - expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len, - "Bogus length: %u, should be 4", option_data_len); - } else { - proto_tree_add_item(option_tree, - hf_ipxwan_extended_node_id, tvb, - offset, 4, ENC_NA); - } - break; - - case OPT_NODE_NUMBER: - if (option_data_len != 6) { - expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len, - "Bogus length: %u, should be 6", option_data_len); - } else { - proto_tree_add_item(option_tree, - hf_ipxwan_node_number, tvb, - offset, 6, ENC_NA); - } - break; - - case OPT_COMPRESSION: - if (option_data_len < 1) { - expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len, - "Bogus length: %u, should be >= 1", option_data_len); - } else { - compression_type = tvb_get_guint8(tvb, - offset); - ti = proto_tree_add_uint(option_tree, - hf_ipxwan_compression_type, tvb, - offset, 1, compression_type); - switch (compression_type) { - - case COMP_TYPE_TELEBIT: - if (option_data_len < 3) { - expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len, - "Bogus length: %u, should be >= 3", option_data_len); - } else { - proto_tree_add_item(option_tree, hf_ipxwan_compression_options, - tvb, offset+1, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(option_tree, hf_ipxwan_compression_slots, - tvb, offset+2, 1, ENC_BIG_ENDIAN); - } - break; - - default: - proto_tree_add_item(option_tree, hf_ipxwan_compression_parameters, - tvb, offset+1, option_data_len-1, ENC_NA); - break; + option_data_len = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(option_tree, hf_ipxwan_option_data_len, + tvb, offset, 2, option_data_len); + offset += 2; + proto_item_set_len(ti, option_data_len+4); + switch (option_number) { + + case OPT_ROUTING_TYPE: + if (option_data_len != 1) { + expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len, + "Bogus length: %u, should be 1", option_data_len); + } else { + proto_tree_add_item(option_tree, + hf_ipxwan_routing_type, tvb, + offset, 1, ENC_BIG_ENDIAN); + } + break; + + case OPT_RIP_SAP_INFO_EXCHANGE: + if (option_data_len != 54) { + expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len, + "Bogus length: %u, should be 54", option_data_len); + } else { + wan_link_delay = tvb_get_ntohs(tvb, + offset); + proto_tree_add_uint_format_value(option_tree, + hf_ipxwan_wan_link_delay, tvb, + offset, 2, wan_link_delay, + "%ums", + wan_link_delay); + proto_tree_add_item(option_tree, + hf_ipxwan_common_network_number, + tvb, offset+2, 4, ENC_NA); + proto_tree_add_item(option_tree, + hf_ipxwan_router_name, tvb, + offset+6, 48, ENC_ASCII|ENC_NA); + } + break; + + case OPT_NLSP_INFORMATION: + if (option_data_len != 8) { + expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len, + "Bogus length: %u, should be 8", option_data_len); + } else { + delay = tvb_get_ntohl(tvb, offset); + proto_tree_add_uint_format_value(option_tree, + hf_ipxwan_delay, tvb, + offset, 4, delay, + "%uus", delay); + throughput = tvb_get_ntohl(tvb, offset); + proto_tree_add_uint_format_value(option_tree, + hf_ipxwan_throughput, tvb, + offset, 4, throughput, + "%uus", + throughput); + } + break; + + case OPT_NLSP_RAW_THROUGHPUT_DATA: + if (option_data_len != 8) { + expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len, + "Bogus length: %u, should be 8", option_data_len); + } else { + proto_tree_add_item(option_tree, + hf_ipxwan_request_size, tvb, + offset, 4, ENC_BIG_ENDIAN); + delta_time = tvb_get_ntohl(tvb, offset); + proto_tree_add_uint_format_value(option_tree, + hf_ipxwan_delta_time, tvb, + offset, 4, delta_time, + "%uus", + delta_time); + } + break; + + case OPT_EXTENDED_NODE_ID: + if (option_data_len != 4) { + expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len, + "Bogus length: %u, should be 4", option_data_len); + } else { + proto_tree_add_item(option_tree, + hf_ipxwan_extended_node_id, tvb, + offset, 4, ENC_NA); + } + break; + + case OPT_NODE_NUMBER: + if (option_data_len != 6) { + expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len, + "Bogus length: %u, should be 6", option_data_len); + } else { + proto_tree_add_item(option_tree, + hf_ipxwan_node_number, tvb, + offset, 6, ENC_NA); + } + break; + + case OPT_COMPRESSION: + if (option_data_len < 1) { + expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len, + "Bogus length: %u, should be >= 1", option_data_len); + } else { + compression_type = tvb_get_guint8(tvb, + offset); + ti = proto_tree_add_uint(option_tree, + hf_ipxwan_compression_type, tvb, + offset, 1, compression_type); + switch (compression_type) { + + case COMP_TYPE_TELEBIT: + if (option_data_len < 3) { + expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len, + "Bogus length: %u, should be >= 3", option_data_len); + } else { + proto_tree_add_item(option_tree, hf_ipxwan_compression_options, + tvb, offset+1, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(option_tree, hf_ipxwan_compression_slots, + tvb, offset+2, 1, ENC_BIG_ENDIAN); } - } - break; - - case OPT_PAD: - proto_tree_add_item(option_tree, hf_ipxwan_padding, - tvb, offset, option_data_len, ENC_NA); - break; + break; - default: - proto_tree_add_item(option_tree, hf_ipxwan_option_value, - tvb, offset, option_data_len, ENC_NA); - break; + default: + proto_tree_add_item(option_tree, hf_ipxwan_compression_parameters, + tvb, offset+1, option_data_len-1, ENC_NA); + break; + } } + break; - offset += option_data_len; - num_options--; + case OPT_PAD: + proto_tree_add_item(option_tree, hf_ipxwan_padding, + tvb, offset, option_data_len, ENC_NA); + break; + + default: + proto_tree_add_item(option_tree, hf_ipxwan_option_value, + tvb, offset, option_data_len, ENC_NA); + break; } + + offset += option_data_len; + num_options--; } + return tvb_captured_length(tvb); } void @@ -458,7 +454,7 @@ proto_reg_handoff_ipxwan(void) { dissector_handle_t ipxwan_handle; - ipxwan_handle = create_dissector_handle(dissect_ipxwan, + ipxwan_handle = new_create_dissector_handle(dissect_ipxwan, proto_ipxwan); dissector_add_uint("ipx.socket", IPX_SOCKET_IPXWAN, ipxwan_handle); } diff --git a/epan/dissectors/packet-irc.c b/epan/dissectors/packet-irc.c index d9eee7867f..a1ba34a190 100644 --- a/epan/dissectors/packet-irc.c +++ b/epan/dissectors/packet-irc.c @@ -444,8 +444,8 @@ dissect_irc_response(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int of } } -static void -dissect_irc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_irc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *irc_tree, *ti; gint offset = 0; @@ -494,6 +494,7 @@ dissect_irc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } offset = next_offset; } + return tvb_captured_length(tvb); } void @@ -571,7 +572,7 @@ proto_reg_handoff_irc(void) { dissector_handle_t irc_handle; - irc_handle = create_dissector_handle(dissect_irc, proto_irc); + irc_handle = new_create_dissector_handle(dissect_irc, proto_irc); dissector_add_uint("tcp.port", TCP_PORT_IRC, irc_handle); dissector_add_uint("tcp.port", TCP_PORT_DIRCPROXY, irc_handle); } diff --git a/epan/dissectors/packet-isdn.c b/epan/dissectors/packet-isdn.c index fc27c8978e..80e7d87120 100644 --- a/epan/dissectors/packet-isdn.c +++ b/epan/dissectors/packet-isdn.c @@ -90,8 +90,8 @@ static const value_string channel_vals[] = { { 0, NULL } }; -static void -dissect_isdn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_isdn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *isdn_tree; proto_item *ti; @@ -200,6 +200,8 @@ dissect_isdn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (!try_circuit_dissector(CT_ISDN, pinfo->pseudo_header->isdn.channel, pinfo->fd->num, tvb, pinfo, tree, NULL)) call_dissector(data_handle, tvb, pinfo, tree); + + return tvb_captured_length(tvb); } void @@ -242,7 +244,7 @@ proto_reg_handoff_isdn(void) v120_handle = find_dissector("v120"); data_handle = find_dissector("data"); - isdn_handle = create_dissector_handle(dissect_isdn, proto_isdn); + isdn_handle = new_create_dissector_handle(dissect_isdn, proto_isdn); dissector_add_uint("wtap_encap", WTAP_ENCAP_ISDN, isdn_handle); } diff --git a/epan/dissectors/packet-isi.c b/epan/dissectors/packet-isi.c index c082b207fd..ad4b9de79d 100644 --- a/epan/dissectors/packet-isi.c +++ b/epan/dissectors/packet-isi.c @@ -678,7 +678,7 @@ static int ett_isi_network_gsm_band_info = -1; static expert_field ei_isi_len = EI_INIT; static expert_field ei_isi_unsupported_packet = EI_INIT; -static void dissect_isi_sim_auth(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree) { +static int dissect_isi_sim_auth(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree, void* data _U_) { proto_item *item; proto_tree *tree; guint8 cmd, code; @@ -821,9 +821,10 @@ static void dissect_isi_sim_auth(tvbuff_t *tvb, packet_info *pinfo, proto_item * col_set_str(pinfo->cinfo, COL_INFO, "unknown SIM Authentication packet"); break; } + return tvb_captured_length(tvb); } -static void dissect_isi_sim(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree) { +static int dissect_isi_sim(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree, void* data _U_) { proto_item *item; proto_tree *tree; guint8 cmd, code; @@ -1080,9 +1081,10 @@ static void dissect_isi_sim(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitr col_set_str(pinfo->cinfo, COL_INFO, "Unknown type"); break; } + return tvb_captured_length(tvb); } -static void dissect_isi_gss(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree) { +static int dissect_isi_gss(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree, void* data _U_) { proto_item *item; proto_tree *tree; guint8 cmd, code; @@ -1168,6 +1170,7 @@ static void dissect_isi_gss(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitr col_set_str(pinfo->cinfo, COL_INFO, "Unknown type"); break; } + return tvb_captured_length(tvb); } static void dissect_isi_gps_data(tvbuff_t *tvb, packet_info *pinfo _U_, proto_item *item _U_, proto_tree *tree) @@ -1283,7 +1286,7 @@ static void dissect_isi_gps_data(tvbuff_t *tvb, packet_info *pinfo _U_, proto_it } -static void dissect_isi_gps(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree) +static int dissect_isi_gps(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree, void* data _U_) { proto_item *item; proto_tree *tree; @@ -1324,9 +1327,10 @@ static void dissect_isi_gps(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitr col_add_fstr(pinfo->cinfo, COL_INFO, "unknown GPS packet (0x%02x)", cmd); break; } + return tvb_captured_length(tvb); } -static void dissect_isi_ss(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree) +static int dissect_isi_ss(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree, void* data _U_) { proto_item *item; proto_tree *tree; @@ -1497,6 +1501,7 @@ static void dissect_isi_ss(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitre col_set_str(pinfo->cinfo, COL_INFO, "Unknown type"); break; } + return tvb_captured_length(tvb); } static void dissect_isi_network_status(tvbuff_t *tvb, packet_info *pinfo _U_, proto_item *item _U_, proto_tree *tree) @@ -1595,7 +1600,7 @@ static void dissect_isi_network_cell_info_ind(tvbuff_t *tvb, packet_info *pinfo, } } -static void dissect_isi_network(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree) { +static int dissect_isi_network(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree, void* data _U_) { proto_item *item; proto_tree *tree; guint8 cmd; @@ -1628,9 +1633,10 @@ static void dissect_isi_network(tvbuff_t *tvb, packet_info *pinfo, proto_item *i expert_add_info(pinfo, item, &ei_isi_unsupported_packet); break; } + return tvb_captured_length(tvb); } -static void dissect_isi_sms(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree) { +static int dissect_isi_sms(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree, void* data _U_) { proto_item *item = NULL; proto_tree *tree = NULL; guint8 cmd, code; @@ -1775,9 +1781,10 @@ static void dissect_isi_sms(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitr col_set_str(pinfo->cinfo, COL_INFO, "Unknown type"); break; } + return tvb_captured_length(tvb); } -static void dissect_isi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { +static int dissect_isi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *isi_tree; proto_item *item, *item_len; tvbuff_t *content_tvb; @@ -1821,6 +1828,8 @@ static void dissect_isi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { /* Call subdissector depending on the resource ID */ if (!dissector_try_uint(isi_resource_dissector_table, resource, content_tvb, pinfo, isi_tree)) call_dissector(data_handle, content_tvb, pinfo, isi_tree); + + return tvb_captured_length(tvb); } /* Experimental approach based upon the one used for PPP*/ @@ -1832,7 +1841,7 @@ static gboolean dissect_usb_isi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t return FALSE; next_tvb = tvb_new_subset_remaining(tvb, 1); - dissect_isi(next_tvb, pinfo, tree); + dissect_isi(next_tvb, pinfo, tree, data); return TRUE; } @@ -2131,17 +2140,17 @@ proto_reg_handoff_isi(void) if(!initialized) { data_handle = find_dissector("data"); - dissector_add_uint("sll.ltype", LINUX_SLL_P_ISI, create_dissector_handle(dissect_isi, proto_isi)); + dissector_add_uint("sll.ltype", LINUX_SLL_P_ISI, new_create_dissector_handle(dissect_isi, proto_isi)); heur_dissector_add("usb.bulk", dissect_usb_isi, "ISI bulk endpoint", "usb_bulk_isi", proto_isi, HEURISTIC_DISABLE); - dissector_add_uint("isi.resource", 0x02, create_dissector_handle(dissect_isi_sms, proto_isi)); - dissector_add_uint("isi.resource", 0x06, create_dissector_handle(dissect_isi_ss, proto_isi)); - dissector_add_uint("isi.resource", 0x08, create_dissector_handle(dissect_isi_sim_auth, proto_isi)); - dissector_add_uint("isi.resource", 0x09, create_dissector_handle(dissect_isi_sim, proto_isi)); - dissector_add_uint("isi.resource", 0x0a, create_dissector_handle(dissect_isi_network, proto_isi)); - dissector_add_uint("isi.resource", 0x32, create_dissector_handle(dissect_isi_gss, proto_isi)); - dissector_add_uint("isi.resource", 0x54, create_dissector_handle(dissect_isi_gps, proto_isi)); + dissector_add_uint("isi.resource", 0x02, new_create_dissector_handle(dissect_isi_sms, proto_isi)); + dissector_add_uint("isi.resource", 0x06, new_create_dissector_handle(dissect_isi_ss, proto_isi)); + dissector_add_uint("isi.resource", 0x08, new_create_dissector_handle(dissect_isi_sim_auth, proto_isi)); + dissector_add_uint("isi.resource", 0x09, new_create_dissector_handle(dissect_isi_sim, proto_isi)); + dissector_add_uint("isi.resource", 0x0a, new_create_dissector_handle(dissect_isi_network, proto_isi)); + dissector_add_uint("isi.resource", 0x32, new_create_dissector_handle(dissect_isi_gss, proto_isi)); + dissector_add_uint("isi.resource", 0x54, new_create_dissector_handle(dissect_isi_gps, proto_isi)); } } diff --git a/epan/dissectors/packet-ismacryp.c b/epan/dissectors/packet-ismacryp.c index aa9dd41c90..9f27142577 100644 --- a/epan/dissectors/packet-ismacryp.c +++ b/epan/dissectors/packet-ismacryp.c @@ -210,7 +210,7 @@ static gint ett_ismacryp_message = -1; */ /* dissect_ismacryp_v11 gets called if rtp_dyn_payload_type = "enc-mpeg4-generic" i.e. is set via SDP */ -static void dissect_ismacryp_v11(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_ismacryp_v11(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { /* display ISMACryp version */ col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_TAG_ISMACRYP_11); @@ -219,10 +219,11 @@ static void dissect_ismacryp_v11(tvbuff_t *tvb, packet_info *pinfo, proto_tree * col_set_str(pinfo->cinfo, COL_INFO, "(PT=enc-mpeg4-generic)"); dissect_ismacryp_common( tvb, pinfo, tree, V11); + return tvb_captured_length(tvb); } /* dissect_ismacryp_v20 gets called if rtp_dyn_payload_type = "enc-isoff-generic" i.e. is set via SDP */ -static void dissect_ismacryp_v20(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_ismacryp_v20(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { /* display ISMACryp version */ col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_TAG_ISMACRYP_20); @@ -231,12 +232,14 @@ static void dissect_ismacryp_v20(tvbuff_t *tvb, packet_info *pinfo, proto_tree * col_set_str(pinfo->cinfo, COL_INFO, "(PT=enc-isoff-generic)"); dissect_ismacryp_common( tvb, pinfo, tree, V20); + return tvb_captured_length(tvb); } -static void dissect_ismacryp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_ismacryp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { col_set_str(pinfo->cinfo, COL_INFO, "Manual version"); dissect_ismacryp_common( tvb, pinfo, tree, version_type); /* Unknown version type: Use preference */ + return tvb_captured_length(tvb); } static void dissect_ismacryp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint ismacryp_version) @@ -1004,9 +1007,9 @@ void proto_reg_handoff_ismacryp(void) if (!ismacryp_prefs_initialized) { dissector_handle_t ismacryp_v11_handle; dissector_handle_t ismacryp_v20_handle; - ismacryp_handle = create_dissector_handle(dissect_ismacryp, proto_ismacryp); - ismacryp_v11_handle = create_dissector_handle(dissect_ismacryp_v11, proto_ismacryp); - ismacryp_v20_handle = create_dissector_handle(dissect_ismacryp_v20, proto_ismacryp); + ismacryp_handle = new_create_dissector_handle(dissect_ismacryp, proto_ismacryp); + ismacryp_v11_handle = new_create_dissector_handle(dissect_ismacryp_v11, proto_ismacryp); + ismacryp_v20_handle = new_create_dissector_handle(dissect_ismacryp_v20, proto_ismacryp); ismacryp_prefs_initialized = TRUE; dissector_add_string("rtp_dyn_payload_type", "ISMACRYP", ismacryp_handle); dissector_add_string("rtp_dyn_payload_type", "enc-mpeg4-generic", ismacryp_v11_handle); diff --git a/epan/dissectors/packet-ismp.c b/epan/dissectors/packet-ismp.c index 69b5f66caf..fe68fca7b6 100644 --- a/epan/dissectors/packet-ismp.c +++ b/epan/dissectors/packet-ismp.c @@ -487,8 +487,8 @@ dissect_ismp_edp(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *ismp /* Code to actually dissect the packets */ -static void -dissect_ismp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ismp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int offset = 0; guint16 message_type = 0; @@ -534,6 +534,8 @@ dissect_ismp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* if Enterasys Discover Protocol, dissect it */ if(message_type == ISMPTYPE_EDP) dissect_ismp_edp(tvb, pinfo, offset, tree); + + return tvb_captured_length(tvb); } @@ -880,7 +882,7 @@ proto_reg_handoff_ismp(void) { dissector_handle_t ismp_handle; - ismp_handle = create_dissector_handle(dissect_ismp, + ismp_handle = new_create_dissector_handle(dissect_ismp, proto_ismp); dissector_add_uint("ethertype", ETHERTYPE_ISMP, ismp_handle); } diff --git a/epan/dissectors/packet-jpeg.c b/epan/dissectors/packet-jpeg.c index a3752e4c2c..315a9cdf1c 100644 --- a/epan/dissectors/packet-jpeg.c +++ b/epan/dissectors/packet-jpeg.c @@ -177,8 +177,8 @@ static header_field_info hfi_rtp_jpeg_payload JPEG_HFI_INIT = { /* JPEG fields defining a sub tree */ static gint ett_jpeg = -1; -static void -dissect_jpeg( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) +static int +dissect_jpeg( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ ) { proto_item *ti = NULL; proto_tree *jpeg_tree = NULL; @@ -254,6 +254,7 @@ dissect_jpeg( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) /* The rest of the packet is the JPEG data */ proto_tree_add_item( jpeg_tree, &hfi_rtp_jpeg_payload, tvb, offset, -1, ENC_NA ); } + return tvb_captured_length(tvb); } void @@ -296,7 +297,7 @@ proto_register_jpeg(void) proto_register_fields(proto_jpeg, hfi, array_length(hfi)); proto_register_subtree_array(ett, array_length(ett)); - jpeg_handle = create_dissector_handle(dissect_jpeg, proto_jpeg); + jpeg_handle = new_create_dissector_handle(dissect_jpeg, proto_jpeg); /* RFC 2798 */ register_ber_oid_dissector_handle("0.9.2342.19200300.100.1.60", jpeg_handle, proto_jpeg, "jpegPhoto"); diff --git a/epan/dissectors/packet-juniper.c b/epan/dissectors/packet-juniper.c index 297838146c..61ff761fda 100644 --- a/epan/dissectors/packet-juniper.c +++ b/epan/dissectors/packet-juniper.c @@ -926,17 +926,19 @@ dissect_juniper_chdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* wrapper for passing the PIC type to the generic ATM dissector */ -static void -dissect_juniper_atm1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_juniper_atm1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { dissect_juniper_atm(tvb,pinfo,tree, JUNIPER_PIC_ATM1); + return tvb_captured_length(tvb); } /* wrapper for passing the PIC type to the generic ATM dissector */ -static void -dissect_juniper_atm2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_juniper_atm2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { dissect_juniper_atm(tvb,pinfo,tree, JUNIPER_PIC_ATM2); + return tvb_captured_length(tvb); } /* generic ATM dissector */ @@ -1427,8 +1429,8 @@ proto_reg_handoff_juniper(void) ipv4_handle = find_dissector("ip"); data_handle = find_dissector("data"); - juniper_atm2_handle = create_dissector_handle(dissect_juniper_atm2, proto_juniper); - juniper_atm1_handle = create_dissector_handle(dissect_juniper_atm1, proto_juniper); + juniper_atm2_handle = new_create_dissector_handle(dissect_juniper_atm2, proto_juniper); + juniper_atm1_handle = new_create_dissector_handle(dissect_juniper_atm1, proto_juniper); juniper_pppoe_handle = create_dissector_handle(dissect_juniper_pppoe, proto_juniper); juniper_mlppp_handle = create_dissector_handle(dissect_juniper_mlppp, proto_juniper); juniper_mlfr_handle = create_dissector_handle(dissect_juniper_mlfr, proto_juniper); diff --git a/epan/dissectors/packet-kdp.c b/epan/dissectors/packet-kdp.c index 394950d005..7b655d8858 100644 --- a/epan/dissectors/packet-kdp.c +++ b/epan/dissectors/packet-kdp.c @@ -75,9 +75,9 @@ static int hf_kdp_rst_flag = -1; static int hf_kdp_bcst_flag = -1; static int hf_kdp_dup_flag = -1; -static void dissect_kdp(tvbuff_t *tvb, +static int dissect_kdp(tvbuff_t *tvb, packet_info *pinfo, - proto_tree *tree) { + proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *kdp_tree; guint body_len; @@ -257,6 +257,8 @@ static void dissect_kdp(tvbuff_t *tvb, src_flowid_string, packet_errors); } + + return tvb_captured_length(tvb); } void proto_register_kdp(void) { @@ -403,7 +405,7 @@ void proto_register_kdp(void) { void proto_reg_handoff_kdp(void) { dissector_handle_t kdp_handle; - kdp_handle = create_dissector_handle(dissect_kdp, proto_kdp); + kdp_handle = new_create_dissector_handle(dissect_kdp, proto_kdp); dissector_add_uint("udp.port", KDP_PORT, kdp_handle); } diff --git a/epan/dissectors/packet-kink.c b/epan/dissectors/packet-kink.c index 8b6f8a89b9..a2e0527520 100644 --- a/epan/dissectors/packet-kink.c +++ b/epan/dissectors/packet-kink.c @@ -198,8 +198,8 @@ static void dissect_decrypt_kink_encrypt(packet_info *pinfo, tvbuff_t *tvb, prot #endif /* This function is dissecting the kink header. */ -static void -dissect_kink(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){ +static int +dissect_kink(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_){ proto_item *ti = NULL; proto_tree *kink_tree = NULL; guint8 type; @@ -278,6 +278,7 @@ dissect_kink(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){ control_payload(pinfo, tvb, offset, next_payload, kink_tree); + return tvb_captured_length(tvb); } /* This part call the dissect payload function by next_payload value. @@ -992,7 +993,7 @@ void proto_reg_handoff_kink(void) { dissector_handle_t kink_handle = NULL; - kink_handle = create_dissector_handle(dissect_kink, proto_kink); + kink_handle = new_create_dissector_handle(dissect_kink, proto_kink); dissector_add_uint("udp.port", KINK_PORT, kink_handle); diff --git a/epan/dissectors/packet-kpasswd.c b/epan/dissectors/packet-kpasswd.c index 151a3d7585..7d31c9c3b2 100644 --- a/epan/dissectors/packet-kpasswd.c +++ b/epan/dissectors/packet-kpasswd.c @@ -235,10 +235,11 @@ dissect_kpasswd_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboo } -static void -dissect_kpasswd_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_kpasswd_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { dissect_kpasswd_common(tvb, pinfo, tree, FALSE); + return tvb_captured_length(tvb); } static int @@ -325,7 +326,7 @@ proto_reg_handoff_kpasswd(void) dissector_handle_t kpasswd_handle_udp; dissector_handle_t kpasswd_handle_tcp; - kpasswd_handle_udp = create_dissector_handle(dissect_kpasswd_udp, proto_kpasswd); + kpasswd_handle_udp = new_create_dissector_handle(dissect_kpasswd_udp, proto_kpasswd); kpasswd_handle_tcp = new_create_dissector_handle(dissect_kpasswd_tcp, proto_kpasswd); dissector_add_uint("udp.port", UDP_PORT_KPASSWD, kpasswd_handle_udp); dissector_add_uint("tcp.port", TCP_PORT_KPASSWD, kpasswd_handle_tcp); diff --git a/epan/dissectors/packet-l2tp.c b/epan/dissectors/packet-l2tp.c index 1661ef2006..0a859fea15 100644 --- a/epan/dissectors/packet-l2tp.c +++ b/epan/dissectors/packet-l2tp.c @@ -2609,8 +2609,8 @@ dissect_l2tp_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data * or process_l2tpv3_data_ip for Data Messages over IP, based on the * Session ID */ -static void -dissect_l2tp_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_l2tp_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int idx = 0; guint32 sid; /* Session ID */ @@ -2643,7 +2643,7 @@ dissect_l2tp_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) process_l2tpv3_data_ip(tvb, pinfo, tree, l2tp_conv); } - return; + return tvb_captured_length(tvb); } static int dissect_atm_oam_llc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) @@ -3041,7 +3041,7 @@ proto_reg_handoff_l2tp(void) l2tp_udp_handle = new_create_dissector_handle(dissect_l2tp_udp, proto_l2tp); dissector_add_uint("udp.port", UDP_PORT_L2TP, l2tp_udp_handle); - l2tp_ip_handle = create_dissector_handle(dissect_l2tp_ip, proto_l2tp); + l2tp_ip_handle = new_create_dissector_handle(dissect_l2tp_ip, proto_l2tp); dissector_add_uint("ip.proto", IP_PROTO_L2TP, l2tp_ip_handle); /* diff --git a/epan/dissectors/packet-lacp.c b/epan/dissectors/packet-lacp.c index eb91774159..977b6d52f8 100644 --- a/epan/dissectors/packet-lacp.c +++ b/epan/dissectors/packet-lacp.c @@ -113,8 +113,8 @@ static gint ett_lacp_p_flags = -1; * * Notes: */ -static void -dissect_lacp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_lacp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int offset = 0; guint16 raw_word; @@ -314,6 +314,7 @@ dissect_lacp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(lacpdu_tree, hf_lacp_term_reserved, tvb, offset, 50, ENC_NA); } + return tvb_captured_length(tvb); } /* Register the protocol with Wireshark */ @@ -557,7 +558,7 @@ proto_reg_handoff_lacp(void) { dissector_handle_t lacp_handle; - lacp_handle = create_dissector_handle(dissect_lacp, proto_lacp); + lacp_handle = new_create_dissector_handle(dissect_lacp, proto_lacp); dissector_add_uint("slow.subtype", LACP_SUBTYPE, lacp_handle); } diff --git a/epan/dissectors/packet-lapbether.c b/epan/dissectors/packet-lapbether.c index 1388481001..7b9d8b1e1d 100644 --- a/epan/dissectors/packet-lapbether.c +++ b/epan/dissectors/packet-lapbether.c @@ -38,8 +38,8 @@ static gint ett_lapbether = -1; static dissector_handle_t lapb_handle; -static void -dissect_lapbether(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_lapbether(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *lapbether_tree, *ti; int len; @@ -64,6 +64,7 @@ dissect_lapbether(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) next_tvb = tvb_new_subset_length(tvb, 2, len); call_dissector(lapb_handle, next_tvb, pinfo, tree); + return tvb_captured_length(tvb); } void @@ -96,7 +97,7 @@ proto_reg_handoff_lapbether(void) */ lapb_handle = find_dissector("lapb"); - lapbether_handle = create_dissector_handle(dissect_lapbether, + lapbether_handle = new_create_dissector_handle(dissect_lapbether, proto_lapbether); dissector_add_uint("ethertype", ETHERTYPE_DEC, lapbether_handle); diff --git a/epan/dissectors/packet-lbmpdmtcp.c b/epan/dissectors/packet-lbmpdmtcp.c index d9db12d4b2..d130006ce2 100644 --- a/epan/dissectors/packet-lbmpdmtcp.c +++ b/epan/dissectors/packet-lbmpdmtcp.c @@ -307,7 +307,7 @@ static int dissect_lbmpdm_tcp_pdu(tvbuff_t * tvb, packet_info * pinfo, proto_tre /* * dissect_lbmpdm_tcp - The dissector for LBMPDM over TCP */ -static void dissect_lbmpdm_tcp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +static int dissect_lbmpdm_tcp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_) { char * tag_name = NULL; @@ -324,6 +324,7 @@ static void dissect_lbmpdm_tcp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * col_set_fence(pinfo->cinfo, COL_INFO); tcp_dissect_pdus(tvb, pinfo, tree, TRUE, lbmpdm_get_minimum_length(), /* Need at least the msglen */ get_lbmpdm_tcp_pdu_length, dissect_lbmpdm_tcp_pdu, NULL); + return tvb_captured_length(tvb); } static gboolean test_lbmpdm_tcp_packet(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * user_data _U_) @@ -349,7 +350,7 @@ static gboolean test_lbmpdm_tcp_packet(tvbuff_t * tvb, packet_info * pinfo, prot { if (lbmpdm_tcp_tag_find(pinfo) != NULL) { - dissect_lbmpdm_tcp(tvb, pinfo, tree); + dissect_lbmpdm_tcp(tvb, pinfo, tree, user_data); return (TRUE); } else @@ -365,7 +366,7 @@ static gboolean test_lbmpdm_tcp_packet(tvbuff_t * tvb, packet_info * pinfo, prot return (FALSE); } /* One of ours. Probably. */ - dissect_lbmpdm_tcp(tvb, pinfo, tree); + dissect_lbmpdm_tcp(tvb, pinfo, tree, user_data); return (TRUE); } @@ -438,7 +439,7 @@ void proto_reg_handoff_lbmpdm_tcp(void) if (!already_registered) { - lbmpdm_tcp_dissector_handle = create_dissector_handle(dissect_lbmpdm_tcp, lbmpdm_tcp_protocol_handle); + lbmpdm_tcp_dissector_handle = new_create_dissector_handle(dissect_lbmpdm_tcp, lbmpdm_tcp_protocol_handle); dissector_add_for_decode_as("tcp.port", lbmpdm_tcp_dissector_handle); heur_dissector_add("tcp", test_lbmpdm_tcp_packet, "LBMPDM over TCP", "lbmpdm_tcp", lbmpdm_tcp_protocol_handle, HEURISTIC_ENABLE); } diff --git a/epan/dissectors/packet-lge_monitor.c b/epan/dissectors/packet-lge_monitor.c index 817131d404..d24d34029a 100644 --- a/epan/dissectors/packet-lge_monitor.c +++ b/epan/dissectors/packet-lge_monitor.c @@ -63,8 +63,8 @@ static const value_string lge_monitor_prot_vals[] = { #define LGEMON_PROTO_HEADER_LENGTH 12 /* Code to actually dissect the packets */ -static void -dissect_lge_monitor(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_lge_monitor(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int offset = 0; guint32 lge_monitor_proto_id; @@ -101,15 +101,15 @@ dissect_lge_monitor(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; case 2: /* SCTP */ call_dissector(sctp_handle, next_tvb, pinfo, tree); - return; + break; case 3: /* M3UA */ call_dissector(m3ua_handle, next_tvb, pinfo, tree); - return; + break; default: proto_tree_add_item(lge_monitor_tree, hf_lge_monitor_data, tvb, offset, -1, ENC_NA); break; } - return; + return tvb_captured_length(tvb); } @@ -121,7 +121,7 @@ proto_reg_handoff_lge_monitor(void) static gboolean lge_monitor_prefs_initialized = FALSE; if (!lge_monitor_prefs_initialized) { - lge_monitor_handle = create_dissector_handle(dissect_lge_monitor, proto_lge_monitor); + lge_monitor_handle = new_create_dissector_handle(dissect_lge_monitor, proto_lge_monitor); dissector_add_for_decode_as("udp.port", lge_monitor_handle); mtp3_handle = find_dissector("mtp3"); m3ua_handle = find_dissector("m3ua"); diff --git a/epan/dissectors/packet-linx.c b/epan/dissectors/packet-linx.c index 0b362e2a76..b624522f6f 100644 --- a/epan/dissectors/packet-linx.c +++ b/epan/dissectors/packet-linx.c @@ -283,8 +283,8 @@ static const value_string linx_conn_cmd[] = { { 0, NULL} }; -static void -dissect_linx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_linx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint32 dword; int offset = 0; @@ -639,6 +639,7 @@ dissect_linx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } + return tvb_captured_length(tvb); } @@ -838,7 +839,7 @@ proto_reg_handoff_linx(void) { dissector_handle_t linx_handle; - linx_handle = create_dissector_handle(dissect_linx, proto_linx); + linx_handle = new_create_dissector_handle(dissect_linx, proto_linx); dissector_add_uint("ethertype", ETHERTYPE_LINX, linx_handle); } @@ -849,8 +850,8 @@ proto_reg_handoff_linx(void) /* Default the port to zero */ static guint linx_tcp_port = 0; -static void -dissect_linx_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_linx_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint32 dword; int offset = 0; @@ -981,6 +982,7 @@ dissect_linx_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } } + return tvb_captured_length(tvb); } void @@ -1087,7 +1089,7 @@ proto_reg_handoff_linx_tcp(void) if (!linx_tcp_prefs_initialized) { - linx_tcp_handle = create_dissector_handle(dissect_linx_tcp, proto_linx_tcp); + linx_tcp_handle = new_create_dissector_handle(dissect_linx_tcp, proto_linx_tcp); dissector_add_uint("tcp.port", linx_tcp_port, linx_tcp_handle); linx_tcp_prefs_initialized = TRUE; } diff --git a/epan/dissectors/packet-llt.c b/epan/dissectors/packet-llt.c index 295519f7b0..1783d61938 100644 --- a/epan/dissectors/packet-llt.c +++ b/epan/dissectors/packet-llt.c @@ -51,8 +51,8 @@ static int hf_llt_message_time = -1; static gint ett_llt = -1; /* Code to actually dissect the packets */ -static void -dissect_llt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_llt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { /* Set up structures needed to add the protocol subtree and manage it */ proto_item *ti; @@ -75,6 +75,7 @@ dissect_llt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(llt_tree, hf_llt_sequence_num, tvb, 24, 4, ENC_BIG_ENDIAN); proto_tree_add_item(llt_tree, hf_llt_message_time, tvb, 40, 4, ENC_BIG_ENDIAN); + return tvb_captured_length(tvb); } /* Register the protocol with Wireshark */ @@ -137,7 +138,7 @@ proto_reg_handoff_llt(void) static guint preference_alternate_ethertype_last; if (!initialized) { - llt_handle = create_dissector_handle(dissect_llt, proto_llt); + llt_handle = new_create_dissector_handle(dissect_llt, proto_llt); dissector_add_uint("ethertype", ETHERTYPE_LLT, llt_handle); initialized = TRUE; } else { diff --git a/epan/dissectors/packet-lmi.c b/epan/dissectors/packet-lmi.c index d57a46d1f3..2737e1e9fd 100644 --- a/epan/dissectors/packet-lmi.c +++ b/epan/dissectors/packet-lmi.c @@ -132,8 +132,8 @@ dissect_lmi_pvc_status(tvbuff_t *tvb, int offset, proto_tree *tree) proto_tree_add_uint(tree, hf_lmi_act, tvb, offset, 1, tvb_get_guint8( tvb, offset)); } -static void -dissect_lmi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_lmi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *lmi_tree, *lmi_subtree; proto_item *ti; @@ -177,6 +177,7 @@ dissect_lmi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_lmi_pvc_status( tvb, offset, lmi_subtree); offset += len; } + return tvb_captured_length(tvb); } @@ -236,7 +237,7 @@ proto_reg_handoff_lmi(void) { dissector_handle_t lmi_handle; - lmi_handle = create_dissector_handle(dissect_lmi, proto_lmi); + lmi_handle = new_create_dissector_handle(dissect_lmi, proto_lmi); dissector_add_uint("fr.nlpid", NLPID_LMI, lmi_handle); } diff --git a/epan/dissectors/packet-loop.c b/epan/dissectors/packet-loop.c index e19c9f90f8..9aad70a671 100644 --- a/epan/dissectors/packet-loop.c +++ b/epan/dissectors/packet-loop.c @@ -52,8 +52,8 @@ static const value_string function_vals[] = { { 0, NULL } }; -static void -dissect_loop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_loop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *loop_tree = NULL; proto_item *ti; @@ -118,6 +118,7 @@ dissect_loop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) next_tvb = tvb_new_subset_remaining(tvb, offset); call_dissector(data_handle, next_tvb, pinfo, tree); } + return tvb_captured_length(tvb); } void @@ -164,7 +165,7 @@ proto_reg_handoff_loop(void) { dissector_handle_t loop_handle; - loop_handle = create_dissector_handle(dissect_loop, proto_loop); + loop_handle = new_create_dissector_handle(dissect_loop, proto_loop); dissector_add_uint("ethertype", ETHERTYPE_LOOP, loop_handle); diff --git a/epan/dissectors/packet-lpd.c b/epan/dissectors/packet-lpd.c index 13ffec1019..41db5ce3a5 100644 --- a/epan/dissectors/packet-lpd.c +++ b/epan/dissectors/packet-lpd.c @@ -67,8 +67,8 @@ static const value_string lpd_server_code[] = { { 0, NULL } }; -static void -dissect_lpd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_lpd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *lpd_tree; proto_item *ti, *hidden_item; @@ -136,6 +136,8 @@ dissect_lpd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) else { call_dissector(data_handle,tvb, pinfo, lpd_tree); } + + return tvb_captured_length(tvb); } @@ -197,7 +199,7 @@ proto_reg_handoff_lpd(void) { dissector_handle_t lpd_handle; - lpd_handle = create_dissector_handle(dissect_lpd, proto_lpd); + lpd_handle = new_create_dissector_handle(dissect_lpd, proto_lpd); dissector_add_uint("tcp.port", TCP_PORT_PRINTER, lpd_handle); data_handle = find_dissector("data"); } diff --git a/epan/dissectors/packet-lwapp.c b/epan/dissectors/packet-lwapp.c index de2b8d1bfe..d9409d9ea4 100644 --- a/epan/dissectors/packet-lwapp.c +++ b/epan/dissectors/packet-lwapp.c @@ -311,9 +311,9 @@ dissect_control(tvbuff_t *tvb, packet_info *pinfo, * the start of the packet, so it simply re-calls the ethernet * dissector on the packet. */ -static void +static int dissect_lwapp_l3(tvbuff_t *tvb, packet_info *pinfo, - proto_tree *tree) + proto_tree *tree, void* data _U_) { /* Set up structures needed to add the protocol subtree and manage it */ proto_item *ti; @@ -325,18 +325,16 @@ dissect_lwapp_l3(tvbuff_t *tvb, packet_info *pinfo, col_set_str(pinfo->cinfo, COL_PROTOCOL, "LWAPP-L3"); col_set_str(pinfo->cinfo, COL_INFO, "802.3 Packets over Layer 3"); - if (tree) { - /* create display subtree for the protocol */ - ti = proto_tree_add_item(tree, proto_lwapp_l3, tvb, offset, - -1, ENC_NA); - lwapp_tree = proto_item_add_subtree(ti, ett_lwapp_l3); - } else { - lwapp_tree = NULL; - } + /* create display subtree for the protocol */ + ti = proto_tree_add_item(tree, proto_lwapp_l3, tvb, offset, + -1, ENC_NA); + lwapp_tree = proto_item_add_subtree(ti, ett_lwapp_l3); + /* Dissect as Ethernet */ next_client = tvb_new_subset_remaining(tvb, 0); call_dissector(eth_withoutfcs_handle, next_client, pinfo, lwapp_tree); - return; + + return tvb_captured_length(tvb); } /* dissect_lwapp_l3*/ @@ -346,9 +344,9 @@ dissect_lwapp_l3(tvbuff_t *tvb, packet_info *pinfo, * lwapp payload in the data, and doesn't care whether the data was * from a UDP packet, or a Layer 2 one. */ -static void +static int dissect_lwapp(tvbuff_t *tvb, packet_info *pinfo, - proto_tree *tree) + proto_tree *tree, void* data _U_) { LWAPP_Header header; guint8 slotId; @@ -450,7 +448,7 @@ dissect_lwapp(tvbuff_t *tvb, packet_info *pinfo, } else { dissect_control(next_client, pinfo, tree); } - return; + return tvb_captured_length(tvb); } /* dissect_lwapp*/ @@ -551,10 +549,10 @@ proto_reg_handoff_lwapp(void) data_handle = find_dissector("data"); /* This dissector assumes lwapp packets in an 802.3 frame */ - lwapp_l3_handle = create_dissector_handle(dissect_lwapp_l3, proto_lwapp_l3); + lwapp_l3_handle = new_create_dissector_handle(dissect_lwapp_l3, proto_lwapp_l3); /* This dissector assumes a lwapp packet */ - lwapp_handle = create_dissector_handle(dissect_lwapp, proto_lwapp); + lwapp_handle = new_create_dissector_handle(dissect_lwapp, proto_lwapp); /* * Ok, the following deserves some comments. We have four diff --git a/epan/dissectors/packet-lwres.c b/epan/dissectors/packet-lwres.c index c07781b00e..c43c7ec672 100644 --- a/epan/dissectors/packet-lwres.c +++ b/epan/dissectors/packet-lwres.c @@ -815,8 +815,8 @@ static void dissect_getrdatabyname(tvbuff_t* tvb, proto_tree* lwres_tree, int ty dissect_rdata_response(tvb, lwres_tree); } -static void -dissect_lwres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_lwres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint16 version, flags, authtype, authlength ; guint32 length, opcode, result, recvlength, serial; @@ -857,7 +857,7 @@ dissect_lwres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if(tree == NULL) - return; + return tvb_captured_length(tvb); lwres_item = proto_tree_add_item(tree,proto_lwres, tvb,0, -1, ENC_NA); lwres_tree = proto_item_add_subtree(lwres_item, ett_lwres); @@ -950,6 +950,7 @@ dissect_lwres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; } } + return tvb_captured_length(tvb); } @@ -1156,7 +1157,7 @@ proto_reg_handoff_lwres(void) static guint lwres_port; if(!lwres_prefs_initialized) { - lwres_handle = create_dissector_handle(dissect_lwres, proto_lwres); + lwres_handle = new_create_dissector_handle(dissect_lwres, proto_lwres); lwres_prefs_initialized = TRUE; } else { diff --git a/epan/dissectors/packet-m2tp.c b/epan/dissectors/packet-m2tp.c index 0470349b5d..ffec3e6703 100644 --- a/epan/dissectors/packet-m2tp.c +++ b/epan/dissectors/packet-m2tp.c @@ -525,8 +525,8 @@ dissect_m2tp_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_item *m2tp } /* M2tp */ -static void -dissect_m2tp(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_m2tp(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *m2tp_item; proto_tree *m2tp_tree; @@ -540,6 +540,7 @@ dissect_m2tp(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree) /* dissect the message */ dissect_m2tp_message(message_tvb, pinfo, m2tp_item, m2tp_tree, tree); + return tvb_captured_length(message_tvb); } /* Register the protocol with Wireshark */ @@ -655,7 +656,7 @@ proto_reg_handoff_m2tp(void) { dissector_handle_t m2tp_handle; mtp2_handle = find_dissector("mtp2"); - m2tp_handle = create_dissector_handle(dissect_m2tp, proto_m2tp); + m2tp_handle = new_create_dissector_handle(dissect_m2tp, proto_m2tp); dissector_add_uint("sctp.ppi", M2TP_PAYLOAD_PROTOCOL_ID, m2tp_handle); dissector_add_uint("sctp.port", SCTP_PORT_M2TP, m2tp_handle); } diff --git a/epan/dissectors/packet-m2ua.c b/epan/dissectors/packet-m2ua.c index 764d65e367..bcc900f475 100644 --- a/epan/dissectors/packet-m2ua.c +++ b/epan/dissectors/packet-m2ua.c @@ -1041,8 +1041,8 @@ dissect_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, pro dissect_parameters(parameters_tvb, pinfo, tree, m2ua_tree); } -static void -dissect_m2ua(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_m2ua(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *m2ua_item; proto_tree *m2ua_tree; @@ -1056,6 +1056,7 @@ dissect_m2ua(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree) /* dissect the message */ dissect_message(message_tvb, pinfo, tree, m2ua_tree); + return tvb_captured_length(message_tvb); } /* Register the protocol with Wireshark */ @@ -1142,7 +1143,7 @@ proto_reg_handoff_m2ua(void) dissector_handle_t m2ua_handle; mtp3_handle = find_dissector("mtp3"); - m2ua_handle = create_dissector_handle(dissect_m2ua, proto_m2ua); + m2ua_handle = new_create_dissector_handle(dissect_m2ua, proto_m2ua); dissector_add_uint("sctp.ppi", M2UA_PAYLOAD_PROTOCOL_ID, m2ua_handle); dissector_add_uint("sctp.port", SCTP_PORT_M2UA, m2ua_handle); } diff --git a/epan/dissectors/packet-maap.c b/epan/dissectors/packet-maap.c index 1f373507e4..dfa95d8e9f 100644 --- a/epan/dissectors/packet-maap.c +++ b/epan/dissectors/packet-maap.c @@ -81,8 +81,8 @@ static int hf_maap_conflict_count = -1; /* Initialize the subtree pointers */ static int ett_maap = -1; -static void -dissect_maap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_maap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint8 maap_msg_type; proto_item *maap_item = NULL; @@ -134,6 +134,8 @@ dissect_maap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(maap_tree, hf_maap_conflict_start_addr, tvb, MAAP_CONFLICT_START_ADDR_OFFSET, 6, ENC_NA); proto_tree_add_item(maap_tree, hf_maap_conflict_count, tvb, MAAP_CONFLICT_COUNT_OFFSET, 2, ENC_BIG_ENDIAN); } + + return tvb_captured_length(tvb); } /* end dissect_maap() */ /* Register the protocol with Wireshark */ @@ -211,7 +213,7 @@ proto_reg_handoff_maap(void) { dissector_handle_t maap_handle; - maap_handle = create_dissector_handle(dissect_maap, proto_maap); + maap_handle = new_create_dissector_handle(dissect_maap, proto_maap); dissector_add_uint("ieee1722.subtype", 0x7E, maap_handle); } diff --git a/epan/dissectors/packet-maccontrol.c b/epan/dissectors/packet-maccontrol.c index 8aff7f7102..d727009b5d 100644 --- a/epan/dissectors/packet-maccontrol.c +++ b/epan/dissectors/packet-maccontrol.c @@ -129,8 +129,8 @@ static const value_string reg_flags_vals[] = { static const guint8 dst_addr[] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x01}; static const address macctrl_dst_address = { AT_ETHER, 6, dst_addr}; -static void -dissect_macctrl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_macctrl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti, *opcode_item; proto_tree *macctrl_tree = NULL; @@ -250,6 +250,7 @@ dissect_macctrl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) expert_add_info(pinfo, opcode_item, &ei_macctrl_opcode); break; } + return tvb_captured_length(tvb); } void @@ -391,7 +392,7 @@ proto_reg_handoff_macctrl(void) { dissector_handle_t macctrl_handle; - macctrl_handle = create_dissector_handle(dissect_macctrl, proto_macctrl); + macctrl_handle = new_create_dissector_handle(dissect_macctrl, proto_macctrl); dissector_add_uint("ethertype", ETHERTYPE_MAC_CONTROL, macctrl_handle); } diff --git a/epan/dissectors/packet-manolito.c b/epan/dissectors/packet-manolito.c index a8827db691..a4d7665de2 100644 --- a/epan/dissectors/packet-manolito.c +++ b/epan/dissectors/packet-manolito.c @@ -48,8 +48,8 @@ static gint ett_manolito = -1; static expert_field ei_manolito_type = EI_INIT; /* Code to actually dissect the packets */ -static void -dissect_manolito(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_manolito(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dissector_data _U_) { unsigned int offset; @@ -214,6 +214,7 @@ dissect_manolito(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { col_set_str(pinfo->cinfo, COL_INFO, packet_type); } + return tvb_captured_length(tvb); } @@ -295,7 +296,7 @@ proto_reg_handoff_manolito(void) { dissector_handle_t manolito_handle; - manolito_handle = create_dissector_handle(dissect_manolito, + manolito_handle = new_create_dissector_handle(dissect_manolito, proto_manolito); dissector_add_uint("udp.port", 41170, manolito_handle); } diff --git a/epan/dissectors/packet-marker.c b/epan/dissectors/packet-marker.c index bd8e828c29..2e0218c28e 100644 --- a/epan/dissectors/packet-marker.c +++ b/epan/dissectors/packet-marker.c @@ -78,8 +78,8 @@ static gint ett_marker = -1; * Dominique Bastien (dbastien@accedian.com) * + add support for MARKER and MARKER Response PDUs. */ -static void -dissect_marker(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_marker(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int offset = 0; guint8 raw_octet; @@ -138,6 +138,7 @@ dissect_marker(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += 2; } } + return tvb_captured_length(tvb); } /* Register the protocol with Wireshark */ @@ -199,7 +200,7 @@ proto_reg_handoff_marker(void) { dissector_handle_t marker_handle; - marker_handle = create_dissector_handle(dissect_marker, proto_marker); + marker_handle = new_create_dissector_handle(dissect_marker, proto_marker); dissector_add_uint("slow.subtype", MARKER_SUBTYPE, marker_handle); } diff --git a/epan/dissectors/packet-mdshdr.c b/epan/dissectors/packet-mdshdr.c index 34a427296d..87387a3cd5 100644 --- a/epan/dissectors/packet-mdshdr.c +++ b/epan/dissectors/packet-mdshdr.c @@ -129,8 +129,8 @@ static const value_string eof_vals[] = { {0, NULL}, }; -static void -dissect_mdshdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_mdshdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { /* Set up structures needed to add the protocol subtree and manage it */ @@ -244,6 +244,7 @@ dissect_mdshdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) else { call_dissector(data_handle, next_tvb, pinfo, tree); } + return tvb_captured_length(tvb); } @@ -319,7 +320,7 @@ proto_reg_handoff_mdshdr(void) * ethertype ETHERTYPE_FCFT, and fetch the data and Fibre * Channel handles. */ - mdshdr_handle = create_dissector_handle(dissect_mdshdr, proto_mdshdr); + mdshdr_handle = new_create_dissector_handle(dissect_mdshdr, proto_mdshdr); dissector_add_uint("ethertype", ETHERTYPE_FCFT, mdshdr_handle); data_handle = find_dissector("data"); fc_dissector_handle = find_dissector("fc"); diff --git a/epan/dissectors/packet-megaco.c b/epan/dissectors/packet-megaco.c index 955bf573bb..6ec4d403fa 100644 --- a/epan/dissectors/packet-megaco.c +++ b/epan/dissectors/packet-megaco.c @@ -452,7 +452,7 @@ static gboolean keep_persistent_data = FALSE; * dissect_megaco_text over TCP, there will be a TPKT header there * */ -static void dissect_megaco_text_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_megaco_text_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int lv_tpkt_len; @@ -473,6 +473,8 @@ static void dissect_megaco_text_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tre } dissect_tpkt_encap(tvb, pinfo, tree, TRUE, megaco_text_handle); + + return tvb_captured_length(tvb); } #define ERRORTOKEN 1 @@ -3819,7 +3821,7 @@ proto_reg_handoff_megaco(void) data_handle = find_dissector("data"); megaco_text_handle = find_dissector("megaco"); - megaco_text_tcp_handle = create_dissector_handle(dissect_megaco_text_tcp, proto_megaco); + megaco_text_tcp_handle = new_create_dissector_handle(dissect_megaco_text_tcp, proto_megaco); dissector_add_uint("sctp.ppi", H248_PAYLOAD_PROTOCOL_ID, megaco_text_handle); diff --git a/epan/dissectors/packet-mih.c b/epan/dissectors/packet-mih.c index 034c293214..e1b237664e 100644 --- a/epan/dissectors/packet-mih.c +++ b/epan/dissectors/packet-mih.c @@ -1986,7 +1986,7 @@ static void dissect_mih_tlv(tvbuff_t *tvb,int offset, proto_tree *tlv_tree, guin return; } -static void dissect_mih(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_mih(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti = NULL; int offset = 0; @@ -2065,23 +2065,19 @@ static void dissect_mih(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) switch (service) { case 1 :/*for Service Management..*/ - if(mid_tree) - proto_tree_add_item(mid_tree, hf_mih_serv_actionid, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(mid_tree, hf_mih_serv_actionid, tvb, offset, 2, ENC_BIG_ENDIAN); col_append_fstr(pinfo->cinfo, COL_INFO, "\"%s\"", val_to_str(action, serv_act_id_values, "Unknown")); break; case 2 :/*for event services..*/ - if(mid_tree) - proto_tree_add_item(mid_tree, hf_mih_event_actionid, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(mid_tree, hf_mih_event_actionid, tvb, offset, 2, ENC_BIG_ENDIAN); col_append_fstr(pinfo->cinfo, COL_INFO, "\"%s\"", val_to_str(action, event_act_id_values, "Unknown")); break; case 3 :/*for Command Services..*/ - if(mid_tree) - proto_tree_add_item(mid_tree, hf_mih_command_actionid, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(mid_tree, hf_mih_command_actionid, tvb, offset, 2, ENC_BIG_ENDIAN); col_append_fstr(pinfo->cinfo, COL_INFO, "\"%s\"", val_to_str(action, command_act_id_values, "Unknown")); break; case 4 :/*for Information Services..*/ - if(mid_tree) - proto_tree_add_item(mid_tree, hf_mih_info_actionid, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(mid_tree, hf_mih_info_actionid, tvb, offset, 2, ENC_BIG_ENDIAN); col_append_fstr(pinfo->cinfo, COL_INFO, "\"%s\"", val_to_str(action, info_act_id_values, "Unknown")); break; } @@ -2191,7 +2187,7 @@ static void dissect_mih(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += (guint32)len; payload_length -= (1 + len_of_len + (guint32)len); }else{ - return; + return offset; } } else @@ -2202,6 +2198,8 @@ static void dissect_mih(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if(fragment!=0) proto_tree_add_item(mih_tree, hf_fragmented_tlv, tvb, offset, -1, ENC_NA); + + return tvb_captured_length(tvb); } /*dissector initialistaion*/ @@ -4871,7 +4869,7 @@ void proto_reg_handoff_mih(void) { dissector_handle_t mih_handle; - mih_handle = create_dissector_handle(dissect_mih, proto_mih); + mih_handle = new_create_dissector_handle(dissect_mih, proto_mih); /*Layer 3 handle*/ dissector_add_uint("udp.port", MIH_PORT, mih_handle); dissector_add_uint("tcp.port", MIH_PORT, mih_handle); diff --git a/epan/dissectors/packet-mip6.c b/epan/dissectors/packet-mip6.c index 9c339ed200..9331b9ced8 100644 --- a/epan/dissectors/packet-mip6.c +++ b/epan/dissectors/packet-mip6.c @@ -4004,8 +4004,8 @@ dissect_mip6_options(tvbuff_t *tvb, proto_tree *mip6_tree, int offset, int len, } /* Function that dissects the whole MIPv6 packet */ -static void -dissect_mip6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_mip6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *mip6_tree = NULL; guint8 type, pproto; @@ -4144,7 +4144,7 @@ dissect_mip6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (offset < len) { if (len < (offset - start_offset)) { expert_add_info(pinfo, header_item, &ei_mip6_bogus_header_length); - return; + return offset; } len -= (offset - start_offset); dissect_mip6_options(tvb, mip6_tree, offset, len, pinfo); @@ -4171,6 +4171,7 @@ dissect_mip6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_INFO, "Fast Binding Acknowledgment"); } + return tvb_captured_length(tvb); } /* Register the protocol with Wireshark */ @@ -5364,7 +5365,7 @@ proto_reg_handoff_mip6(void) dissector_handle_t mip6_handle; /* mip6_handle = find_dissector("mipv6"); */ - mip6_handle = create_dissector_handle(dissect_mip6, proto_mip6); + mip6_handle = new_create_dissector_handle(dissect_mip6, proto_mip6); dissector_add_uint("ip.proto", IP_PROTO_MIPV6_OLD, mip6_handle); dissector_add_uint("ip.proto", IP_PROTO_MIPV6, mip6_handle); /* Add support for PMIPv6 control messages over IPV4 */ diff --git a/epan/dissectors/packet-mmse.c b/epan/dissectors/packet-mmse.c index adc933fa3a..1476741f9e 100644 --- a/epan/dissectors/packet-mmse.c +++ b/epan/dissectors/packet-mmse.c @@ -64,7 +64,7 @@ void proto_reg_handoff_mmse(void); /* * Forward declarations */ -static void dissect_mmse_standalone(tvbuff_t *, packet_info *, proto_tree *); +static int dissect_mmse_standalone(tvbuff_t *, packet_info *, proto_tree *, void*); static void dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut, const char *message_type); @@ -648,12 +648,12 @@ dissect_mmse_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat if ((tvb_get_guint8(tvb, 2) != MM_TID_HDR) && (tvb_get_guint8(tvb, 2) != MM_VERSION_HDR)) return FALSE; - dissect_mmse_standalone(tvb, pinfo, tree); + dissect_mmse_standalone(tvb, pinfo, tree, data); return TRUE; } -static void -dissect_mmse_standalone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_mmse_standalone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint8 pdut; const char *message_type; @@ -670,10 +670,11 @@ dissect_mmse_standalone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_add_fstr(pinfo->cinfo, COL_INFO, "MMS %s", message_type); dissect_mmse(tvb, pinfo, tree, pdut, message_type); + return tvb_captured_length(tvb); } -static void -dissect_mmse_encapsulated(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_mmse_encapsulated(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint8 pdut; const char *message_type; @@ -689,6 +690,7 @@ dissect_mmse_encapsulated(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) message_type); dissect_mmse(tvb, pinfo, tree, pdut, message_type); + return tvb_captured_length(tvb); } static void @@ -1665,9 +1667,9 @@ proto_reg_handoff_mmse(void) dissector_handle_t mmse_encapsulated_handle; heur_dissector_add("wsp", dissect_mmse_heur, "MMS Message Encapsulation over WSP", "mmse_wsp", proto_mmse, HEURISTIC_ENABLE); - mmse_standalone_handle = create_dissector_handle( + mmse_standalone_handle = new_create_dissector_handle( dissect_mmse_standalone, proto_mmse); - mmse_encapsulated_handle = create_dissector_handle( + mmse_encapsulated_handle = new_create_dissector_handle( dissect_mmse_encapsulated, proto_mmse); /* As the media types for WSP and HTTP are the same, the WSP dissector * uses the same string dissector table as the HTTP protocol. */ diff --git a/epan/dissectors/packet-mpeg-ca.c b/epan/dissectors/packet-mpeg-ca.c index 850e2dcd50..26f1f48198 100644 --- a/epan/dissectors/packet-mpeg-ca.c +++ b/epan/dissectors/packet-mpeg-ca.c @@ -51,10 +51,9 @@ static const value_string mpeg_ca_cur_next_vals[] = { }; -static void -dissect_mpeg_ca(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_mpeg_ca(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { - guint offset = 0, length = 0; proto_item *ti; @@ -88,6 +87,7 @@ dissect_mpeg_ca(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += packet_mpeg_sect_crc(tvb, pinfo, mpeg_ca_tree, 0, offset); proto_item_set_len(ti, offset); + return tvb_captured_length(tvb); } @@ -145,7 +145,7 @@ void proto_reg_handoff_mpeg_ca(void) { dissector_handle_t mpeg_ca_handle; - mpeg_ca_handle = create_dissector_handle(dissect_mpeg_ca, proto_mpeg_ca); + mpeg_ca_handle = new_create_dissector_handle(dissect_mpeg_ca, proto_mpeg_ca); dissector_add_uint("mpeg_sect.tid", MPEG_CA_TID, mpeg_ca_handle); } diff --git a/epan/dissectors/packet-mpeg-pat.c b/epan/dissectors/packet-mpeg-pat.c index a931ee1c1e..8e6ef0291a 100644 --- a/epan/dissectors/packet-mpeg-pat.c +++ b/epan/dissectors/packet-mpeg-pat.c @@ -58,10 +58,9 @@ static const true_false_string mpeg_pat_cur_next_vals = { }; -static void -dissect_mpeg_pat(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_mpeg_pat(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { - guint offset = 0, length = 0; guint16 prog_num, prog_pid; @@ -94,7 +93,7 @@ dissect_mpeg_pat(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += 1; if (offset >= length) - return; + return offset; /* Parse all the programs */ @@ -117,6 +116,7 @@ dissect_mpeg_pat(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += packet_mpeg_sect_crc(tvb, pinfo, mpeg_pat_tree, 0, offset); proto_item_set_len(ti, offset); + return tvb_captured_length(tvb); } @@ -190,7 +190,7 @@ void proto_reg_handoff_mpeg_pat(void) { dissector_handle_t mpeg_pat_handle; - mpeg_pat_handle = create_dissector_handle(dissect_mpeg_pat, proto_mpeg_pat); + mpeg_pat_handle = new_create_dissector_handle(dissect_mpeg_pat, proto_mpeg_pat); dissector_add_uint("mpeg_sect.tid", MPEG_PAT_TID, mpeg_pat_handle); } diff --git a/epan/dissectors/packet-mpeg1.c b/epan/dissectors/packet-mpeg1.c index 4044a463fb..88c53c4fc2 100644 --- a/epan/dissectors/packet-mpeg1.c +++ b/epan/dissectors/packet-mpeg1.c @@ -76,8 +76,8 @@ static const value_string rtp_mpg_picture_types_vals[] = { 0, NULL }, }; -static void -dissect_mpeg1( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) +static int +dissect_mpeg1( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ ) { proto_item *ti; proto_tree *mpg_tree; @@ -125,6 +125,7 @@ dissect_mpeg1( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) /* The rest of the packet is the MPEG-1 stream */ proto_tree_add_item( mpg_tree, hf_rtp_mpg_data, tvb, offset, -1, ENC_NA ); + return tvb_captured_length(tvb); } void @@ -327,7 +328,7 @@ proto_reg_handoff_mpeg1(void) { dissector_handle_t mpeg1_handle; - mpeg1_handle = create_dissector_handle(dissect_mpeg1, proto_mpg); + mpeg1_handle = new_create_dissector_handle(dissect_mpeg1, proto_mpg); dissector_add_uint("rtp.pt", PT_MPV, mpeg1_handle); } diff --git a/epan/dissectors/packet-mpls-pm.c b/epan/dissectors/packet-mpls-pm.c index b03ae8654c..4052ecb8c5 100644 --- a/epan/dissectors/packet-mpls-pm.c +++ b/epan/dissectors/packet-mpls-pm.c @@ -660,22 +660,24 @@ dissect_mpls_pm_loss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } } -static void -dissect_mpls_pm_dlm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_mpls_pm_dlm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { /* the message formats for direct and inferred LM are identical */ dissect_mpls_pm_loss(tvb, pinfo, tree, DLM); + return tvb_captured_length(tvb); } -static void -dissect_mpls_pm_ilm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_mpls_pm_ilm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { /* the message formats for direct and inferred LM are identical */ dissect_mpls_pm_loss(tvb, pinfo, tree, ILM); + return tvb_captured_length(tvb); } -static void -dissect_mpls_pm_delay(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_mpls_pm_delay(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *pm_tree; @@ -694,10 +696,6 @@ dissect_mpls_pm_delay(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) "DM", &query, &response, &class_specific, &sid, &code); - if (!tree) { - return; - } - /* create display subtree for the protocol */ ti = proto_tree_add_item(tree, proto_mpls_pm_dm, tvb, 0, -1, ENC_NA); pm_tree = proto_item_add_subtree(ti, ett_mpls_pm); @@ -758,6 +756,7 @@ dissect_mpls_pm_delay(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) mpls_pm_dissect_timestamp(tvb, pm_tree, offset, qtf, rtf, query, i); offset += 8; } + return tvb_captured_length(tvb); } static void @@ -878,18 +877,20 @@ dissect_mpls_pm_combined(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } } -static void -dissect_mpls_pm_dlm_dm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_mpls_pm_dlm_dm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { /* the formats of the DLM+DM and ILM+DM messages are also identical */ dissect_mpls_pm_combined(tvb, pinfo, tree, DLMDM); + return tvb_captured_length(tvb); } -static void -dissect_mpls_pm_ilm_dm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_mpls_pm_ilm_dm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { /* the formats of the DLM+DM and ILM+DM messages are also identical */ dissect_mpls_pm_combined(tvb, pinfo, tree, ILMDM); + return tvb_captured_length(tvb); } void @@ -1525,15 +1526,15 @@ proto_reg_handoff_mpls_pm(void) dissector_handle_t mpls_pm_dlm_handle, mpls_pm_ilm_handle, mpls_pm_dm_handle, mpls_pm_dlm_dm_handle, mpls_pm_ilm_dm_handle; - mpls_pm_dlm_handle = create_dissector_handle( dissect_mpls_pm_dlm, proto_mpls_pm_dlm ); + mpls_pm_dlm_handle = new_create_dissector_handle( dissect_mpls_pm_dlm, proto_mpls_pm_dlm ); dissector_add_uint("pwach.channel_type", 0x000A, mpls_pm_dlm_handle); /* FF: MPLS PM, RFC 6374, DLM */ - mpls_pm_ilm_handle = create_dissector_handle( dissect_mpls_pm_ilm, proto_mpls_pm_ilm ); + mpls_pm_ilm_handle = new_create_dissector_handle( dissect_mpls_pm_ilm, proto_mpls_pm_ilm ); dissector_add_uint("pwach.channel_type", 0x000B, mpls_pm_ilm_handle); /* FF: MPLS PM, RFC 6374, ILM */ - mpls_pm_dm_handle = create_dissector_handle( dissect_mpls_pm_delay, proto_mpls_pm_dm ); + mpls_pm_dm_handle = new_create_dissector_handle( dissect_mpls_pm_delay, proto_mpls_pm_dm ); dissector_add_uint("pwach.channel_type", 0x000C, mpls_pm_dm_handle); /* FF: MPLS PM, RFC 6374, DM */ - mpls_pm_dlm_dm_handle = create_dissector_handle( dissect_mpls_pm_dlm_dm, proto_mpls_pm_dlm_dm ); + mpls_pm_dlm_dm_handle = new_create_dissector_handle( dissect_mpls_pm_dlm_dm, proto_mpls_pm_dlm_dm ); dissector_add_uint("pwach.channel_type", 0x000D, mpls_pm_dlm_dm_handle); /* FF: MPLS PM, RFC 6374, DLM+DM */ - mpls_pm_ilm_dm_handle = create_dissector_handle( dissect_mpls_pm_ilm_dm, proto_mpls_pm_ilm_dm ); + mpls_pm_ilm_dm_handle = new_create_dissector_handle( dissect_mpls_pm_ilm_dm, proto_mpls_pm_ilm_dm ); dissector_add_uint("pwach.channel_type", 0x000E, mpls_pm_ilm_dm_handle); /* FF: MPLS PM, RFC 6374, ILM+DM */ } diff --git a/epan/dissectors/packet-mpls-psc.c b/epan/dissectors/packet-mpls-psc.c index e3400fa8d4..a2d3d83ee4 100644 --- a/epan/dissectors/packet-mpls-psc.c +++ b/epan/dissectors/packet-mpls-psc.c @@ -108,8 +108,8 @@ const range_string mpls_psc_dpath_rvals[] = { { 0, 0, NULL } }; -static void -dissect_mpls_psc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_mpls_psc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *psc_tree; @@ -132,7 +132,7 @@ dissect_mpls_psc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) fpath, path); if (!tree) { - return; + return tvb_captured_length(tvb); } /* create display subtree for the protocol */ @@ -157,6 +157,7 @@ dissect_mpls_psc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += 1; /* tlv len */ proto_tree_add_item(psc_tree, hf_mpls_psc_tlvlen, tvb, offset, 1, ENC_BIG_ENDIAN); + return tvb_captured_length(tvb); } void @@ -239,7 +240,7 @@ proto_reg_handoff_mpls_psc(void) { dissector_handle_t mpls_psc_handle; - mpls_psc_handle = create_dissector_handle( dissect_mpls_psc, proto_mpls_psc ); + mpls_psc_handle = new_create_dissector_handle( dissect_mpls_psc, proto_mpls_psc ); dissector_add_uint("pwach.channel_type", 0x0024, mpls_psc_handle); /* FF: PSC, RFC 6378 */ } diff --git a/epan/dissectors/packet-mplstp-oam.c b/epan/dissectors/packet-mplstp-oam.c index 3d2426a923..ccecd8151f 100644 --- a/epan/dissectors/packet-mplstp-oam.c +++ b/epan/dissectors/packet-mplstp-oam.c @@ -114,8 +114,8 @@ dissect_mplstp_fm_tlv (tvbuff_t *tvb, proto_tree *tree) } /* Dissector for MPLS-TP LI protocol: RFC 6435 */ -static void -dissect_mplstp_lock(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_mplstp_lock(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *lock_tree; @@ -127,7 +127,7 @@ dissect_mplstp_lock(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_clear(pinfo->cinfo, COL_INFO); if (!tree) - return; + return tvb_captured_length(tvb); ti = proto_tree_add_item(tree, proto_mplstp_lock, tvb, 0, -1, ENC_NA); @@ -151,13 +151,13 @@ dissect_mplstp_lock(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) next_tvb = tvb_new_subset_remaining (tvb, offset); dissect_bfd_mep (next_tvb, tree, proto_mplstp_lock); - return; + return tvb_captured_length(tvb); } /* Dissector for MPLS-TP FM protocol: RFC 6427 */ -static void -dissect_mplstp_fm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_mplstp_fm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti, *ti_flags; proto_tree *fm_tree, *fm_flags; @@ -171,7 +171,7 @@ dissect_mplstp_fm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tlv_len = tvb_get_guint8 (tvb, (offset + 4)); if (!tree) - return; + return tvb_captured_length(tvb); ti = proto_tree_add_item(tree, proto_mplstp_fm, tvb, 0, (tlv_len + 5), ENC_NA); fm_tree = proto_item_add_subtree (ti, ett_mplstp_fm); @@ -215,7 +215,7 @@ dissect_mplstp_fm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) next_tvb = tvb_new_subset_remaining (tvb, offset); dissect_mplstp_fm_tlv (next_tvb, tree); } - return; + return tvb_captured_length(tvb); } void @@ -254,7 +254,7 @@ proto_reg_handoff_mplstp_lock(void) { dissector_handle_t mplstp_lock_handle; - mplstp_lock_handle = create_dissector_handle( dissect_mplstp_lock, proto_mplstp_lock ); + mplstp_lock_handle = new_create_dissector_handle( dissect_mplstp_lock, proto_mplstp_lock ); dissector_add_uint("pwach.channel_type", 0x0026, mplstp_lock_handle); /* KM: MPLSTP LOCK, RFC 6435 */ } @@ -343,7 +343,7 @@ proto_reg_handoff_mplstp_fm(void) { dissector_handle_t mplstp_fm_handle; - mplstp_fm_handle = create_dissector_handle( dissect_mplstp_fm, proto_mplstp_fm ); + mplstp_fm_handle = new_create_dissector_handle( dissect_mplstp_fm, proto_mplstp_fm ); dissector_add_uint("pwach.channel_type", 0x0058, mplstp_fm_handle); /* KM: MPLSTP FM, RFC 6427 */ } diff --git a/epan/dissectors/packet-mq.c b/epan/dissectors/packet-mq.c index 4cc9a0cc82..7ab19dda2e 100644 --- a/epan/dissectors/packet-mq.c +++ b/epan/dissectors/packet-mq.c @@ -4037,13 +4037,14 @@ static guint get_mq_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, static int dissect_mq_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { tcp_dissect_pdus(tvb, pinfo, tree, mq_desegment, 28, get_mq_pdu_len, reassemble_mq, data); - return tvb_reported_length(tvb); + return tvb_captured_length(tvb); } -static void dissect_mq_spx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_mq_spx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { /* Since SPX has no standard desegmentation, MQ cannot be performed as well */ dissect_mq_pdu(tvb, pinfo, tree); + return tvb_captured_length(tvb); } static gboolean dissect_mq_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint iProto, void *data) @@ -4779,7 +4780,7 @@ void proto_reg_handoff_mq(void) * known port number, the MQ applications are most often specific to a business application */ mq_tcp_handle = new_create_dissector_handle(dissect_mq_tcp, proto_mq); - mq_spx_handle = create_dissector_handle(dissect_mq_spx, proto_mq); + mq_spx_handle = new_create_dissector_handle(dissect_mq_spx, proto_mq); dissector_add_for_decode_as("tcp.port", mq_tcp_handle); heur_dissector_add("tcp", dissect_mq_heur_tcp, "WebSphere MQ over TCP", "mq_tcp", proto_mq, HEURISTIC_ENABLE); diff --git a/epan/dissectors/packet-mqtt-sn.c b/epan/dissectors/packet-mqtt-sn.c index a9a9454365..daf1f8668a 100644 --- a/epan/dissectors/packet-mqtt-sn.c +++ b/epan/dissectors/packet-mqtt-sn.c @@ -500,7 +500,7 @@ static void dissect_mqttsn_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree } /* Dissect a complete MQTT-SN message. */ -static void dissect_mqttsn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_mqttsn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { /* Various variables. */ int offset = 0; @@ -532,6 +532,7 @@ static void dissect_mqttsn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Dissect a MQTT-SN packet. */ dissect_mqttsn_packet(tvb, pinfo, tree, offset); + return tvb_captured_length(tvb); } /* Register the protocol with Wireshark. */ @@ -686,7 +687,7 @@ void proto_register_mqttsn(void) proto_mqttsn = proto_register_protocol("MQ Telemetry Transport Protocol for Sensor Networks", "MQTT-SN", "mqttsn"); /* Create the dissector handle. */ - mqttsn_handle = create_dissector_handle(dissect_mqttsn, proto_mqttsn); + mqttsn_handle = new_create_dissector_handle(dissect_mqttsn, proto_mqttsn); /* Register fields and subtrees. */ proto_register_field_array(proto_mqttsn, hf_mqttsn, array_length(hf_mqttsn)); diff --git a/epan/dissectors/packet-mrp-mmrp.c b/epan/dissectors/packet-mrp-mmrp.c index 98ea0f250b..f39d49709e 100644 --- a/epan/dissectors/packet-mrp-mmrp.c +++ b/epan/dissectors/packet-mrp-mmrp.c @@ -215,9 +215,8 @@ dissect_mmrp_three_packed_event(proto_tree *vect_attr_tree, tvbuff_t *tvb, guint * * main dissect function that calls the other functions listed above as necessary */ -static void -dissect_mmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) -{ +static int +dissect_mmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { /* Set up structures needed to add the protocol subtrees and manage them */ proto_item *ti, *msg_ti, *attr_list_ti, *vect_attr_ti; proto_tree *mmrp_tree, *msg_tree, *attr_list_tree, *vect_attr_tree; @@ -344,6 +343,7 @@ dissect_mmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(mmrp_tree, hf_mmrp_end_mark, tvb, offset+2, 2, ENC_BIG_ENDIAN); /* Message EndMark */ } + return tvb_captured_length(tvb); } @@ -426,7 +426,7 @@ proto_reg_handoff_mrp_mmrp(void) { dissector_handle_t mmrp_handle; - mmrp_handle = create_dissector_handle(dissect_mmrp, proto_mmrp); + mmrp_handle = new_create_dissector_handle(dissect_mmrp, proto_mmrp); dissector_add_uint("ethertype", ETHERTYPE_MMRP, mmrp_handle); } diff --git a/epan/dissectors/packet-mrp-msrp.c b/epan/dissectors/packet-mrp-msrp.c index 50186a6106..6144448483 100644 --- a/epan/dissectors/packet-mrp-msrp.c +++ b/epan/dissectors/packet-mrp-msrp.c @@ -447,8 +447,8 @@ dissect_msrp_four_packed_event(proto_tree *vect_attr_tree, tvbuff_t *tvb, guint * * main dissect function that calls the other functions listed above as necessary */ -static void -dissect_msrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_msrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { /* Set up structures needed to add the protocol subtrees and manage them */ proto_item *ti, *msg_ti, *attr_list_ti, *vect_attr_ti, *first_value_ti; @@ -629,6 +629,7 @@ dissect_msrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } /* Multiple Message while() */ proto_tree_add_item(msrp_tree, hf_msrp_end_mark, tvb, offset+2, 2, ENC_BIG_ENDIAN); /* Message EndMark */ } + return tvb_captured_length(tvb); } @@ -788,7 +789,7 @@ proto_reg_handoff_mrp_msrp(void) { dissector_handle_t msrp_handle; - msrp_handle = create_dissector_handle(dissect_msrp, proto_msrp); + msrp_handle = new_create_dissector_handle(dissect_msrp, proto_msrp); dissector_add_uint("ethertype", ETHERTYPE_MSRP, msrp_handle); } diff --git a/epan/dissectors/packet-mrp-mvrp.c b/epan/dissectors/packet-mrp-mvrp.c index 843f6dc6c0..94d9460252 100644 --- a/epan/dissectors/packet-mrp-mvrp.c +++ b/epan/dissectors/packet-mrp-mvrp.c @@ -212,8 +212,8 @@ dissect_mvrp_three_packed_event(proto_tree *vect_attr_tree, tvbuff_t *tvb, guint * * main dissect function that calls the other functions listed above as necessary */ -static void -dissect_mvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_mvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { /* Set up structures needed to add the protocol subtrees and manage them */ proto_item *ti, *msg_ti, *attr_list_ti, *vect_attr_ti, *first_value_ti; @@ -345,6 +345,7 @@ dissect_mvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(mvrp_tree, hf_mvrp_end_mark, tvb, offset+2, 2, ENC_BIG_ENDIAN); /* Message EndMark */ } } + return tvb_captured_length(tvb); } @@ -431,7 +432,7 @@ proto_reg_handoff_mrp_mvrp(void) { dissector_handle_t mvrp_handle; - mvrp_handle = create_dissector_handle(dissect_mvrp, proto_mvrp); + mvrp_handle = new_create_dissector_handle(dissect_mvrp, proto_mvrp); dissector_add_uint("ethertype", ETHERTYPE_MVRP, mvrp_handle); } /* diff --git a/epan/dissectors/packet-msdp.c b/epan/dissectors/packet-msdp.c index 1c6c61e150..4be3ec5e0f 100644 --- a/epan/dissectors/packet-msdp.c +++ b/epan/dissectors/packet-msdp.c @@ -175,8 +175,8 @@ static void dissect_msdp_notification(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, guint16 tlv_len); -static void -dissect_msdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_msdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *msdp_tree; @@ -230,7 +230,7 @@ dissect_msdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tvb_reported_length_remaining(tvb, offset) > 0) proto_tree_add_item(msdp_tree, hf_msdp_trailing_junk, tvb, offset, -1, ENC_NA); - return; + return tvb_captured_length(tvb); } /* Both Source-Active and Source-Active Response have the same format @@ -427,7 +427,7 @@ static void dissect_msdp_notification(tvbuff_t *tvb, packet_info *pinfo, proto_t * sent back. */ next_tvb = tvb_new_subset_remaining(tvb, *offset); - dissect_msdp(next_tvb, pinfo, tree); + dissect_msdp(next_tvb, pinfo, tree, NULL); } break; case FSM_ERROR: @@ -585,7 +585,7 @@ proto_reg_handoff_msdp(void) { dissector_handle_t msdp_handle; - msdp_handle = create_dissector_handle(dissect_msdp, proto_msdp); + msdp_handle = new_create_dissector_handle(dissect_msdp, proto_msdp); dissector_add_uint("tcp.port", 639, msdp_handle); ip_handle = find_dissector("ip"); diff --git a/epan/dissectors/packet-msn-messenger.c b/epan/dissectors/packet-msn-messenger.c index d1a148f7aa..111afd1dda 100644 --- a/epan/dissectors/packet-msn-messenger.c +++ b/epan/dissectors/packet-msn-messenger.c @@ -59,8 +59,8 @@ static gint ett_msnms = -1; #define TCP_PORT_MSNMS 1863 -static void -dissect_msnms(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_msnms(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *msnms_tree; proto_item *ti; @@ -113,6 +113,7 @@ dissect_msnms(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset = next_offset; } } + return tvb_captured_length(tvb); } void @@ -131,7 +132,7 @@ proto_reg_handoff_msnms(void) { dissector_handle_t msnms_handle; - msnms_handle = create_dissector_handle(dissect_msnms, proto_msnms); + msnms_handle = new_create_dissector_handle(dissect_msnms, proto_msnms); dissector_add_uint("tcp.port", TCP_PORT_MSNMS, msnms_handle); /* * For MSN Messenger Protocol over HTTP diff --git a/epan/dissectors/packet-msnlb.c b/epan/dissectors/packet-msnlb.c index d96838f335..78318c69fc 100644 --- a/epan/dissectors/packet-msnlb.c +++ b/epan/dissectors/packet-msnlb.c @@ -123,8 +123,8 @@ version_base_custom(gchar *result, guint32 version) g_snprintf(result, ITEM_LABEL_LENGTH, "%d.%d", (version >> 8) & 0xFF, (version & 0xFF)); } -static void -dissect_msnlb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_msnlb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *msnlb_tree = NULL, *msnlb_subtree; @@ -333,6 +333,7 @@ dissect_msnlb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; } + return tvb_captured_length(tvb); } void @@ -631,7 +632,7 @@ proto_reg_handoff_msnlb(void) { dissector_handle_t msnlb_handle; - msnlb_handle = create_dissector_handle(dissect_msnlb, proto_msnlb); + msnlb_handle = new_create_dissector_handle(dissect_msnlb, proto_msnlb); dissector_add_uint("ethertype", ETHERTYPE_MS_NLB_HEARTBEAT, msnlb_handle); } diff --git a/epan/dissectors/packet-msproxy.c b/epan/dissectors/packet-msproxy.c index c6a4276392..41d531ddc8 100644 --- a/epan/dissectors/packet-msproxy.c +++ b/epan/dissectors/packet-msproxy.c @@ -191,8 +191,8 @@ typedef struct { /************** negotiated conversation hash stuff ***************/ -static void msproxy_sub_dissector( tvbuff_t *tvb, packet_info *pinfo, - proto_tree *tree) { +static int msproxy_sub_dissector( tvbuff_t *tvb, packet_info *pinfo, + proto_tree *tree, void* data _U_) { /* Conversation dissector called from TCP or UDP dissector. Decode and */ /* display the msproxy header, the pass the rest of the data to the tcp */ @@ -249,6 +249,7 @@ static void msproxy_sub_dissector( tvbuff_t *tvb, packet_info *pinfo, pinfo->destport, -1); *ptr = redirect_info->server_int_port; + return tvb_captured_length(tvb); } @@ -1046,8 +1047,7 @@ static void dissect_msproxy_response(tvbuff_t *tvb, packet_info *pinfo, -static void dissect_msproxy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - +static int dissect_msproxy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *msproxy_tree; proto_item *ti; @@ -1085,6 +1085,8 @@ static void dissect_msproxy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_msproxy_response( tvb, pinfo, msproxy_tree, hash_info); else dissect_msproxy_request( tvb, pinfo, msproxy_tree, hash_info); + + return tvb_captured_length(tvb); } @@ -1254,7 +1256,7 @@ proto_register_msproxy( void){ expert_msproxy = expert_register_protocol(proto_msproxy); expert_register_field_array(expert_msproxy, ei, array_length(ei)); - msproxy_sub_handle = create_dissector_handle(msproxy_sub_dissector, + msproxy_sub_handle = new_create_dissector_handle(msproxy_sub_dissector, proto_msproxy); } @@ -1266,7 +1268,7 @@ proto_reg_handoff_msproxy(void) { dissector_handle_t msproxy_handle; - msproxy_handle = create_dissector_handle(dissect_msproxy, + msproxy_handle = new_create_dissector_handle(dissect_msproxy, proto_msproxy); dissector_add_uint("udp.port", UDP_PORT_MSPROXY, msproxy_handle); } diff --git a/epan/dissectors/packet-mtp2.c b/epan/dissectors/packet-mtp2.c index d7175ce026..7f5793716c 100644 --- a/epan/dissectors/packet-mtp2.c +++ b/epan/dissectors/packet-mtp2.c @@ -350,14 +350,16 @@ dissect_mtp2_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } /* Dissect MTP2 frame without CRC16 and with a pseudo-header */ -static void -dissect_mtp2_with_phdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_mtp2_with_phdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { if (pinfo->pseudo_header->mtp2.annex_a_used == MTP2_ANNEX_A_USED_UNKNOWN) dissect_mtp2_common(tvb, pinfo, tree, FALSE, use_extended_sequence_numbers_default); else dissect_mtp2_common(tvb, pinfo, tree, FALSE, (pinfo->pseudo_header->mtp2.annex_a_used == MTP2_ANNEX_A_USED)); + + return tvb_captured_length(tvb); } /* Dissect MTP2 frame with CRC16 included at end of payload */ @@ -435,7 +437,7 @@ proto_reg_handoff_mtp2(void) dissector_handle_t mtp2_with_phdr_handle; dissector_add_uint("wtap_encap", WTAP_ENCAP_MTP2, mtp2_handle); - mtp2_with_phdr_handle = create_dissector_handle(dissect_mtp2_with_phdr, + mtp2_with_phdr_handle = new_create_dissector_handle(dissect_mtp2_with_phdr, proto_mtp2); dissector_add_uint("wtap_encap", WTAP_ENCAP_MTP2_WITH_PHDR, mtp2_with_phdr_handle); diff --git a/epan/dissectors/packet-nasdaq-soup.c b/epan/dissectors/packet-nasdaq-soup.c index 0aafd41f80..4a84891f3d 100644 --- a/epan/dissectors/packet-nasdaq-soup.c +++ b/epan/dissectors/packet-nasdaq-soup.c @@ -148,8 +148,8 @@ dissect_nasdaq_soup_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent } /* ---------------------------- */ -static void -dissect_nasdaq_soup(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_nasdaq_soup(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *nasdaq_soup_tree = NULL; @@ -172,7 +172,7 @@ dissect_nasdaq_soup(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) */ pinfo->desegment_offset = offset; pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT; - return; + return tvb_captured_length(tvb); } nasdaq_soup_type = tvb_get_guint8(tvb, offset); @@ -193,6 +193,7 @@ dissect_nasdaq_soup(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_nasdaq_soup_packet(tvb, pinfo, tree, nasdaq_soup_tree, offset, linelen); offset = next_offset; } + return tvb_captured_length(tvb); } /* Register the protocol with Wireshark */ @@ -289,7 +290,7 @@ proto_register_nasdaq_soup(void) void proto_reg_handoff_nasdaq_soup(void) { - nasdaq_soup_handle = create_dissector_handle(dissect_nasdaq_soup, proto_nasdaq_soup); + nasdaq_soup_handle = new_create_dissector_handle(dissect_nasdaq_soup, proto_nasdaq_soup); nasdaq_itch_handle = find_dissector("nasdaq-itch"); dissector_add_for_decode_as("tcp.port", nasdaq_soup_handle); } diff --git a/epan/dissectors/packet-nbipx.c b/epan/dissectors/packet-nbipx.c index 2366fbd7e1..f025bfed06 100644 --- a/epan/dissectors/packet-nbipx.c +++ b/epan/dissectors/packet-nbipx.c @@ -748,8 +748,8 @@ static gint ett_nmpi = -1; static gint ett_nmpi_name_type_flags = -1; -static void -dissect_nmpi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_nmpi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *nmpi_tree = NULL; proto_item *ti; @@ -843,6 +843,7 @@ dissect_nmpi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) next_tvb = tvb_new_subset_remaining(tvb, offset); dissect_netbios_payload(next_tvb, pinfo, tree); } + return tvb_captured_length(tvb); } void @@ -869,7 +870,7 @@ proto_reg_handoff_nmpi(void) { dissector_handle_t nmpi_handle; - nmpi_handle = create_dissector_handle(dissect_nmpi, proto_nmpi); + nmpi_handle = new_create_dissector_handle(dissect_nmpi, proto_nmpi); dissector_add_uint("ipx.socket", IPX_SOCKET_NWLINK_SMB_NAMEQUERY, nmpi_handle); dissector_add_uint("ipx.socket", IPX_SOCKET_NWLINK_SMB_MAILSLOT, diff --git a/epan/dissectors/packet-nbt.c b/epan/dissectors/packet-nbt.c index 37a2dd46c4..2403a56b3e 100644 --- a/epan/dissectors/packet-nbt.c +++ b/epan/dissectors/packet-nbt.c @@ -1001,8 +1001,8 @@ dissect_answer_records(tvbuff_t *tvb, packet_info *pinfo, int cur_off, int nbns_ return cur_off - start_off; } -static void -dissect_nbns(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_nbns(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int offset = 0; int nbns_data_offset; @@ -1091,6 +1091,8 @@ dissect_nbns(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) nbns_data_offset, add, NULL, nbns_tree, opcode, "Additional records"); + + return tvb_captured_length(tvb); } static heur_dissector_list_t netbios_heur_subdissector_list; @@ -1168,8 +1170,8 @@ static const value_string nbds_error_codes[] = { { 0x00, NULL } }; -static void -dissect_nbdgm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_nbdgm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int offset = 0; proto_tree *nbdgm_tree = NULL; @@ -1320,6 +1322,7 @@ dissect_nbdgm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item_set_len(ti, offset); break; } + return tvb_captured_length(tvb); } /* @@ -2083,10 +2086,10 @@ proto_reg_handoff_nbt(void) { dissector_handle_t nbns_handle, nbdgm_handle, nbss_handle; - nbns_handle = create_dissector_handle(dissect_nbns, proto_nbns); + nbns_handle = new_create_dissector_handle(dissect_nbns, proto_nbns); dissector_add_uint("udp.port", UDP_PORT_NBNS, nbns_handle); - nbdgm_handle = create_dissector_handle(dissect_nbdgm, proto_nbdgm); + nbdgm_handle = new_create_dissector_handle(dissect_nbdgm, proto_nbdgm); dissector_add_uint("udp.port", UDP_PORT_NBDGM, nbdgm_handle); nbss_handle = new_create_dissector_handle(dissect_nbss, proto_nbss); diff --git a/epan/dissectors/packet-ncp.c b/epan/dissectors/packet-ncp.c index e4384d4655..7aa34fbd1a 100644 --- a/epan/dissectors/packet-ncp.c +++ b/epan/dissectors/packet-ncp.c @@ -1108,10 +1108,11 @@ dissect_ncp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } } -static void -dissect_ncp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ncp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { dissect_ncp_common(tvb, pinfo, tree, FALSE); + return tvb_captured_length(tvb); } static guint @@ -1390,7 +1391,7 @@ proto_reg_handoff_ncp(void) dissector_handle_t ncp_handle; dissector_handle_t ncp_tcp_handle; - ncp_handle = create_dissector_handle(dissect_ncp, proto_ncp); + ncp_handle = new_create_dissector_handle(dissect_ncp, proto_ncp); ncp_tcp_handle = new_create_dissector_handle(dissect_ncp_tcp, proto_ncp); dissector_add_uint("tcp.port", TCP_PORT_NCP, ncp_tcp_handle); dissector_add_uint("udp.port", UDP_PORT_NCP, ncp_handle); diff --git a/epan/dissectors/packet-ncs.c b/epan/dissectors/packet-ncs.c index 5017edca65..21fb3c0b5e 100644 --- a/epan/dissectors/packet-ncs.c +++ b/epan/dissectors/packet-ncs.c @@ -38,8 +38,8 @@ static int proto_ncs = -1; static int hf_panning_id = -1; static int hf_incarnation = -1; -static void -dissect_ncs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ncs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *ncs_tree; proto_item *ti; @@ -52,6 +52,7 @@ dissect_ncs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(ncs_tree, hf_panning_id, tvb, 4, 4, ENC_BIG_ENDIAN); proto_tree_add_item(ncs_tree, hf_incarnation, tvb, 8, 4, ENC_BIG_ENDIAN); + return tvb_captured_length(tvb); } void @@ -85,7 +86,7 @@ proto_reg_handoff_ncs(void) { dissector_handle_t ncs_handle; - ncs_handle = create_dissector_handle(dissect_ncs, proto_ncs); + ncs_handle = new_create_dissector_handle(dissect_ncs, proto_ncs); dissector_add_uint("ip.proto", IP_PROTO_NCS_HEARTBEAT, ncs_handle); } diff --git a/epan/dissectors/packet-netanalyzer.c b/epan/dissectors/packet-netanalyzer.c index 29941e47f2..195dc4426d 100644 --- a/epan/dissectors/packet-netanalyzer.c +++ b/epan/dissectors/packet-netanalyzer.c @@ -297,8 +297,8 @@ dissect_netanalyzer_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Ethernet capture mode */ -static void -dissect_netanalyzer(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_netanalyzer(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { tvbuff_t *next_tvb; @@ -318,12 +318,13 @@ dissect_netanalyzer(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_expert_format(tree, pinfo, &ei_netanalyzer_header_version_none, tvb, 4, -1, "netANALYZER - No netANALYZER header found"); } + return tvb_captured_length(tvb); } /* Transparent capture mode */ -static void -dissect_netanalyzer_transparent(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_netanalyzer_transparent(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *transparent_payload_tree = NULL; tvbuff_t *next_tvb; @@ -352,6 +353,7 @@ dissect_netanalyzer_transparent(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t proto_tree_add_expert_format(tree, pinfo, &ei_netanalyzer_header_version_none, tvb, 4, -1, "netANALYZER transparent mode - No netANALYZER header found"); } + return tvb_captured_length(tvb); } @@ -462,8 +464,8 @@ void proto_reg_handoff_netanalyzer(void) eth_dissector_handle = find_dissector("eth_withfcs"); data_dissector_handle = find_dissector("data"); - netana_handle = create_dissector_handle(dissect_netanalyzer, proto_netanalyzer); - netana_handle_transparent = create_dissector_handle(dissect_netanalyzer_transparent, proto_netanalyzer); + netana_handle = new_create_dissector_handle(dissect_netanalyzer, proto_netanalyzer); + netana_handle_transparent = new_create_dissector_handle(dissect_netanalyzer_transparent, proto_netanalyzer); dissector_add_uint("wtap_encap", WTAP_ENCAP_NETANALYZER, netana_handle); dissector_add_uint("wtap_encap", WTAP_ENCAP_NETANALYZER_TRANSPARENT, netana_handle_transparent); } diff --git a/epan/dissectors/packet-netdump.c b/epan/dissectors/packet-netdump.c index 92cf3a9143..d9bc3d4016 100644 --- a/epan/dissectors/packet-netdump.c +++ b/epan/dissectors/packet-netdump.c @@ -81,14 +81,9 @@ static const value_string reply_code_names[] = { /* Code to actually dissect the packets */ -static void -dissect_netdump(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_netdump(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { - - /* Check that there's enough data */ - if (tvb_reported_length(tvb) == 0) - return; - col_set_str(pinfo->cinfo, COL_PROTOCOL, "Netdump"); /* Clear out stuff in the info column */ col_clear(pinfo->cinfo, COL_INFO); @@ -114,6 +109,7 @@ dissect_netdump(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(netdump_tree, hf_netdump_payload, tvb, 13, -1, ENC_NA); } } + return tvb_captured_length(tvb); } void proto_register_netdump(void) @@ -207,7 +203,7 @@ void proto_reg_handoff_netdump(void) static int CurrentPort; if (!initalized) { - netdump_handle = create_dissector_handle(dissect_netdump, + netdump_handle = new_create_dissector_handle(dissect_netdump, proto_netdump); dissector_add_for_decode_as("udp.port", netdump_handle); diff --git a/epan/dissectors/packet-netrom.c b/epan/dissectors/packet-netrom.c index 22ebf2b874..cd8391db13 100644 --- a/epan/dissectors/packet-netrom.c +++ b/epan/dissectors/packet-netrom.c @@ -477,13 +477,15 @@ dissect_netrom_routing(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } /* Code to actually dissect the packets */ -static void -dissect_netrom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_netrom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { if ( tvb_get_guint8( tvb, 0 ) == 0xff ) dissect_netrom_routing( tvb, pinfo, tree ); else dissect_netrom_proto( tvb, pinfo, tree ); + + return tvb_captured_length(tvb); } void @@ -624,7 +626,7 @@ proto_register_netrom(void) void proto_reg_handoff_netrom(void) { - dissector_add_uint( "ax25.pid", AX25_P_NETROM, create_dissector_handle( dissect_netrom, proto_netrom ) ); + dissector_add_uint( "ax25.pid", AX25_P_NETROM, new_create_dissector_handle( dissect_netrom, proto_netrom ) ); ip_handle = find_dissector( "ip" ); data_handle = find_dissector( "data" ); diff --git a/epan/dissectors/packet-nettl.c b/epan/dissectors/packet-nettl.c index bb42dfecda..fd0d4d3628 100644 --- a/epan/dissectors/packet-nettl.c +++ b/epan/dissectors/packet-nettl.c @@ -203,11 +203,9 @@ static value_string_ext subsystem_ext = VALUE_STRING_EXT_INIT(subsystem); /* Code to actually dissect the nettl record headers */ -static void -dissect_nettl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_nettl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { - pinfo->current_proto = "nettl"; - if (tree) { proto_tree *nettl_tree; proto_item *nettl_item; @@ -285,6 +283,7 @@ dissect_nettl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) val_to_str_ext_const(pinfo->pseudo_header->nettl.subsys, &subsystem_ext, "Unknown")); call_dissector(data_handle, tvb, pinfo, tree); } + return tvb_captured_length(tvb); } @@ -355,7 +354,7 @@ proto_reg_handoff_nettl(void) ip_proto_dissector_table = find_dissector_table("ip.proto"); tcp_subdissector_table = find_dissector_table("tcp.port"); - nettl_handle = create_dissector_handle(dissect_nettl, proto_nettl); + nettl_handle = new_create_dissector_handle(dissect_nettl, proto_nettl); dissector_add_uint("wtap_encap", WTAP_ENCAP_NETTL_ETHERNET, nettl_handle); dissector_add_uint("wtap_encap", WTAP_ENCAP_NETTL_TOKEN_RING, nettl_handle); dissector_add_uint("wtap_encap", WTAP_ENCAP_NETTL_FDDI, nettl_handle); diff --git a/epan/dissectors/packet-nfs.c b/epan/dissectors/packet-nfs.c index 140ba97bb3..84f872c5a5 100644 --- a/epan/dissectors/packet-nfs.c +++ b/epan/dissectors/packet-nfs.c @@ -1325,8 +1325,8 @@ nfs_fmt_fsid( gchar *result, guint32 revision ) } /* SVR4: checked with ReliantUNIX (5.43, 5.44, 5.45), OpenSolaris (build 101a) */ -static void -dissect_fhandle_data_SVR4(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree) +static int +dissect_fhandle_data_SVR4(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) { guint encoding = ENC_BIG_ENDIAN; /* We support little endian and big endian. Default is big endian*/ gboolean have_flag = FALSE; /* The flag field at the end is optional. Assume no flag is there */ @@ -1485,13 +1485,15 @@ dissect_fhandle_data_SVR4(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tre /* flag */ if (have_flag) proto_tree_add_item(tree, hf_nfs_fh_flag, tvb, nof, 4, encoding); + + return tvb_captured_length(tvb); } /* Checked with RedHat Linux 6.2 (kernel 2.2.14 knfsd) */ -static void -dissect_fhandle_data_LINUX_KNFSD_LE(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree) +static int +dissect_fhandle_data_LINUX_KNFSD_LE(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) { if (tree) { int offset = 0; @@ -1538,13 +1540,14 @@ dissect_fhandle_data_LINUX_KNFSD_LE(tvbuff_t* tvb, packet_info *pinfo _U_, proto proto_tree_add_item(tree, hf_nfs_fh_xfn_inode, tvb, offset+20, 4, ENC_LITTLE_ENDIAN); proto_tree_add_item(tree, hf_nfs_fh_fn_generation, tvb, offset+24, 4, ENC_LITTLE_ENDIAN); } + return tvb_captured_length(tvb); } /* Checked with RedHat Linux 5.2 (nfs-server 2.2beta47 user-land nfsd) */ -static void -dissect_fhandle_data_LINUX_NFSD_LE(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree) +static int +dissect_fhandle_data_LINUX_NFSD_LE(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) { int offset = 0; @@ -1567,11 +1570,12 @@ dissect_fhandle_data_LINUX_NFSD_LE(tvbuff_t* tvb, packet_info *pinfo _U_, proto_ proto_tree_add_item(hash_tree, hf_nfs_fh_hp_key, tvb, offset+5, hashlen, ENC_NA); } } + return tvb_captured_length(tvb); } -static void -dissect_fhandle_data_NETAPP(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree) +static int +dissect_fhandle_data_NETAPP(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) { int offset = 0; static const int * flags[] = { @@ -1621,6 +1625,7 @@ dissect_fhandle_data_NETAPP(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *t tvb, offset + 31, 1, export_snapgen >> 24); } + return tvb_captured_length(tvb); } static const value_string handle_type_strings[] = { @@ -1632,8 +1637,8 @@ static const value_string handle_type_strings[] = { { 0, NULL } }; -static void -dissect_fhandle_data_NETAPP_V4(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree) +static int +dissect_fhandle_data_NETAPP_V4(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) { static const int * flags[] = { &hf_nfs_fh_file_flag_mntpoint, @@ -1656,7 +1661,7 @@ dissect_fhandle_data_NETAPP_V4(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree }; if (tree == NULL) - return; + return tvb_captured_length(tvb); { int offset = 0; @@ -1690,6 +1695,7 @@ dissect_fhandle_data_NETAPP_V4(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree proto_tree_add_item(subtree, hf_nfs_fh_fsid, tvb, offset + 20, 4, encoding); proto_tree_add_item(tree, hf_nfs_fh_handle_type, tvb, offset+24, 4, encoding); } + return tvb_captured_length(tvb); } #define NETAPP_GX_FH3_LENGTH 44 @@ -1705,8 +1711,8 @@ dissect_fhandle_data_NETAPP_V4(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree #define SPINNP_FH_FLAG_SNAPDIR_MASK 0x02 #define SPINNP_FH_FLAG_STREAMDIR_MASK 0x01 -static void -dissect_fhandle_data_NETAPP_GX_v3(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree) +static int +dissect_fhandle_data_NETAPP_GX_v3(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) { if (tree) { proto_item *tf; @@ -1813,6 +1819,7 @@ dissect_fhandle_data_NETAPP_GX_v3(tvbuff_t* tvb, packet_info *pinfo _U_, proto_t proto_tree_add_item(tree, hf_nfs3_gxfh_exportptuid, tvb, offset+40, 4, ENC_LITTLE_ENDIAN); } /* end of (tree) */ + return tvb_captured_length(tvb); } /* Checked with SuSE 7.1 (kernel 2.4.0 knfsd) */ @@ -2152,12 +2159,13 @@ dissect_fhandle_data_CELERRA_VNX(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tr } -static void -dissect_fhandle_data_unknown(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) +static int +dissect_fhandle_data_unknown(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) { guint fhlen = tvb_reported_length(tvb); proto_tree_add_item(tree, hf_nfs_fh_fhandle_data, tvb, 0, fhlen, ENC_NA); + return tvb_captured_length(tvb); } @@ -2222,7 +2230,7 @@ dissect_fhandle_data(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree * have a unique identifier to determine subdissector */ fh_tvb = tvb_new_subset(tvb, offset, fhlen, fhlen); if (!dissector_try_uint(nfs_fhandle_table, 0, fh_tvb, pinfo, tree)) - dissect_fhandle_data_unknown(fh_tvb, pinfo, tree); + dissect_fhandle_data_unknown(fh_tvb, pinfo, tree, NULL); } } @@ -13748,25 +13756,25 @@ proto_reg_handoff_nfs(void) rpc_init_prog(proto_nfs, NFS_CB_PROGRAM, ett_nfs, G_N_ELEMENTS(nfs_cb_vers_info), nfs_cb_vers_info); - fhandle_handle = create_dissector_handle(dissect_fhandle_data_SVR4, proto_nfs_svr4); + fhandle_handle = new_create_dissector_handle(dissect_fhandle_data_SVR4, proto_nfs_svr4); dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle); - fhandle_handle = create_dissector_handle(dissect_fhandle_data_LINUX_KNFSD_LE, proto_nfs_knfsd_le); + fhandle_handle = new_create_dissector_handle(dissect_fhandle_data_LINUX_KNFSD_LE, proto_nfs_knfsd_le); dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle); - fhandle_handle = create_dissector_handle(dissect_fhandle_data_LINUX_NFSD_LE, proto_nfs_nfsd_le); + fhandle_handle = new_create_dissector_handle(dissect_fhandle_data_LINUX_NFSD_LE, proto_nfs_nfsd_le); dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle); fhandle_handle = create_dissector_handle(dissect_fhandle_data_LINUX_KNFSD_NEW, proto_nfs_knfsd_new); dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle); - fhandle_handle = create_dissector_handle(dissect_fhandle_data_NETAPP, proto_nfs_ontap_v3); + fhandle_handle = new_create_dissector_handle(dissect_fhandle_data_NETAPP, proto_nfs_ontap_v3); dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle); - fhandle_handle = create_dissector_handle(dissect_fhandle_data_NETAPP_V4, proto_nfs_ontap_v4); + fhandle_handle = new_create_dissector_handle(dissect_fhandle_data_NETAPP_V4, proto_nfs_ontap_v4); dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle); - fhandle_handle = create_dissector_handle(dissect_fhandle_data_NETAPP_GX_v3, proto_nfs_ontap_gx_v3); + fhandle_handle = new_create_dissector_handle(dissect_fhandle_data_NETAPP_GX_v3, proto_nfs_ontap_gx_v3); dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle); fhandle_handle = create_dissector_handle(dissect_fhandle_data_CELERRA_VNX, proto_nfs_celerra_vnx); @@ -13778,7 +13786,7 @@ proto_reg_handoff_nfs(void) fhandle_handle = create_dissector_handle(dissect_fhandle_data_DCACHE, proto_nfs_dcache); dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle); - fhandle_handle = create_dissector_handle(dissect_fhandle_data_unknown, proto_nfs_unknown); + fhandle_handle = new_create_dissector_handle(dissect_fhandle_data_unknown, proto_nfs_unknown); dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle); } diff --git a/epan/dissectors/packet-nhrp.c b/epan/dissectors/packet-nhrp.c index f8f5b6412c..ab43844acf 100644 --- a/epan/dissectors/packet-nhrp.c +++ b/epan/dissectors/packet-nhrp.c @@ -952,9 +952,10 @@ skip_switch: *pOffset = extEnd; } -static void dissect_nhrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_nhrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { _dissect_nhrp(tvb, pinfo, tree, FALSE, TRUE); + return tvb_captured_length(tvb); } static void _dissect_nhrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, @@ -1392,7 +1393,7 @@ proto_reg_handoff_nhrp(void) osinl_excl_subdissector_table = find_dissector_table("osinl.excl"); ethertype_subdissector_table = find_dissector_table("ethertype"); - nhrp_handle = create_dissector_handle(dissect_nhrp, proto_nhrp); + nhrp_handle = new_create_dissector_handle(dissect_nhrp, proto_nhrp); dissector_add_uint("ip.proto", IP_PROTO_NARP, nhrp_handle); dissector_add_uint("gre.proto", GRE_NHRP, nhrp_handle); dissector_add_uint("llc.iana_pid", IANA_PID_MARS_NHRP_CONTROL, nhrp_handle); diff --git a/epan/dissectors/packet-nlsp.c b/epan/dissectors/packet-nlsp.c index fc980d28d7..56d3167832 100644 --- a/epan/dissectors/packet-nlsp.c +++ b/epan/dissectors/packet-nlsp.c @@ -1226,8 +1226,8 @@ nlsp_dissect_nlsp_psnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, * Output: * void, but we will add to the proto_tree if it is not NULL. */ -static void -dissect_nlsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_nlsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti, *type_item; proto_tree *nlsp_tree; @@ -1306,6 +1306,7 @@ dissect_nlsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) default: expert_add_info(pinfo, type_item, &ei_nlsp_type); } + return tvb_captured_length(tvb); } /* @@ -1774,7 +1775,7 @@ proto_reg_handoff_nlsp(void) { dissector_handle_t nlsp_handle; - nlsp_handle = create_dissector_handle(dissect_nlsp, proto_nlsp); + nlsp_handle = new_create_dissector_handle(dissect_nlsp, proto_nlsp); dissector_add_uint("ipx.socket", IPX_SOCKET_NLSP, nlsp_handle); } diff --git a/epan/dissectors/packet-nntp.c b/epan/dissectors/packet-nntp.c index 69b9f459bb..91f87db533 100644 --- a/epan/dissectors/packet-nntp.c +++ b/epan/dissectors/packet-nntp.c @@ -36,8 +36,8 @@ static gint ett_nntp = -1; #define TCP_PORT_NNTP 119 -static void -dissect_nntp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_nntp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { const gchar *type; proto_tree *nntp_tree; @@ -101,6 +101,7 @@ dissect_nntp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset = next_offset; } } + return tvb_captured_length(tvb); } void @@ -132,7 +133,7 @@ proto_reg_handoff_nntp(void) { dissector_handle_t nntp_handle; - nntp_handle = create_dissector_handle(dissect_nntp, proto_nntp); + nntp_handle = new_create_dissector_handle(dissect_nntp, proto_nntp); dissector_add_uint("tcp.port", TCP_PORT_NNTP, nntp_handle); } diff --git a/epan/dissectors/packet-nsrp.c b/epan/dissectors/packet-nsrp.c index 9eec836730..40ad06ec02 100644 --- a/epan/dissectors/packet-nsrp.c +++ b/epan/dissectors/packet-nsrp.c @@ -145,8 +145,8 @@ static const value_string nsrp_encflag_vals[] = { static gint ett_nsrp = -1; /* Code to actually dissect the packets */ -static void -dissect_nsrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_nsrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *nsrp_tree = NULL; @@ -345,6 +345,7 @@ dissect_nsrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } + return tvb_captured_length(tvb); } @@ -509,7 +510,7 @@ proto_reg_handoff_nsrp(void) { dissector_handle_t nsrp_handle; - nsrp_handle = create_dissector_handle(dissect_nsrp, proto_nsrp); + nsrp_handle = new_create_dissector_handle(dissect_nsrp, proto_nsrp); dissector_add_uint("ethertype", ETHERTYPE_NSRP, nsrp_handle); } diff --git a/epan/dissectors/packet-nstrace.c b/epan/dissectors/packet-nstrace.c index 65d4aa4bf5..0a088147f4 100644 --- a/epan/dissectors/packet-nstrace.c +++ b/epan/dissectors/packet-nstrace.c @@ -416,8 +416,8 @@ void add35records(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tre #define VMNAMERECOFFSET(field) (guint)(offsetof(nspr_rec_vmname_t, field)) #define SSLRECOFFSET(field) (guint)(offsetof(nspr_rec_ssl_t, field)) #define MPTCPRECOFFSET(field) (guint)(offsetof(nspr_rec_mptcp_t, field)) -static void -dissect_nstrace(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_nstrace(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *ns_tree = NULL, *flagtree = NULL; proto_item *ti = NULL, *flagitem = NULL; @@ -564,6 +564,8 @@ dissect_nstrace(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) next_tvb_eth_client = tvb_new_subset_remaining(tvb, offset); call_dissector(eth_withoutfcs_handle, next_tvb_eth_client, pinfo, tree); } + + return tvb_captured_length(tvb); } void add35records(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *ns_tree) @@ -1139,7 +1141,7 @@ void proto_reg_handoff_ns(void) eth_withoutfcs_handle = find_dissector("eth_withoutfcs"); - nstrace_handle = create_dissector_handle(dissect_nstrace, proto_nstrace); + nstrace_handle = new_create_dissector_handle(dissect_nstrace, proto_nstrace); dissector_add_uint("wtap_encap", WTAP_ENCAP_NSTRACE_1_0, nstrace_handle); dissector_add_uint("wtap_encap", WTAP_ENCAP_NSTRACE_2_0, nstrace_handle); dissector_add_uint("wtap_encap", WTAP_ENCAP_NSTRACE_3_0, nstrace_handle); diff --git a/epan/dissectors/packet-ntp.c b/epan/dissectors/packet-ntp.c index 3854a19c6b..d0cb9ba1da 100644 --- a/epan/dissectors/packet-ntp.c +++ b/epan/dissectors/packet-ntp.c @@ -1357,8 +1357,8 @@ dissect_ntp_priv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *ntp_tree) * pinfo - packet info * proto_tree - resolved protocol tree */ -static void -dissect_ntp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ntp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *ntp_tree; proto_item *ti = NULL; @@ -1399,6 +1399,7 @@ dissect_ntp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Dissect according to mode */ (*dissector)(tvb, pinfo, ntp_tree); + return tvb_captured_length(tvb); } void @@ -1702,7 +1703,7 @@ proto_reg_handoff_ntp(void) { dissector_handle_t ntp_handle; - ntp_handle = create_dissector_handle(dissect_ntp, proto_ntp); + ntp_handle = new_create_dissector_handle(dissect_ntp, proto_ntp); dissector_add_uint("udp.port", UDP_PORT_NTP, ntp_handle); dissector_add_uint("tcp.port", TCP_PORT_NTP, ntp_handle); } diff --git a/epan/dissectors/packet-null.c b/epan/dissectors/packet-null.c index 361b74fb24..98c9b25923 100644 --- a/epan/dissectors/packet-null.c +++ b/epan/dissectors/packet-null.c @@ -369,8 +369,8 @@ capture_loop( const guchar *pd, int len, packet_counts *ld ) } } -static void -dissect_null(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_null(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint32 null_header; proto_tree *fh_tree; @@ -473,14 +473,15 @@ dissect_null(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } } + return tvb_captured_length(tvb); } /* * OpenBSD DLT_LOOP; like DLT_NULL, but with the first 4 byte *always* * being a *big-endian* type. */ -static void -dissect_loop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_loop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint32 loop_family; proto_tree *fh_tree; @@ -509,6 +510,7 @@ dissect_loop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* No sub-dissector found. Label rest of packet as "Data" */ call_dissector(data_handle,next_tvb, pinfo, tree); } + return tvb_captured_length(tvb); } void @@ -552,10 +554,10 @@ proto_reg_handoff_null(void) ethertype_dissector_table = find_dissector_table("ethertype"); - null_handle = create_dissector_handle(dissect_null, proto_null); + null_handle = new_create_dissector_handle(dissect_null, proto_null); dissector_add_uint("wtap_encap", WTAP_ENCAP_NULL, null_handle); - loop_handle = create_dissector_handle(dissect_loop, proto_null); + loop_handle = new_create_dissector_handle(dissect_loop, proto_null); dissector_add_uint("wtap_encap", WTAP_ENCAP_LOOP, loop_handle); } -- cgit v1.2.3