diff options
author | Michael Mann <mmann78@netscape.net> | 2015-11-23 10:56:36 -0500 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2015-11-23 17:36:39 +0000 |
commit | 57e18b00346f86f0b5d182fcc749a1a005fadb96 (patch) | |
tree | 9e588cfef7c1110e8f7423a550787e8c06c35e69 /epan | |
parent | 5afbf7e0e5c8116002cbd06abce48b410855d5e1 (diff) |
register_dissector -> new_register_dissector
Change-Id: Ifc8208e1b96e2a3bf297912500a5f252bfa8eed9
Reviewed-on: https://code.wireshark.org/review/12073
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-nas_eps.c | 32 | ||||
-rw-r--r-- | epan/dissectors/packet-pdcp-lte.c | 25 | ||||
-rw-r--r-- | epan/dissectors/packet-pop.c | 9 | ||||
-rw-r--r-- | epan/dissectors/packet-rlc.c | 73 | ||||
-rw-r--r-- | epan/dissectors/packet-sndcp.c | 9 | ||||
-rw-r--r-- | epan/dissectors/packet-ssh.c | 10 | ||||
-rw-r--r-- | epan/dissectors/packet-tcp.c | 11 | ||||
-rw-r--r-- | epan/dissectors/packet-tftp.c | 9 | ||||
-rw-r--r-- | epan/dissectors/packet-tn3270.c | 11 | ||||
-rw-r--r-- | epan/dissectors/packet-tn5250.c | 13 | ||||
-rw-r--r-- | epan/dissectors/packet-uasip.c | 9 | ||||
-rw-r--r-- | epan/dissectors/packet-uaudp.c | 13 | ||||
-rw-r--r-- | epan/dissectors/packet-umts_fp.c | 17 | ||||
-rw-r--r-- | epan/dissectors/packet-umts_mac.c | 45 | ||||
-rw-r--r-- | epan/dissectors/packet-user_encap.c | 9 | ||||
-rw-r--r-- | epan/dissectors/packet-v120.c | 58 | ||||
-rw-r--r-- | epan/dissectors/packet-zep.c | 14 |
17 files changed, 195 insertions, 172 deletions
diff --git a/epan/dissectors/packet-nas_eps.c b/epan/dissectors/packet-nas_eps.c index 21730d8fed..ee1999b31e 100644 --- a/epan/dissectors/packet-nas_eps.c +++ b/epan/dissectors/packet-nas_eps.c @@ -4849,8 +4849,8 @@ dissect_nas_eps_emm_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int } -static void -dissect_nas_eps_plain(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_nas_eps_plain(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *item; proto_tree *nas_eps_tree; @@ -4873,7 +4873,7 @@ dissect_nas_eps_plain(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(nas_eps_tree, hf_gsm_a_L3_protocol_discriminator, tvb, 0, 1, ENC_BIG_ENDIAN); offset++; nas_emm_service_req(tvb, nas_eps_tree, pinfo, offset, tvb_reported_length(tvb)-offset); - return; + return tvb_captured_length(tvb); } pd &= 0x0f; @@ -4905,6 +4905,7 @@ dissect_nas_eps_plain(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; } + return tvb_captured_length(tvb); } /* TS 24.301 8.2.1 @@ -4938,8 +4939,8 @@ dissect_nas_eps_plain(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * 4.4.4.2 All ESM messages are integrity protected. */ -static void -dissect_nas_eps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_nas_eps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *item; proto_tree *nas_eps_tree; @@ -4952,13 +4953,13 @@ dissect_nas_eps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* The protected NAS message header is 6 octets long, and the NAS message header is at least 2 octets long. */ /* If the length of the tvbuffer is less than 8 octets, we can safely conclude the message is not protected. */ if (len < 8) { - dissect_nas_eps_plain(tvb, pinfo, tree); - return; + dissect_nas_eps_plain(tvb, pinfo, tree, data); + return tvb_captured_length(tvb); } if (g_nas_eps_dissect_plain) { - dissect_nas_eps_plain(tvb, pinfo, tree); - return; + dissect_nas_eps_plain(tvb, pinfo, tree, data); + return tvb_captured_length(tvb); } /* make entry in the Protocol column on summary display */ @@ -4979,17 +4980,17 @@ dissect_nas_eps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (pd == 7) { /* Plain EPS mobility management messages. */ dissect_nas_eps_emm_msg(tvb, pinfo, nas_eps_tree, offset, FALSE); - return; + return tvb_captured_length(tvb); } else { proto_tree_add_expert(nas_eps_tree, pinfo, &ei_nas_eps_esm_tp_not_integ_prot, tvb, offset, len); - return; + return tvb_captured_length(tvb); } } else { /* SERVICE REQUEST (12 or greater) is not a plain NAS message treat separately */ if (security_header_type >= 12) { col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Service request"); nas_emm_service_req(tvb, nas_eps_tree, pinfo, offset, len-offset); - return; + return tvb_captured_length(tvb); } /* Message authentication code */ proto_tree_add_item(nas_eps_tree, hf_nas_eps_msg_auth_code, tvb, offset, 4, ENC_BIG_ENDIAN); @@ -5008,7 +5009,7 @@ dissect_nas_eps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if ((pd != 7) && (pd != 15) && (((pd&0x0f) != 2) || (((pd&0x0f) == 2) && ((pd&0xf0) > 0) && ((pd&0xf0) < 0x50)))) { proto_tree_add_item(nas_eps_tree, hf_nas_eps_ciphered_msg, tvb, offset, len-6, ENC_NA); - return; + return tvb_captured_length(tvb); } } else { /* msg_auth_code == 0, probably not ciphered */ @@ -5053,6 +5054,7 @@ dissect_nas_eps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; } + return tvb_captured_length(tvb); } void @@ -5917,10 +5919,10 @@ proto_register_nas_eps(void) expert_register_field_array(expert_nas_eps, ei, array_length(ei)); /* Register dissector */ - register_dissector(PFNAME, dissect_nas_eps, proto_nas_eps); + new_register_dissector(PFNAME, dissect_nas_eps, proto_nas_eps); /* Register dissector */ - register_dissector("nas-eps_plain", dissect_nas_eps_plain, proto_nas_eps); + new_register_dissector("nas-eps_plain", dissect_nas_eps_plain, proto_nas_eps); /* Register configuration options to always dissect as plain messages */ nas_eps_module = prefs_register_protocol(proto_nas_eps, NULL); diff --git a/epan/dissectors/packet-pdcp-lte.c b/epan/dissectors/packet-pdcp-lte.c index a6314dde5f..158b3481d9 100644 --- a/epan/dissectors/packet-pdcp-lte.c +++ b/epan/dissectors/packet-pdcp-lte.c @@ -1227,7 +1227,7 @@ static dissector_handle_t lookup_rrc_dissector_handle(struct pdcp_lte_info *p_p /* Forwad declarations */ -static void dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +static int dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data); /* Heuristic dissector looks for supported framing protocol (see wiki page) */ static gboolean dissect_pdcp_lte_heur(tvbuff_t *tvb, packet_info *pinfo, @@ -1362,7 +1362,7 @@ static gboolean dissect_pdcp_lte_heur(tvbuff_t *tvb, packet_info *pinfo, /* Create tvb that starts at actual PDCP PDU */ pdcp_tvb = tvb_new_subset_remaining(tvb, offset); - dissect_pdcp_lte(pdcp_tvb, pinfo, tree); + dissect_pdcp_lte(pdcp_tvb, pinfo, tree, data); return TRUE; } @@ -1684,7 +1684,7 @@ static guint32 calculate_digest(pdu_security_settings_t *pdu_security_settings, /******************************/ /* Main dissection function. */ -static void dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { const char *mode; proto_tree *pdcp_tree = NULL; @@ -1711,7 +1711,7 @@ static void dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree p_pdcp_info = (struct pdcp_lte_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_pdcp_lte, 0); /* Can't dissect anything without it... */ if (p_pdcp_info == NULL) { - return; + return 0; } /* Don't want to overwrite the RLC Info column if configured not to */ @@ -1845,7 +1845,7 @@ static void dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree if (tvb_captured_length_remaining(tvb, offset) == 0) { /* Only PDCP header was captured, stop dissection here */ - return; + return offset; } } else if (p_pdcp_info->plane == USER_PLANE) { @@ -1900,7 +1900,7 @@ static void dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree break; default: /* Not a recognised data format!!!!! */ - return; + return 1; } write_pdu_label_and_info(root_ti, pinfo, " (SN=%u)", seqnum); @@ -1989,14 +1989,14 @@ static void dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree write_pdu_label_and_info(root_ti, pinfo, " Status Report (fms=%u) not-received=%u", fms, not_received); } - return; + return 1; case 1: /* ROHC Feedback */ offset++; break; /* Drop-through to dissect feedback */ default: /* Reserved */ - return; + return 1; } } } @@ -2004,7 +2004,7 @@ static void dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree /* Invalid plane setting...! */ write_pdu_label_and_info(root_ti, pinfo, " - INVALID PLANE (%u)", p_pdcp_info->plane); - return; + return 1; } /* Do sequence analysis if configured to. */ @@ -2185,7 +2185,7 @@ static void dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree col_set_writable(pinfo->cinfo, global_pdcp_lte_layer_to_show == ShowRLCLayer); /* DROPPING OUT HERE IF NOT DOING ROHC! */ - return; + return tvb_captured_length(tvb); } else { /***************************/ @@ -2196,7 +2196,7 @@ static void dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree if (!global_pdcp_dissect_rohc) { col_append_fstr(pinfo->cinfo, COL_PROTOCOL, "|ROHC(%s)", val_to_str_const(p_pdcp_info->rohc.profile, rohc_profile_vals, "Unknown")); - return; + return 1; } rohc_tvb = tvb_new_subset_remaining(payload_tvb, offset); @@ -2216,6 +2216,7 @@ static void dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree col_set_writable(pinfo->cinfo, global_pdcp_lte_layer_to_show == ShowRLCLayer); } } + return tvb_captured_length(tvb); } /* Initializes the hash tables each time a new @@ -2601,7 +2602,7 @@ void proto_register_pdcp(void) expert_register_field_array(expert_pdcp_lte, ei, array_length(ei)); /* Allow other dissectors to find this one by name. */ - register_dissector("pdcp-lte", dissect_pdcp_lte, proto_pdcp_lte); + new_register_dissector("pdcp-lte", dissect_pdcp_lte, proto_pdcp_lte); pdcp_lte_module = prefs_register_protocol(proto_pdcp_lte, NULL); diff --git a/epan/dissectors/packet-pop.c b/epan/dissectors/packet-pop.c index 2d7bbbd028..f8a7948894 100644 --- a/epan/dissectors/packet-pop.c +++ b/epan/dissectors/packet-pop.c @@ -121,8 +121,8 @@ struct pop_data_val { static gboolean response_is_continuation(const guchar *data); -static void -dissect_pop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_pop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { struct pop_proto_data *frame_data_p; gboolean is_request; @@ -245,7 +245,7 @@ dissect_pop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) call_dissector(data_handle,tvb, pinfo, pop_tree); } - return; + return tvb_captured_length(tvb); } /* @@ -349,6 +349,7 @@ dissect_pop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset = next_offset; } } + return tvb_captured_length(tvb); } static gboolean response_is_continuation(const guchar *data) @@ -447,7 +448,7 @@ proto_register_pop(void) proto_pop = proto_register_protocol("Post Office Protocol", "POP", "pop"); - register_dissector("pop", dissect_pop, proto_pop); + new_register_dissector("pop", dissect_pop, proto_pop); proto_register_field_array(proto_pop, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); register_init_routine (&pop_data_reassemble_init); diff --git a/epan/dissectors/packet-rlc.c b/epan/dissectors/packet-rlc.c index 0e71fb2cce..e00d2cd741 100644 --- a/epan/dissectors/packet-rlc.c +++ b/epan/dissectors/packet-rlc.c @@ -2337,8 +2337,8 @@ dissect_rlc_am(enum rlc_channel_type channel, tvbuff_t *tvb, packet_info *pinfo, } /* dissect entry functions */ -static void -dissect_rlc_pcch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_rlc_pcch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *subtree = NULL; @@ -2353,10 +2353,11 @@ dissect_rlc_pcch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item_append_text(ti, " TM (PCCH)"); } dissect_rlc_tm(RLC_PCCH, tvb, pinfo, tree, subtree); + return tvb_captured_length(tvb); } -static void -dissect_rlc_bcch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_rlc_bcch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { fp_info *fpi; proto_item *ti = NULL; @@ -2366,7 +2367,7 @@ dissect_rlc_bcch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_clear(pinfo->cinfo, COL_INFO); fpi = (fp_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_fp, 0); - if (!fpi) return; /* dissection failure */ + if (!fpi) return 0; /* dissection failure */ if (tree) { ti = proto_tree_add_item(tree, proto_rlc, tvb, 0, -1, ENC_NA); @@ -2374,10 +2375,11 @@ dissect_rlc_bcch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } proto_item_append_text(ti, " TM (BCCH)"); dissect_rlc_tm(RLC_BCCH, tvb, pinfo, tree, subtree); + return tvb_captured_length(tvb); } -static void -dissect_rlc_ccch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_rlc_ccch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { fp_info *fpi; proto_item *ti = NULL; @@ -2387,7 +2389,7 @@ dissect_rlc_ccch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_clear(pinfo->cinfo, COL_INFO); fpi = (fp_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_fp, 0); - if (!fpi) return; /* dissection failure */ + if (!fpi) return 0; /* dissection failure */ if (tree) { ti = proto_tree_add_item(tree, proto_rlc, tvb, 0, -1, ENC_NA); @@ -2403,10 +2405,11 @@ dissect_rlc_ccch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item_append_text(ti, " UM (CCCH)"); dissect_rlc_um(RLC_DL_CCCH, tvb, pinfo, tree, subtree); } + return tvb_captured_length(tvb); } -static void -dissect_rlc_ctch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_rlc_ctch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * data _U_) { fp_info *fpi; proto_item *ti = NULL; @@ -2417,7 +2420,7 @@ dissect_rlc_ctch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_clear(pinfo->cinfo, COL_INFO); fpi = (fp_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_fp, 0); - if (!fpi) return; /* dissection failure */ + if (!fpi) return 0; /* dissection failure */ if (tree) { ti = proto_tree_add_item(tree, proto_rlc, tvb, 0, -1, ENC_NA); @@ -2427,10 +2430,11 @@ dissect_rlc_ctch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* CTCH is always UM */ proto_item_append_text(ti, " UM (CTCH)"); dissect_rlc_um(RLC_DL_CTCH, tvb, pinfo, tree, subtree); + return tvb_captured_length(tvb); } -static void -dissect_rlc_dcch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_rlc_dcch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti = NULL; proto_tree *subtree = NULL; @@ -2446,7 +2450,7 @@ dissect_rlc_dcch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (!fpi || !rlci){ proto_tree_add_expert(tree, pinfo, &ei_rlc_no_per_frame_data, tvb, 0, -1); - return; + return 1; } if (tree) { @@ -2466,10 +2470,11 @@ dissect_rlc_dcch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_rlc_am(channel, tvb, pinfo, tree, subtree); break; } + return tvb_captured_length(tvb); } -static void -dissect_rlc_ps_dtch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_rlc_ps_dtch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti = NULL; proto_tree *subtree = NULL; @@ -2484,7 +2489,7 @@ dissect_rlc_ps_dtch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (!fpi || !rlci) { proto_tree_add_expert(tree, pinfo, &ei_rlc_no_per_frame_data, tvb, 0, -1); - return; + return 1; } if (tree) { @@ -2506,10 +2511,11 @@ dissect_rlc_ps_dtch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_rlc_tm(RLC_PS_DTCH, tvb, pinfo, tree, subtree); break; } + return tvb_captured_length(tvb); } -static void -dissect_rlc_dch_unknown(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_rlc_dch_unknown(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti = NULL; proto_tree *subtree = NULL; @@ -2522,7 +2528,7 @@ dissect_rlc_dch_unknown(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) fpi = (fp_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_fp, 0); rlci = (rlc_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_rlc, 0); - if (!fpi || !rlci) return; + if (!fpi || !rlci) return 0; if (tree) { ti = proto_tree_add_item(tree, proto_rlc, tvb, 0, -1, ENC_NA); @@ -2543,6 +2549,7 @@ dissect_rlc_dch_unknown(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_rlc_tm(RLC_UNKNOWN_CH, tvb, pinfo, tree, subtree); break; } + return tvb_captured_length(tvb); } @@ -2683,22 +2690,22 @@ dissect_rlc_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data } break; case UMTS_CHANNEL_TYPE_PCCH: - dissect_rlc_pcch(rlc_tvb, pinfo, tree); + dissect_rlc_pcch(rlc_tvb, pinfo, tree, data); break; case UMTS_CHANNEL_TYPE_CCCH: - dissect_rlc_ccch(rlc_tvb, pinfo, tree); + dissect_rlc_ccch(rlc_tvb, pinfo, tree, data); break; case UMTS_CHANNEL_TYPE_DCCH: - dissect_rlc_dcch(rlc_tvb, pinfo, tree); + dissect_rlc_dcch(rlc_tvb, pinfo, tree, data); break; case UMTS_CHANNEL_TYPE_PS_DTCH: - dissect_rlc_ps_dtch(rlc_tvb, pinfo, tree); + dissect_rlc_ps_dtch(rlc_tvb, pinfo, tree, data); break; case UMTS_CHANNEL_TYPE_CTCH: - dissect_rlc_ctch(rlc_tvb, pinfo, tree); + dissect_rlc_ctch(rlc_tvb, pinfo, tree, data); break; case UMTS_CHANNEL_TYPE_BCCH: - dissect_rlc_bcch(rlc_tvb, pinfo, tree); + dissect_rlc_bcch(rlc_tvb, pinfo, tree, data); break; default: /* Unknown channel type */ @@ -2932,13 +2939,13 @@ proto_register_rlc(void) }; proto_rlc = proto_register_protocol("Radio Link Control", "RLC", "rlc"); - register_dissector("rlc.bcch", dissect_rlc_bcch, proto_rlc); - register_dissector("rlc.pcch", dissect_rlc_pcch, proto_rlc); - register_dissector("rlc.ccch", dissect_rlc_ccch, proto_rlc); - register_dissector("rlc.ctch", dissect_rlc_ctch, proto_rlc); - register_dissector("rlc.dcch", dissect_rlc_dcch, proto_rlc); - register_dissector("rlc.ps_dtch", dissect_rlc_ps_dtch, proto_rlc); - register_dissector("rlc.dch_unknown", dissect_rlc_dch_unknown, proto_rlc); + new_register_dissector("rlc.bcch", dissect_rlc_bcch, proto_rlc); + new_register_dissector("rlc.pcch", dissect_rlc_pcch, proto_rlc); + new_register_dissector("rlc.ccch", dissect_rlc_ccch, proto_rlc); + new_register_dissector("rlc.ctch", dissect_rlc_ctch, proto_rlc); + new_register_dissector("rlc.dcch", dissect_rlc_dcch, proto_rlc); + new_register_dissector("rlc.ps_dtch", dissect_rlc_ps_dtch, proto_rlc); + new_register_dissector("rlc.dch_unknown", dissect_rlc_dch_unknown, proto_rlc); proto_register_field_array(proto_rlc, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); diff --git a/epan/dissectors/packet-sndcp.c b/epan/dissectors/packet-sndcp.c index a3fb567098..657cae264d 100644 --- a/epan/dissectors/packet-sndcp.c +++ b/epan/dissectors/packet-sndcp.c @@ -196,8 +196,8 @@ static const true_false_string m_bit = { /* Code to actually dissect the packets */ -static void -dissect_sndcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_sndcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint8 addr_field, comp_field, npdu_field1, dcomp=0, pcomp=0; guint16 offset=0, npdu=0, segment=0, npdu_field2; @@ -322,7 +322,7 @@ dissect_sndcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) len = tvb_captured_length_remaining(tvb, offset); if(len<=0){ - return; + return offset; } pinfo->fragmented = TRUE; @@ -369,6 +369,7 @@ dissect_sndcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) */ pinfo->fragmented = save_fragmented; } + return tvb_captured_length(tvb); } @@ -559,7 +560,7 @@ proto_register_sndcp(void) /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_sndcp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - register_dissector("sndcp", dissect_sndcp, proto_sndcp); + new_register_dissector("sndcp", dissect_sndcp, proto_sndcp); register_init_routine(sndcp_defragment_init); register_cleanup_routine(sndcp_defragment_cleanup); } diff --git a/epan/dissectors/packet-ssh.c b/epan/dissectors/packet-ssh.c index 6922f2c109..b5041f750e 100644 --- a/epan/dissectors/packet-ssh.c +++ b/epan/dissectors/packet-ssh.c @@ -319,10 +319,9 @@ static void ssh_set_mac_length(struct ssh_peer_data *peer_data); static void ssh_set_kex_specific_dissector(struct ssh_flow_data *global_data); -static void -dissect_ssh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ssh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { - proto_tree *ssh_tree; proto_item *ti; conversation_t *conversation; @@ -418,7 +417,7 @@ dissect_ssh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if (need_desegmentation) - return; + return tvb_captured_length(tvb); if (offset <= last_offset) { /* XXX - add an expert info in the function that decrements offset */ @@ -427,6 +426,7 @@ dissect_ssh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } col_prepend_fstr(pinfo->cinfo, COL_INFO, "%s: ", is_response ? "Server" : "Client"); + return tvb_captured_length(tvb); } static int @@ -1391,7 +1391,7 @@ proto_register_ssh(void) "To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.", &ssh_desegment); - ssh_handle = register_dissector("ssh", dissect_ssh, proto_ssh); + ssh_handle = new_register_dissector("ssh", dissect_ssh, proto_ssh); } void diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c index 7cc37e294b..fec885b3b2 100644 --- a/epan/dissectors/packet-tcp.c +++ b/epan/dissectors/packet-tcp.c @@ -4797,8 +4797,8 @@ tcp_flags_to_str_first_letter(const struct tcpheader *tcph) return buf; } -static void -dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint8 th_off_x2; /* combines th_off and th_x2 */ guint16 th_sum; @@ -5040,7 +5040,7 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) "%u bytes (bogus, must be at least %u)", tcph->th_hlen, TCPH_MIN_LEN); } - return; + return offset+12; } if (tree) { @@ -5509,7 +5509,7 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) process_tcp_payload(next_tvb, 0, pinfo, tree, tcp_tree, tcph->th_sport, tcph->th_dport, tcph->th_seq, nxtseq, FALSE, tcpd, &tcpinfo); - return; + return tvb_captured_length(tvb); } } } else { @@ -5576,6 +5576,7 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tcph->th_sport, tcph->th_dport, tree, tcp_tree, tcpd, &tcpinfo); } } + return tvb_captured_length(tvb); } static void @@ -6514,7 +6515,7 @@ proto_register_tcp(void) expert_module_t* expert_mptcp; proto_tcp = proto_register_protocol("Transmission Control Protocol", "TCP", "tcp"); - register_dissector("tcp", dissect_tcp, proto_tcp); + new_register_dissector("tcp", dissect_tcp, proto_tcp); proto_register_field_array(proto_tcp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); expert_tcp = expert_register_protocol(proto_tcp); diff --git a/epan/dissectors/packet-tftp.c b/epan/dissectors/packet-tftp.c index cd91bbdecf..96f39bd758 100644 --- a/epan/dissectors/packet-tftp.c +++ b/epan/dissectors/packet-tftp.c @@ -539,8 +539,8 @@ dissect_embeddedtftp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v return TRUE; } -static void -dissect_tftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_tftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { conversation_t *conversation = NULL; tftp_conv_info_t *tftp_info; @@ -584,7 +584,7 @@ dissect_tftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (pinfo->destport == conversation->key_ptr->port1) conversation_set_port2(conversation, pinfo->srcport); else - return; + return 0; } } tftp_info = (tftp_conv_info_t *)conversation_get_proto_data(conversation, proto_tftp); @@ -602,6 +602,7 @@ dissect_tftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } dissect_tftp_message(tftp_info, tvb, pinfo, tree); + return tvb_captured_length(tvb); } @@ -678,7 +679,7 @@ proto_register_tftp(void) expert_tftp = expert_register_protocol(proto_tftp); expert_register_field_array(expert_tftp, ei, array_length(ei)); - register_dissector("tftp", dissect_tftp, proto_tftp); + new_register_dissector("tftp", dissect_tftp, proto_tftp); /* Set default UDP ports */ range_convert_str(&global_tftp_port_range, UDP_PORT_TFTP_RANGE, MAX_UDP_PORT); diff --git a/epan/dissectors/packet-tn3270.c b/epan/dissectors/packet-tn3270.c index e7c879c9a5..b7fbabc150 100644 --- a/epan/dissectors/packet-tn3270.c +++ b/epan/dissectors/packet-tn3270.c @@ -5234,8 +5234,8 @@ dissect_inbound_stream(proto_tree *tn3270_tree, packet_info *pinfo, tvbuff_t *tv } -static void -dissect_tn3270(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_tn3270(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *tn3270_tree; proto_item *pi; @@ -5257,7 +5257,7 @@ dissect_tn3270(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if (tn3270_info == NULL) - return; + return 0; pi = proto_tree_add_item(tree, proto_tn3270, tvb, offset, -1, ENC_NA); tn3270_tree = proto_item_add_subtree(pi, ett_tn3270); @@ -5268,7 +5268,7 @@ dissect_tn3270(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if (tvb_reported_length_remaining(tvb, offset) <= 0) - return; + return offset; if (pinfo->srcport == tn3270_info->outbound_port) { col_set_str(pinfo->cinfo, COL_INFO, "TN3270 Data from Mainframe"); @@ -5288,6 +5288,7 @@ dissect_tn3270(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } + return tvb_captured_length(tvb); } void @@ -7665,7 +7666,7 @@ proto_register_tn3270(void) expert_module_t* expert_tn3270; proto_tn3270 = proto_register_protocol("TN3270 Protocol", "TN3270", "tn3270"); - register_dissector("tn3270", dissect_tn3270, proto_tn3270); + new_register_dissector("tn3270", dissect_tn3270, proto_tn3270); proto_register_field_array(proto_tn3270, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); expert_tn3270 = expert_register_protocol(proto_tn3270); diff --git a/epan/dissectors/packet-tn5250.c b/epan/dissectors/packet-tn5250.c index db2e9db84b..fd06a13c64 100644 --- a/epan/dissectors/packet-tn5250.c +++ b/epan/dissectors/packet-tn5250.c @@ -5114,8 +5114,8 @@ dissect_inbound_stream(proto_tree *tn5250_tree, packet_info *pinfo, tvbuff_t *tv return (offset - start); } -static void -dissect_tn5250(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_tn5250(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *tn5250_tree; proto_item *ti; @@ -5124,8 +5124,6 @@ dissect_tn5250(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tn5250_conv_info_t *tn5250_info = NULL; int sna_flag; - pinfo->fd->flags.encoding = PACKET_CHAR_ENC_CHAR_EBCDIC; - /* Do we have a conversation for this connection? */ conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, @@ -5136,7 +5134,9 @@ dissect_tn5250(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if (!tn5250_info) - return; + return 0; + + pinfo->fd->flags.encoding = PACKET_CHAR_ENC_CHAR_EBCDIC; col_set_str(pinfo->cinfo, COL_PROTOCOL, "TN5250"); @@ -5161,6 +5161,7 @@ dissect_tn5250(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } + return tvb_captured_length(tvb); } void @@ -7545,7 +7546,7 @@ proto_register_tn5250(void) expert_module_t* expert_tn5250; proto_tn5250 = proto_register_protocol("TN5250 Protocol", "TN5250", "tn5250"); - register_dissector("tn5250", dissect_tn5250, proto_tn5250); + new_register_dissector("tn5250", dissect_tn5250, proto_tn5250); proto_register_field_array(proto_tn5250, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); expert_tn5250 = expert_register_protocol(proto_tn5250); diff --git a/epan/dissectors/packet-uasip.c b/epan/dissectors/packet-uasip.c index 514f282be9..44439757c0 100644 --- a/epan/dissectors/packet-uasip.c +++ b/epan/dissectors/packet-uasip.c @@ -257,22 +257,23 @@ static void _dissect_uasip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, #endif } -static void dissect_uasip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_uasip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { if (use_proxy_ipaddr) { if (memcmp((pinfo->src).data, proxy_ipaddr, sizeof(proxy_ipaddr)) == 0) { _dissect_uasip(tvb, pinfo, tree, SYS_TO_TERM); - return; + return tvb_captured_length(tvb); } else if (memcmp((pinfo->dst).data, proxy_ipaddr, sizeof(proxy_ipaddr)) == 0) { _dissect_uasip(tvb, pinfo, tree, TERM_TO_SYS); - return; + return tvb_captured_length(tvb); } } _dissect_uasip(tvb, pinfo, tree, DIR_UNKNOWN); + return tvb_captured_length(tvb); } void proto_register_uasip(void) @@ -444,7 +445,7 @@ void proto_register_uasip(void) }; proto_uasip = proto_register_protocol("UA/SIP Protocol", "UASIP", "uasip"); - uasip_handle = register_dissector("uasip", dissect_uasip, proto_uasip); + uasip_handle = new_register_dissector("uasip", dissect_uasip, proto_uasip); proto_register_field_array(proto_uasip, hf_uasip, array_length(hf_uasip)); proto_register_subtree_array(ett, array_length(ett)); diff --git a/epan/dissectors/packet-uaudp.c b/epan/dissectors/packet-uaudp.c index f8475d6f77..fea7a9235d 100644 --- a/epan/dissectors/packet-uaudp.c +++ b/epan/dissectors/packet-uaudp.c @@ -352,7 +352,7 @@ static void dissect_uaudp_serv_to_term(tvbuff_t *tvb, packet_info *pinfo, proto_ * UA/UDP DISSECTOR Wireshark packet dissector entry point */ -static void dissect_uaudp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_uaudp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { /* server address, if present, has precedence on ports */ if (use_sys_ip) { @@ -360,12 +360,12 @@ static void dissect_uaudp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (memcmp((pinfo->src).data, sys_ip, 4*sizeof(guint8)) == 0) { _dissect_uaudp(tvb, pinfo, tree, SYS_TO_TERM); - return; + return tvb_captured_length(tvb); } else if (memcmp((pinfo->dst).data, sys_ip, 4*sizeof(guint8)) == 0) { _dissect_uaudp(tvb, pinfo, tree, TERM_TO_SYS); - return; + return tvb_captured_length(tvb); } } @@ -373,15 +373,16 @@ static void dissect_uaudp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (find_terminal_port(pinfo->srcport)) { _dissect_uaudp(tvb, pinfo, tree, TERM_TO_SYS); - return; + return tvb_captured_length(tvb); } else if (find_terminal_port(pinfo->destport)) { _dissect_uaudp(tvb, pinfo, tree, SYS_TO_TERM); - return; + return tvb_captured_length(tvb); } _dissect_uaudp(tvb, pinfo, tree, DIR_UNKNOWN); + return tvb_captured_length(tvb); } /* XXX: Presumably there's a util fcn for this ... */ @@ -591,7 +592,7 @@ void proto_register_uaudp(void) "UAUDP", "uaudp"); - uaudp_handle = register_dissector("uaudp", dissect_uaudp, proto_uaudp); + uaudp_handle = new_register_dissector("uaudp", dissect_uaudp, proto_uaudp); #if 0 /* XXX: Not used ?? */ new_register_dissector("uaudp_dir_unknown", dissect_uaudp_dir_unknown, proto_uaudp); new_register_dissector("uaudp_term_to_serv", dissect_uaudp_term_to_serv, proto_uaudp); diff --git a/epan/dissectors/packet-umts_fp.c b/epan/dissectors/packet-umts_fp.c index 3386c9c437..123e0925ce 100644 --- a/epan/dissectors/packet-umts_fp.c +++ b/epan/dissectors/packet-umts_fp.c @@ -586,7 +586,7 @@ static void dissect_e_dch_t2_or_common_channel_info(tvbuff_t *tvb, packet_info * gboolean is_common, guint16 header_crc, proto_item * header_crc_pi); /* Main dissection function */ -static void dissect_fp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +static int dissect_fp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data); /* * CRNC sends data downlink on uplink parameters. @@ -3785,7 +3785,7 @@ heur_dissect_fp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data if (calc_crc == crc) { /* assume this is FP, set conversatio dissector to catch the data frames too */ conversation_set_dissector(find_or_create_conversation(pinfo), fp_handle); - dissect_fp(tvb, pinfo, tree); + dissect_fp(tvb, pinfo, tree, data); return TRUE; } } @@ -3804,7 +3804,7 @@ heur_dissect_fp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data return FALSE; /* assume this is FP */ - dissect_fp(tvb, pinfo, tree); + dissect_fp(tvb, pinfo, tree, data); return TRUE; } static guint8 fakes =5; /*[] ={1,5,8};*/ @@ -4181,8 +4181,8 @@ fp_set_per_packet_inf_from_conv(umts_fp_conversation_info_t *p_conv_data, /*****************************/ /* Main dissection function. */ -static void -dissect_fp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_fp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *fp_tree; proto_item *ti; @@ -4260,7 +4260,7 @@ dissect_fp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Can't dissect anything without it... */ if (p_fp_info == NULL) { proto_tree_add_expert(fp_tree, pinfo, &ei_fp_no_per_frame_info, tvb, offset, -1); - return; + return 1; } rlcinf = (rlc_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_rlc, 0); @@ -4322,7 +4322,7 @@ dissect_fp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Don't currently handle IuR-specific formats, but it's useful to even see the channel type and direction */ if (p_fp_info->iface_type == IuR_Interface) { - return; + return 1; } /* Show DDI config info */ @@ -4439,6 +4439,7 @@ dissect_fp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) expert_add_info(pinfo, NULL, &ei_fp_channel_type_unknown); break; } + return tvb_captured_length(tvb); } #ifdef UMTS_FP_USE_UAT @@ -5577,7 +5578,7 @@ void proto_register_fp(void) expert_register_field_array(expert_fp, ei, array_length(ei)); /* Allow other dissectors to find this one by name. */ - register_dissector("fp", dissect_fp, proto_fp); + new_register_dissector("fp", dissect_fp, proto_fp); /* Preferences */ fp_module = prefs_register_protocol(proto_fp, NULL); diff --git a/epan/dissectors/packet-umts_mac.c b/epan/dissectors/packet-umts_mac.c index 8fe830c451..99844bfdce 100644 --- a/epan/dissectors/packet-umts_mac.c +++ b/epan/dissectors/packet-umts_mac.c @@ -259,7 +259,7 @@ static guint16 tree_add_common_dcch_dtch_fields(tvbuff_t *tvb, packet_info *pinf return bitoffs; } -static void dissect_mac_fdd_pch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_mac_fdd_pch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *pch_tree = NULL; proto_item *channel_type; @@ -276,9 +276,10 @@ static void dissect_mac_fdd_pch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t PROTO_ITEM_SET_GENERATED(channel_type); } call_dissector(rlc_pcch_handle, tvb, pinfo, tree); + return tvb_captured_length(tvb); } -static void dissect_mac_fdd_rach(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_mac_fdd_rach(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint8 tctf; guint8 chan; @@ -308,7 +309,7 @@ static void dissect_mac_fdd_rach(tvbuff_t *tvb, packet_info *pinfo, proto_tree * rlcinf = (rlc_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_rlc, 0); if (!macinf || !fpinf) { proto_tree_add_expert(rach_tree, pinfo, &ei_mac_per_frame_info_missing, tvb, 0, -1); - return; + return 1; } proto_tree_add_bits_item(rach_tree, hf_mac_rach_fdd_tctf, tvb, 0, 2, ENC_BIG_ENDIAN); @@ -364,9 +365,10 @@ static void dissect_mac_fdd_rach(tvbuff_t *tvb, packet_info *pinfo, proto_tree * proto_item_append_text(ti, " (Unknown RACH TCTF)"); expert_add_info_format(pinfo, NULL, &ei_mac_rach_tctf_unknown, "Unknown RACH TCTF"); } + return tvb_captured_length(tvb); } -static void dissect_mac_fdd_fach(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_mac_fdd_fach(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint8 hdr, tctf; guint16 bitoffs = 0; @@ -400,7 +402,7 @@ static void dissect_mac_fdd_fach(tvbuff_t *tvb, packet_info *pinfo, proto_tree * if (!macinf || !fpinf) { proto_tree_add_expert(fach_tree, pinfo, &ei_mac_per_frame_info_missing, tvb, 0, -1); - return; + return 1; } proto_tree_add_bits_item(fach_tree, hf_mac_fach_fdd_tctf, tvb, 0, tctf_len, ENC_BIG_ENDIAN); @@ -492,9 +494,10 @@ static void dissect_mac_fdd_fach(tvbuff_t *tvb, packet_info *pinfo, proto_tree * expert_add_info_format(pinfo, NULL, &ei_mac_unknown_content, " Unknown FACH Content"); break; } + return tvb_captured_length(tvb); } -static void dissect_mac_fdd_dch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_mac_fdd_dch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint16 pos; guint8 bitoffs = 0; @@ -517,7 +520,7 @@ static void dissect_mac_fdd_dch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t if (!macinf || !fpinf) { proto_tree_add_expert(dch_tree, pinfo, &ei_mac_per_frame_info_missing, tvb, 0, -1); - return; + return 1; } pos = fpinf->cur_tb; @@ -598,6 +601,7 @@ static void dissect_mac_fdd_dch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t proto_item_append_text(ti, " (Unknown DCH Content)"); expert_add_info_format(pinfo, NULL, &ei_mac_unknown_content, "Unknown DCH Content"); } + return tvb_captured_length(tvb); } static void init_frag(tvbuff_t * tvb, body_parts * bp, guint length, guint offset, guint32 frame_num, guint16 tsn, guint8 type) @@ -942,7 +946,7 @@ static void call_rlc(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, pro /* * Dissect a MAC-is PDU. */ -static void dissect_mac_fdd_edch_type2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_mac_fdd_edch_type2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint sdu_no, subframe_bytes = 0, offset = 0; guint8 ss; @@ -1004,9 +1008,10 @@ static void dissect_mac_fdd_edch_type2(tvbuff_t *tvb, packet_info *pinfo, proto_ proto_item_set_len(pi, 1+subframe_bytes); /*total_bytes += subframe_bytes;*/ + return tvb_captured_length(tvb); } -static void dissect_mac_fdd_edch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_mac_fdd_edch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *edch_tree = NULL; proto_item *channel_type; @@ -1025,7 +1030,7 @@ static void dissect_mac_fdd_edch(tvbuff_t *tvb, packet_info *pinfo, proto_tree * macinf = (umts_mac_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_umts_mac, 0); if (!macinf|| !fpinf) { proto_tree_add_expert(edch_tree, pinfo, &ei_mac_per_frame_info_missing, tvb, 0, -1); - return; + return 1; } pos = fpinf->cur_tb; @@ -1065,6 +1070,7 @@ static void dissect_mac_fdd_edch(tvbuff_t *tvb, packet_info *pinfo, proto_tree * expert_add_info_format(pinfo, ti, &ei_mac_unknown_content, "Unknown EDCH Content"); break; } + return tvb_captured_length(tvb); } /** * Dissect hsdsch_common channel. @@ -1135,7 +1141,7 @@ static void dissect_mac_fdd_hsdsch_common(tvbuff_t *tvb, packet_info *pinfo, pro * no re-alignment is necessary * If no C/T is present, the whole payload will be left-shifted by 4 bit */ -static void dissect_mac_fdd_hsdsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_mac_fdd_hsdsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *hsdsch_tree = NULL; proto_item *channel_type; @@ -1162,7 +1168,7 @@ static void dissect_mac_fdd_hsdsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree if (!macinf) { proto_tree_add_expert(hsdsch_tree, pinfo, &ei_mac_per_frame_info_missing, tvb, 0, -1); - return; + return 1; } if (macinf->ctmux[pos]) { /*The 4'st bits are padding*/ proto_tree_add_bits_item(hsdsch_tree, hf_mac_ct, tvb, bitoffs, 4, ENC_BIG_ENDIAN); @@ -1264,6 +1270,7 @@ static void dissect_mac_fdd_hsdsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree proto_item_append_text(ti, " (Unknown HSDSCH Content)"); expert_add_info_format(pinfo, NULL, &ei_mac_unknown_content, "Unknown HSDSCH Content"); } + return tvb_captured_length(tvb); } static void mac_is_sdus_hash_destroy(gpointer data) @@ -1461,13 +1468,13 @@ proto_register_umts_mac(void) expert_umts_mac = expert_register_protocol(proto_umts_mac); expert_register_field_array(expert_umts_mac, ei, array_length(ei)); - register_dissector("mac.fdd.rach", dissect_mac_fdd_rach, proto_umts_mac); - register_dissector("mac.fdd.fach", dissect_mac_fdd_fach, proto_umts_mac); - register_dissector("mac.fdd.pch", dissect_mac_fdd_pch, proto_umts_mac); - register_dissector("mac.fdd.dch", dissect_mac_fdd_dch, proto_umts_mac); - register_dissector("mac.fdd.edch", dissect_mac_fdd_edch, proto_umts_mac); - register_dissector("mac.fdd.edch.type2", dissect_mac_fdd_edch_type2, proto_umts_mac); - register_dissector("mac.fdd.hsdsch", dissect_mac_fdd_hsdsch, proto_umts_mac); + new_register_dissector("mac.fdd.rach", dissect_mac_fdd_rach, proto_umts_mac); + new_register_dissector("mac.fdd.fach", dissect_mac_fdd_fach, proto_umts_mac); + new_register_dissector("mac.fdd.pch", dissect_mac_fdd_pch, proto_umts_mac); + new_register_dissector("mac.fdd.dch", dissect_mac_fdd_dch, proto_umts_mac); + new_register_dissector("mac.fdd.edch", dissect_mac_fdd_edch, proto_umts_mac); + new_register_dissector("mac.fdd.edch.type2", dissect_mac_fdd_edch_type2, proto_umts_mac); + new_register_dissector("mac.fdd.hsdsch", dissect_mac_fdd_hsdsch, proto_umts_mac); register_init_routine(mac_init); register_cleanup_routine(mac_cleanup); diff --git a/epan/dissectors/packet-user_encap.c b/epan/dissectors/packet-user_encap.c index 52ce26c068..3d008c678a 100644 --- a/epan/dissectors/packet-user_encap.c +++ b/epan/dissectors/packet-user_encap.c @@ -103,7 +103,7 @@ static void export_pdu(tvbuff_t *tvb, packet_info* pinfo, char *proto_name) } } -static void dissect_user(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) { +static int dissect_user(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U_) { user_encap_t* encap = NULL; tvbuff_t* payload_tvb; proto_item* item; @@ -135,7 +135,7 @@ static void dissect_user(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) { expert_add_info_format(pinfo, item, &ei_user_encap_not_handled, "%s", msg); call_dissector(data_handle, tvb, pinfo, tree); - return; + return tvb_captured_length(tvb); } if (encap->payload_proto == NULL) { char* msg = wmem_strdup_printf(wmem_packet_scope(), @@ -147,7 +147,7 @@ static void dissect_user(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) { expert_add_info_format(pinfo, item, &ei_user_encap_not_handled, "%s", msg); call_dissector(data_handle, tvb, pinfo, tree); - return; + return tvb_captured_length(tvb); } proto_item_set_text(item,"DLT: %d",pinfo->match_uint + 147 - WTAP_ENCAP_USER0); @@ -188,6 +188,7 @@ static void dissect_user(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) { } } } + return tvb_captured_length(tvb); } static void* user_copy_cb(void* dest, const void* orig, size_t len _U_) @@ -293,7 +294,7 @@ void proto_register_user_encap(void) encaps_uat); - register_dissector("user_dlt",dissect_user,proto_user_encap); + new_register_dissector("user_dlt",dissect_user,proto_user_encap); /* prefs_register_protocol_obsolete(proto_register_protocol("DLT User A","DLT_USER_A","user_dlt_a")); diff --git a/epan/dissectors/packet-v120.c b/epan/dissectors/packet-v120.c index dad4625fb3..9cf30f9dfb 100644 --- a/epan/dissectors/packet-v120.c +++ b/epan/dissectors/packet-v120.c @@ -103,8 +103,8 @@ static const xdlc_cf_items v120_cf_items_ext = { &hf_v120_ftype_s_u_ext }; -static void -dissect_v120(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_v120(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *v120_tree, *address_tree; proto_item *ti, *tc; @@ -129,7 +129,7 @@ dissect_v120(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tree) proto_tree_add_protocol_format(tree, proto_v120, tvb, 0, -1, "Invalid V.120 frame"); - return; + return 2; } if (pinfo->p2p_dir == P2P_DIR_SENT) { @@ -143,36 +143,32 @@ dissect_v120(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_RES_DL_SRC, "DCE"); } - if (tree) { - ti = proto_tree_add_protocol_format(tree, proto_v120, tvb, 0, -1, "V.120"); - v120_tree = proto_item_add_subtree(ti, ett_v120); - tc = proto_tree_add_item(v120_tree, hf_v120_address, tvb, 0, 2, ENC_BIG_ENDIAN); - proto_item_append_text(tc, "LLI: %d C/R: %s", - ((byte0 & 0xfc) << 5) | ((byte1 & 0xfe) >> 1), - byte0 & 0x02 ? "R" : "C"); - address_tree = proto_item_add_subtree(tc, ett_v120_address); - - proto_tree_add_item(address_tree, hf_v120_rc, tvb, 0, 2, ENC_BIG_ENDIAN); - proto_tree_add_item(address_tree, hf_v120_lli, tvb, 0, 2, ENC_BIG_ENDIAN); - proto_tree_add_item(address_tree, hf_v120_ea0, tvb, 0, 2, ENC_BIG_ENDIAN); - proto_tree_add_item(address_tree, hf_v120_ea1, tvb, 0, 2, ENC_BIG_ENDIAN); - } - else { - v120_tree = NULL; - ti = NULL; - } + ti = proto_tree_add_protocol_format(tree, proto_v120, tvb, 0, -1, "V.120"); + v120_tree = proto_item_add_subtree(ti, ett_v120); + tc = proto_tree_add_item(v120_tree, hf_v120_address, tvb, 0, 2, ENC_BIG_ENDIAN); + proto_item_append_text(tc, "LLI: %d C/R: %s", + ((byte0 & 0xfc) << 5) | ((byte1 & 0xfe) >> 1), + byte0 & 0x02 ? "R" : "C"); + address_tree = proto_item_add_subtree(tc, ett_v120_address); + + proto_tree_add_item(address_tree, hf_v120_rc, tvb, 0, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(address_tree, hf_v120_lli, tvb, 0, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(address_tree, hf_v120_ea0, tvb, 0, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(address_tree, hf_v120_ea1, tvb, 0, 2, ENC_BIG_ENDIAN); + control = dissect_xdlc_control(tvb, 2, pinfo, v120_tree, hf_v120_control, ett_v120_control, &v120_cf_items, &v120_cf_items_ext, NULL, NULL, is_response, TRUE, FALSE); - if (tree) { - v120len = 2 + XDLC_CONTROL_LEN(control, TRUE); - - if (tvb_bytes_exist(tvb, v120len, 1)) - v120len += dissect_v120_header(tvb, v120len, v120_tree); - proto_item_set_len(ti, v120len); - next_tvb = tvb_new_subset_remaining(tvb, v120len); - call_dissector(data_handle,next_tvb, pinfo, v120_tree); - } + + v120len = 2 + XDLC_CONTROL_LEN(control, TRUE); + + if (tvb_bytes_exist(tvb, v120len, 1)) + v120len += dissect_v120_header(tvb, v120len, v120_tree); + proto_item_set_len(ti, v120len); + next_tvb = tvb_new_subset_remaining(tvb, v120len); + call_dissector(data_handle,next_tvb, pinfo, v120_tree); + + return tvb_captured_length(tvb); } static int @@ -334,7 +330,7 @@ proto_register_v120(void) proto_register_field_array (proto_v120, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - register_dissector("v120", dissect_v120, proto_v120); + new_register_dissector("v120", dissect_v120, proto_v120); } void diff --git a/epan/dissectors/packet-zep.c b/epan/dissectors/packet-zep.c index 3422eb7876..6072760e9f 100644 --- a/epan/dissectors/packet-zep.c +++ b/epan/dissectors/packet-zep.c @@ -95,7 +95,7 @@ static dissector_handle_t ieee802154_ccfcs_handle; * void *--------------------------------------------------------------- */ -static void dissect_zep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_zep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { tvbuff_t *next_tvb; proto_item *proto_root, *pi; @@ -109,8 +109,7 @@ static void dissect_zep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Determine whether this is a Q51/IEEE 802.15.4 sniffer packet or not */ if(strcmp(tvb_get_string_enc(wmem_packet_scope(), tvb, 0, 2, ENC_ASCII), ZEP_PREAMBLE)){ /* This is not a Q51/ZigBee sniffer packet */ - call_dissector(data_handle, tvb, pinfo, tree); - return; + return 0; } memset(&zep_data, 0, sizeof(zep_data)); /* Zero all zep_data fields. */ @@ -161,8 +160,7 @@ static void dissect_zep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(ieee_packet_len < tvb_reported_length(tvb)-zep_header_len){ /* Packet's length is mis-reported, abort dissection */ - call_dissector(data_handle, tvb, pinfo, tree); - return; + return 0; } /* Enter name info protocol field */ @@ -215,7 +213,8 @@ static void dissect_zep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_uint(zep_tree, hf_zep_seqno, tvb, 17, 4, zep_data.seqno); } } - if (!((zep_data.version==2) && (zep_data.type==ZEP_V2_TYPE_ACK))) proto_tree_add_uint_format_value(zep_tree, hf_zep_ieee_length, tvb, zep_header_len - 1, 1, ieee_packet_len, "%i %s", ieee_packet_len, (ieee_packet_len==1)?"Byte":"Bytes"); + if (!((zep_data.version==2) && (zep_data.type==ZEP_V2_TYPE_ACK))) + proto_tree_add_uint_format_value(zep_tree, hf_zep_ieee_length, tvb, zep_header_len - 1, 1, ieee_packet_len, "%i %s", ieee_packet_len, (ieee_packet_len==1)?"Byte":"Bytes"); } /* Determine which dissector to call next. */ @@ -237,6 +236,7 @@ static void dissect_zep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) next_tvb = tvb_new_subset_length(tvb, zep_header_len, ieee_packet_len); call_dissector(next_dissector, next_tvb, pinfo, tree); } + return tvb_captured_length(tvb); } /* dissect_ieee802_15_4 */ /*FUNCTION:------------------------------------------------------ @@ -321,7 +321,7 @@ void proto_register_zep(void) 10, &gPREF_zep_udp_port); /* Register dissector with Wireshark. */ - zep_handle = register_dissector("zep", dissect_zep, proto_zep); + zep_handle = new_register_dissector("zep", dissect_zep, proto_zep); } /* proto_register_zep */ /*FUNCTION:------------------------------------------------------ |