diff --git a/epan/dissectors/packet-amr.c b/epan/dissectors/packet-amr.c index 19046523a0..1ff6b26ba5 100644 --- a/epan/dissectors/packet-amr.c +++ b/epan/dissectors/packet-amr.c @@ -222,8 +222,8 @@ static const true_false_string amr_sti_vals = { }; /* See 3GPP TS 26.101 chapter 4 for AMR-NB IF1 */ -static void -dissect_amr_nb_if1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { +static int +dissect_amr_nb_if1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int offset = 0; guint8 octet; proto_item *ti; @@ -238,7 +238,7 @@ dissect_amr_nb_if1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_tree_add_item(tree, hf_amr_speech_data, tvb, offset+2, 5, ENC_NA); proto_tree_add_item(tree, hf_amr_if1_sti, tvb, offset+7, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_amr_nb_if1_sti_mode_ind, tvb, offset+7, 1, ENC_BIG_ENDIAN); - return; + return offset+8; } proto_tree_add_item(tree, hf_amr_nb_if1_mode_ind, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -248,11 +248,12 @@ dissect_amr_nb_if1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { expert_add_info(pinfo, ti, &ei_amr_spare_bit_not0); offset += 1; proto_tree_add_item(tree, hf_amr_speech_data, tvb, offset, -1, ENC_NA); + return tvb_captured_length(tvb); } /* See 3GPP TS 26.201 for AMR-WB */ -static void -dissect_amr_wb_if1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { +static int +dissect_amr_wb_if1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int offset = 0; guint8 octet; proto_item *ti; @@ -267,7 +268,7 @@ dissect_amr_wb_if1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_tree_add_item(tree, hf_amr_speech_data, tvb, offset+2, 4, ENC_NA); proto_tree_add_item(tree, hf_amr_if1_sti, tvb, offset+7, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_amr_wb_if1_sti_mode_ind, tvb, offset+7, 1, ENC_BIG_ENDIAN); - return; + return offset+8; } offset += 1; @@ -275,10 +276,11 @@ dissect_amr_wb_if1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_tree_add_item(tree, hf_amr_wb_if1_mode_req, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; proto_tree_add_item(tree, hf_amr_speech_data, tvb, offset, -1, ENC_NA); + return tvb_captured_length(tvb); } -static void -dissect_amr_nb_if2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { +static int +dissect_amr_nb_if2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int offset = 0; guint8 octet; @@ -289,18 +291,19 @@ dissect_amr_nb_if2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_tree_add_item(tree, hf_amr_speech_data, tvb, offset+1, 3, ENC_NA); proto_tree_add_item(tree, hf_amr_if2_sti, tvb, offset+4, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_amr_nb_if2_sti_mode_ind, tvb, offset+5, 1, ENC_BIG_ENDIAN); - return; + return offset+6; } if (octet == AMR_NO_TRANS) - return; + return 1; proto_tree_add_item(tree, hf_amr_speech_data, tvb, offset+1, -1, ENC_NA); col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_ext(octet, &amr_nb_codec_mode_request_vals_ext, "Unknown (%d)" )); + return tvb_captured_length(tvb); } -static void -dissect_amr_wb_if2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { +static int +dissect_amr_wb_if2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int offset = 0; guint8 octet; @@ -311,14 +314,15 @@ dissect_amr_wb_if2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_tree_add_item(tree, hf_amr_speech_data, tvb, offset+1, 4, ENC_NA); proto_tree_add_item(tree, hf_amr_if2_sti, tvb, offset+5, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_amr_wb_if2_sti_mode_ind, tvb, offset+5, 1, ENC_BIG_ENDIAN); - return; + return offset+6; } if (octet == AMR_NO_TRANS) - return; + return 1; proto_tree_add_item(tree, hf_amr_speech_data, tvb, offset+1, -1, ENC_NA); col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_ext(octet, &amr_wb_codec_mode_request_vals_ext, "Unknown (%d)" )); + return tvb_captured_length(tvb); } static void @@ -459,15 +463,15 @@ dissect_amr_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint amr return; case 2: /* AMR IF1 */ if (amr_mode == AMR_NB) - dissect_amr_nb_if1(tvb, pinfo, amr_tree); + dissect_amr_nb_if1(tvb, pinfo, amr_tree, NULL); else - dissect_amr_wb_if1(tvb, pinfo, amr_tree); + dissect_amr_wb_if1(tvb, pinfo, amr_tree, NULL); return; case 3: /* AMR IF2 */ if (amr_mode == AMR_NB) - dissect_amr_nb_if2(tvb, pinfo, amr_tree); + dissect_amr_nb_if2(tvb, pinfo, amr_tree, NULL); else - dissect_amr_wb_if2(tvb, pinfo, amr_tree); + dissect_amr_wb_if2(tvb, pinfo, amr_tree, NULL); return; default: break; @@ -530,23 +534,25 @@ dissect_amr_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint amr } /* Code to actually dissect the packets */ -static void -dissect_amr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_amr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { /* Make entries in Protocol column and Info column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "AMR"); dissect_amr_common(tvb, pinfo, tree, pref_amr_mode); + return tvb_captured_length(tvb); } -static void -dissect_amr_wb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_amr_wb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { /* Make entries in Protocol column and Info column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "AMR-WB"); dissect_amr_common(tvb, pinfo, tree, AMR_WB); + return tvb_captured_length(tvb); } @@ -808,12 +814,12 @@ proto_register_amr(void) "The AMR mode", &pref_amr_mode, modes, AMR_NB); - amr_handle = register_dissector("amr", dissect_amr, proto_amr); - amr_wb_handle = register_dissector("amr-wb", dissect_amr_wb, proto_amr); - register_dissector("amr_if1_nb", dissect_amr_nb_if1, proto_amr); - register_dissector("amr_if1_wb", dissect_amr_wb_if1, proto_amr); - register_dissector("amr_if2_nb", dissect_amr_nb_if2, proto_amr); - register_dissector("amr_if2_wb", dissect_amr_wb_if2, proto_amr); + amr_handle = new_register_dissector("amr", dissect_amr, proto_amr); + amr_wb_handle = new_register_dissector("amr-wb", dissect_amr_wb, proto_amr); + new_register_dissector("amr_if1_nb", dissect_amr_nb_if1, proto_amr); + new_register_dissector("amr_if1_wb", dissect_amr_wb_if1, proto_amr); + new_register_dissector("amr_if2_nb", dissect_amr_nb_if2, proto_amr); + new_register_dissector("amr_if2_wb", dissect_amr_wb_if2, proto_amr); oid_add_from_string("G.722.2 (AMR-WB) audio capability","0.0.7.7222.1.0"); } diff --git a/epan/dissectors/packet-ansi_637.c b/epan/dissectors/packet-ansi_637.c index 67cae51704..9223af1c8b 100644 --- a/epan/dissectors/packet-ansi_637.c +++ b/epan/dissectors/packet-ansi_637.c @@ -2389,8 +2389,8 @@ dissect_ansi_637_tele_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ans } } -static void -dissect_ansi_637_tele(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ansi_637_tele(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ansi_637_item; proto_tree *ansi_637_tree = NULL; @@ -2495,6 +2495,7 @@ dissect_ansi_637_tele(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_ansi_637_tele_message(tvb, pinfo, ansi_637_tree, &has_private_data); } + return tvb_captured_length(tvb); } static gboolean @@ -2565,8 +2566,8 @@ dissect_ansi_637_trans_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree } -static void -dissect_ansi_637_trans(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ansi_637_trans(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ansi_637_item; proto_tree *ansi_637_tree = NULL; @@ -2642,16 +2643,17 @@ dissect_ansi_637_trans(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } } + return tvb_captured_length(tvb); } /* Dissect SMS embedded in SIP */ -static void -dissect_ansi_637_trans_app(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ansi_637_trans_app(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { col_set_str(pinfo->cinfo, COL_PROTOCOL, "/"); col_set_fence(pinfo->cinfo, COL_INFO); - dissect_ansi_637_trans(tvb, pinfo, tree); + return dissect_ansi_637_trans(tvb, pinfo, tree, data); } @@ -3330,8 +3332,8 @@ proto_register_ansi_637(void) proto_ansi_637_trans = proto_register_protocol(ansi_proto_name_trans, "ANSI IS-637-A Transport", "ansi_637_trans"); - ansi_637_tele_handle = register_dissector("ansi_637_tele", dissect_ansi_637_tele, proto_ansi_637_tele); - ansi_637_trans_handle = register_dissector("ansi_637_trans", dissect_ansi_637_trans, proto_ansi_637_trans); + ansi_637_tele_handle = new_register_dissector("ansi_637_tele", dissect_ansi_637_tele, proto_ansi_637_tele); + ansi_637_trans_handle = new_register_dissector("ansi_637_trans", dissect_ansi_637_trans, proto_ansi_637_trans); /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_ansi_637_tele, hf_tele, array_length(hf_tele)); @@ -3354,7 +3356,7 @@ proto_reg_handoff_ansi_637(void) dissector_handle_t ansi_637_trans_app_handle; guint i; - ansi_637_trans_app_handle = create_dissector_handle(dissect_ansi_637_trans_app, proto_ansi_637_trans); + ansi_637_trans_app_handle = new_create_dissector_handle(dissect_ansi_637_trans_app, proto_ansi_637_trans); /* Dissect messages embedded in SIP */ dissector_add_string("media_type", "application/vnd.3gpp2.sms", ansi_637_trans_app_handle); diff --git a/epan/dissectors/packet-ansi_801.c b/epan/dissectors/packet-ansi_801.c index c54e51696d..95ee92b9ad 100644 --- a/epan/dissectors/packet-ansi_801.c +++ b/epan/dissectors/packet-ansi_801.c @@ -1554,8 +1554,8 @@ dissect_ansi_801_rev_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree } } -static void -dissect_ansi_801(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ansi_801(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ansi_801_item; proto_tree *ansi_801_tree = NULL; @@ -1588,6 +1588,7 @@ dissect_ansi_801(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_ansi_801_rev_message(tvb, pinfo, ansi_801_tree); } } + return tvb_captured_length(tvb); } @@ -2308,7 +2309,7 @@ proto_register_ansi_801(void) expert_register_field_array(expert_ansi_801, ei, array_length(ei)); /* subdissector code */ - ansi_801_handle = register_dissector("ansi_801", dissect_ansi_801, proto_ansi_801); + ansi_801_handle = new_register_dissector("ansi_801", dissect_ansi_801, proto_ansi_801); } diff --git a/epan/dissectors/packet-app-pkix-cert.c b/epan/dissectors/packet-app-pkix-cert.c index 595ab0d3fa..04f149be3a 100644 --- a/epan/dissectors/packet-app-pkix-cert.c +++ b/epan/dissectors/packet-app-pkix-cert.c @@ -45,8 +45,8 @@ static gint hf_cert = -1; static gint ett_cert = -1; -static void -dissect_cert(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) +static int +dissect_cert(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) { proto_tree *subtree = NULL; proto_item *ti; @@ -61,7 +61,7 @@ dissect_cert(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) } dissect_x509af_Certificate(FALSE, tvb, 0, &asn1_ctx, subtree, hf_cert); - return; + return tvb_captured_length(tvb); } @@ -99,7 +99,7 @@ proto_register_cert(void) proto_register_field_array(proto_cert, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - register_dissector("application/pkix-cert", dissect_cert, proto_cert); + new_register_dissector("application/pkix-cert", dissect_cert, proto_cert); } @@ -108,7 +108,7 @@ proto_reg_handoff_cert(void) { dissector_handle_t cert_handle; - cert_handle = create_dissector_handle(dissect_cert, proto_cert); + cert_handle = new_create_dissector_handle(dissect_cert, proto_cert); /* Register the PKIX-CERT media type */ dissector_add_string("media_type", "application/pkix-cert", cert_handle); diff --git a/epan/dissectors/packet-at.c b/epan/dissectors/packet-at.c index a7b4b1f97e..ce8cb31588 100644 --- a/epan/dissectors/packet-at.c +++ b/epan/dissectors/packet-at.c @@ -33,9 +33,6 @@ void proto_reg_handoff_at_command(void); static int proto_at = -1; static int hf_at_command = -1; -/* Forward-declare the dissector functions */ -static void dissect_at(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); - /* Subtree handles: set by register_subtree_array */ static gint ett_at = -1; @@ -53,25 +50,8 @@ static gboolean allowed_chars(tvbuff_t *tvb) return (TRUE); } -/* Experimental approach based upon the one used for PPP */ -static gboolean heur_dissect_at(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) -{ - const gchar at_magic1[2] = {0x0d, 0x0a}; - const gchar at_magic2[3] = {0x0d, 0x0d, 0x0a}; - const gchar at_magic3[2] = {'A', 'T'}; - - if (((tvb_memeql(tvb, 0, at_magic1, sizeof(at_magic1)) == 0) || - (tvb_memeql(tvb, 0, at_magic2, sizeof(at_magic2)) == 0) || - (tvb_memeql(tvb, 0, at_magic3, sizeof(at_magic3)) == 0)) && - allowed_chars(tvb)) { - dissect_at(tvb, pinfo, tree); - return (TRUE); - } - return (FALSE); -} - /* The dissector itself */ -static void dissect_at(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_at(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *item; proto_tree *at_tree; @@ -91,6 +71,25 @@ static void dissect_at(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(at_tree, hf_at_command, tvb, 0, len, ENC_ASCII|ENC_NA); proto_item_append_text(item, ": %s", tvb_format_text_wsp(tvb, 0, len)); } + return tvb_captured_length(tvb); +} + + +/* Experimental approach based upon the one used for PPP */ +static gboolean heur_dissect_at(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) +{ + const gchar at_magic1[2] = {0x0d, 0x0a}; + const gchar at_magic2[3] = {0x0d, 0x0d, 0x0a}; + const gchar at_magic3[2] = {'A', 'T'}; + + if (((tvb_memeql(tvb, 0, at_magic1, sizeof(at_magic1)) == 0) || + (tvb_memeql(tvb, 0, at_magic2, sizeof(at_magic2)) == 0) || + (tvb_memeql(tvb, 0, at_magic3, sizeof(at_magic3)) == 0)) && + allowed_chars(tvb)) { + dissect_at(tvb, pinfo, tree, data); + return (TRUE); + } + return (FALSE); } void @@ -109,7 +108,7 @@ proto_register_at_command(void) proto_at = proto_register_protocol("AT Command", "AT", "at"); proto_register_field_array(proto_at, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - register_dissector("at", dissect_at, proto_at); + new_register_dissector("at", dissect_at, proto_at); } /* Handler registration */ diff --git a/epan/dissectors/packet-ax25-kiss.c b/epan/dissectors/packet-ax25-kiss.c index 1c93320ad1..97a0bf825e 100644 --- a/epan/dissectors/packet-ax25-kiss.c +++ b/epan/dissectors/packet-ax25-kiss.c @@ -210,8 +210,8 @@ capture_ax25_kiss( const guchar *pd, int offset, int len, packet_counts *ld) } /* Code to actually dissect the packets */ -static void -dissect_ax25_kiss( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree ) +static int +dissect_ax25_kiss( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_ ) { proto_item *ti; proto_tree *kiss_tree; @@ -354,6 +354,8 @@ dissect_ax25_kiss( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree ) next_tvb = tvb_new_subset_remaining( tvb, offset ); call_dissector( ax25_handle, next_tvb, pinfo, parent_tree ); } + + return tvb_captured_length(tvb); } void @@ -424,7 +426,7 @@ proto_register_ax25_kiss(void) proto_ax25_kiss = proto_register_protocol( "AX.25 KISS", "AX.25 KISS", "ax25_kiss" ); /* Register the dissector */ - kiss_handle = register_dissector( "ax25_kiss", dissect_ax25_kiss, proto_ax25_kiss ); + kiss_handle = new_register_dissector( "ax25_kiss", dissect_ax25_kiss, proto_ax25_kiss ); /* Required function calls to register the header fields and subtrees used */ proto_register_field_array( proto_ax25_kiss, hf, array_length( hf ) ); diff --git a/epan/dissectors/packet-ax25-nol3.c b/epan/dissectors/packet-ax25-nol3.c index 50dad15c19..21b6f8310e 100644 --- a/epan/dissectors/packet-ax25-nol3.c +++ b/epan/dissectors/packet-ax25-nol3.c @@ -78,8 +78,8 @@ static gint ett_dx = -1; /* Code to actually dissect the packets */ -static void -dissect_dx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_dx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) { proto_item *ti; proto_tree *dx_tree; @@ -104,6 +104,8 @@ dissect_dx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_tree_add_item( dx_tree, hf_dx_report, tvb, offset, data_len, ENC_ASCII|ENC_NA ); } + + return tvb_captured_length(tvb); } static gboolean @@ -208,7 +210,7 @@ dissect_ax25_nol3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree ) if ( tvb_get_guint8( tvb, offset ) == 'D' && tvb_get_guint8( tvb, offset + 1 ) == 'X' ) { dissected = TRUE; - dissect_dx( next_tvb, pinfo, ax25_nol3_tree ); + dissect_dx( next_tvb, pinfo, ax25_nol3_tree, NULL ); } } if ( ! dissected ) @@ -272,7 +274,7 @@ proto_register_ax25_nol3(void) proto_dx = proto_register_protocol("DX cluster", "DX", "dx"); /* Register the dissector */ - register_dissector( "dx", dissect_dx, proto_dx); + new_register_dissector( "dx", dissect_dx, proto_dx); /* Register the header fields */ proto_register_field_array( proto_dx, hf_dx, array_length( hf_dx ) ); diff --git a/epan/dissectors/packet-ax25.c b/epan/dissectors/packet-ax25.c index 5463b021b7..a06b238a53 100644 --- a/epan/dissectors/packet-ax25.c +++ b/epan/dissectors/packet-ax25.c @@ -125,8 +125,8 @@ static dissector_handle_t ax25_handle; static dissector_handle_t data_handle; -static void -dissect_ax25( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree ) +static int +dissect_ax25( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_ ) { proto_item *ti; proto_tree *ax25_tree; @@ -249,6 +249,8 @@ dissect_ax25( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree ) } else proto_item_set_end(ti, tvb, offset); + + return tvb_captured_length(tvb); } void @@ -418,7 +420,7 @@ proto_register_ax25(void) proto_ax25 = proto_register_protocol("Amateur Radio AX.25", "AX.25", "ax25"); /* Register the dissector */ - ax25_handle = register_dissector( "ax25", dissect_ax25, proto_ax25 ); + ax25_handle = new_register_dissector( "ax25", dissect_ax25, proto_ax25 ); /* Required function calls to register the header fields and subtrees used */ proto_register_field_array( proto_ax25, hf, array_length(hf ) ); diff --git a/epan/dissectors/packet-bacapp.c b/epan/dissectors/packet-bacapp.c index d4df51be31..a1b070e651 100644 --- a/epan/dissectors/packet-bacapp.c +++ b/epan/dissectors/packet-bacapp.c @@ -71,8 +71,6 @@ static int bacapp_tap = -1; * @param pinfo the packet info of the current data * @param tree the tree to append this item to **/ -static void -dissect_bacapp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); /** * ConfirmedRequest-PDU ::= SEQUENCE { @@ -10796,8 +10794,8 @@ do_the_dissection(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) return offset; } -static void -dissect_bacapp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_bacapp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint8 flag, bacapp_type; guint save_fragmented = FALSE, data_offset = 0, /*bacapp_apdu_size,*/ fragment = FALSE; @@ -11060,6 +11058,7 @@ dissect_bacapp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* tapping */ tap_queue_packet(bacapp_tap, pinfo, &bacinfo); + return tvb_captured_length(tvb); } static void @@ -11312,7 +11311,7 @@ proto_register_bacapp(void) proto_register_subtree_array(ett, array_length(ett)); expert_bacapp = expert_register_protocol(proto_bacapp); expert_register_field_array(expert_bacapp, ei, array_length(ei)); - register_dissector("bacapp", dissect_bacapp, proto_bacapp); + new_register_dissector("bacapp", dissect_bacapp, proto_bacapp); register_init_routine(&bacapp_init_routine); register_cleanup_routine(&bacapp_cleanup_routine); diff --git a/epan/dissectors/packet-bacnet.c b/epan/dissectors/packet-bacnet.c index 23dccbc07b..e0161e17a3 100644 --- a/epan/dissectors/packet-bacnet.c +++ b/epan/dissectors/packet-bacnet.c @@ -165,8 +165,8 @@ static int hf_bacnet_term_time_value = -1; static gint ett_bacnet = -1; static gint ett_bacnet_control = -1; -static void -dissect_bacnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_bacnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *bacnet_tree; @@ -440,6 +440,7 @@ dissect_bacnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* APDU - call the APDU dissector */ call_dissector(bacapp_handle, next_tvb, pinfo, tree); } + return tvb_captured_length(tvb); } void @@ -617,7 +618,7 @@ proto_register_bacnet(void) proto_register_field_array(proto_bacnet, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - register_dissector("bacnet", dissect_bacnet, proto_bacnet); + new_register_dissector("bacnet", dissect_bacnet, proto_bacnet); bacnet_dissector_table = register_dissector_table("bacnet.vendor", "BACnet Vendor Identifier", diff --git a/epan/dissectors/packet-bencode.c b/epan/dissectors/packet-bencode.c index bd615523a4..03dc0fdac2 100644 --- a/epan/dissectors/packet-bencode.c +++ b/epan/dissectors/packet-bencode.c @@ -281,9 +281,10 @@ static int dissect_bencoding_rec(tvbuff_t *tvb, packet_info *pinfo _U_, return -1; } -static void dissect_bencoding(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_bencoding(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { dissect_bencoding_rec(tvb, pinfo, 0, tvb_reported_length(tvb), tree, 0, NULL, 0); + return tvb_captured_length(tvb); } void @@ -332,7 +333,7 @@ proto_register_bencode(void) expert_module_t* expert_bencode; proto_bencode = proto_register_protocol("Bencode", "Bencode", "bencode"); - register_dissector("bencode", dissect_bencoding, proto_bencode); + new_register_dissector("bencode", dissect_bencoding, proto_bencode); proto_register_field_array(proto_bencode, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); expert_bencode = expert_register_protocol(proto_bencode); diff --git a/epan/dissectors/packet-bfd.c b/epan/dissectors/packet-bfd.c index bb9345be4f..e717a3a7cd 100644 --- a/epan/dissectors/packet-bfd.c +++ b/epan/dissectors/packet-bfd.c @@ -374,8 +374,8 @@ dissect_bfd_authentication(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } -static void -dissect_bfd_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_bfd_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint flags; guint bfd_version; @@ -572,7 +572,7 @@ dissect_bfd_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } - return; + return tvb_captured_length(tvb); } /* BFD CV Source MEP-ID TLV Decoder, @@ -905,7 +905,7 @@ proto_register_bfd(void) proto_bfd = proto_register_protocol("Bidirectional Forwarding Detection Control Message", "BFD Control", "bfd"); - register_dissector("bfd", dissect_bfd_control, proto_bfd); + new_register_dissector("bfd", dissect_bfd_control, proto_bfd); /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_bfd, hf, array_length(hf)); diff --git a/epan/dissectors/packet-bmc.c b/epan/dissectors/packet-bmc.c index f77fbb2329..2df44dd17f 100644 --- a/epan/dissectors/packet-bmc.c +++ b/epan/dissectors/packet-bmc.c @@ -148,7 +148,7 @@ dissect_bmc_cbs_message(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) offset += 1; cell_broadcast_tvb = tvb_new_subset_remaining(tvb, offset); - dissect_umts_cell_broadcast_message(cell_broadcast_tvb, pinfo, tree); + dissect_umts_cell_broadcast_message(cell_broadcast_tvb, pinfo, tree, NULL); offset = tvb_reported_length(cell_broadcast_tvb); return offset; diff --git a/epan/dissectors/packet-bpdu.c b/epan/dissectors/packet-bpdu.c index b465135382..9c69eb08df 100644 --- a/epan/dissectors/packet-bpdu.c +++ b/epan/dissectors/packet-bpdu.c @@ -250,18 +250,6 @@ static const char cont_sep[] = ", "; static void dissect_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_bpdu_pvst); -static void -dissect_bpdu_cisco(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) -{ - dissect_bpdu(tvb, pinfo, tree, TRUE); -} - -static void -dissect_bpdu_generic(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) -{ - dissect_bpdu(tvb, pinfo, tree, FALSE); -} - static void dissect_bpdu_pvst_tlv(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb) { gboolean pvst_tlv_origvlan_present = FALSE; @@ -1034,6 +1022,20 @@ dissect_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_bp } } +static int +dissect_bpdu_cisco(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) +{ + dissect_bpdu(tvb, pinfo, tree, TRUE); + return tvb_captured_length(tvb); +} + +static int +dissect_bpdu_generic(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) +{ + dissect_bpdu(tvb, pinfo, tree, FALSE); + return tvb_captured_length(tvb); +} + void proto_register_bpdu(void) { @@ -1355,8 +1357,8 @@ proto_register_bpdu(void) proto_register_field_array(proto_bpdu, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - register_dissector("bpdu", dissect_bpdu_generic, proto_bpdu); - register_dissector("bpdu_cisco", dissect_bpdu_cisco, proto_bpdu); + new_register_dissector("bpdu", dissect_bpdu_generic, proto_bpdu); + new_register_dissector("bpdu_cisco", dissect_bpdu_cisco, proto_bpdu); expert_bpdu = expert_register_protocol(proto_bpdu); expert_register_field_array(expert_bpdu, ei, array_length(ei)); diff --git a/epan/dissectors/packet-bpq.c b/epan/dissectors/packet-bpq.c index 4ce736dd03..bb79485552 100644 --- a/epan/dissectors/packet-bpq.c +++ b/epan/dissectors/packet-bpq.c @@ -55,8 +55,8 @@ static int hf_bpq_len = -1; static gint ett_bpq = -1; -static void -dissect_bpq( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree ) +static int +dissect_bpq( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_ ) { proto_item *ti; proto_tree *bpq_tree; @@ -98,6 +98,7 @@ dissect_bpq( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree ) /* XXX - use the length */ next_tvb = tvb_new_subset_remaining( tvb, offset ); call_dissector( ax25_handle, next_tvb, pinfo, parent_tree ); + return tvb_captured_length(tvb); } void @@ -137,7 +138,7 @@ proto_register_bpq(void) proto_bpq = proto_register_protocol( "Amateur Radio BPQ", "BPQ", "bpq" ); /* Register the dissector */ - register_dissector( "bpq", dissect_bpq, proto_bpq ); + new_register_dissector( "bpq", dissect_bpq, proto_bpq ); /* Required function calls to register the header fields and subtrees used */ proto_register_field_array( proto_bpq, hf, array_length( hf ) ); @@ -149,7 +150,7 @@ proto_reg_handoff_bpq(void) { dissector_handle_t bpq_handle; - bpq_handle = create_dissector_handle( dissect_bpq, proto_bpq ); + bpq_handle = new_create_dissector_handle( dissect_bpq, proto_bpq ); dissector_add_uint("ethertype", ETHERTYPE_BPQ, bpq_handle); /* BPQ is only implemented for AX.25 */ diff --git a/epan/dissectors/packet-catapult-dct2000.c b/epan/dissectors/packet-catapult-dct2000.c index 2aef3e698c..7745c5644e 100644 --- a/epan/dissectors/packet-catapult-dct2000.c +++ b/epan/dissectors/packet-catapult-dct2000.c @@ -2070,8 +2070,8 @@ static void check_for_oob_mac_lte_events(packet_info *pinfo, tvbuff_t *tvb, prot /*****************************************/ /* Main dissection function. */ /*****************************************/ -static void -dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *dct2000_tree = NULL; proto_item *ti = NULL; @@ -2403,7 +2403,7 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) (strcmp(protocol_name, "rlc_r9") == 0)) { dissect_rlc_umts(tvb, offset, pinfo, tree, direction); - return; + return tvb_captured_length(tvb); } else @@ -2426,7 +2426,7 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) (strcmp(protocol_name, "pdcp_r10_lte") == 0)) { /* Dissect proprietary header, then pass remainder to PDCP */ dissect_pdcp_lte(tvb, offset, pinfo, tree); - return; + return tvb_captured_length(tvb); } @@ -2441,7 +2441,7 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) else if (strcmp(protocol_name, "tty") == 0) { dissect_tty_lines(tvb, pinfo, dct2000_tree, offset); - return; + return tvb_captured_length(tvb); } else @@ -2474,7 +2474,7 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) "%s", string); } - return; + return tvb_captured_length(tvb); } else @@ -2487,7 +2487,7 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset, -1, ENC_ASCII|ENC_NA); col_append_fstr(pinfo->cinfo, COL_INFO, "%s", string); - return; + return tvb_captured_length(tvb); } @@ -2502,7 +2502,7 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Dissect proprietary header, then pass remainder to RRC (depending upon direction and channel type) */ dissect_rrc_lte(tvb, offset, pinfo, tree); - return; + return tvb_captured_length(tvb); } else @@ -2511,7 +2511,7 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Dissect proprietary header, then pass remainder to lapb */ dissect_ccpri_lte(tvb, offset, pinfo, tree); - return; + return tvb_captured_length(tvb); } /* Many DCT2000 protocols have at least one IPPrim variant. If the @@ -2794,7 +2794,7 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) this dissector and the wiretap module catapult_dct2000.c !! */ DISSECTOR_ASSERT_NOT_REACHED(); - return; + return 0; } /* Set selection length of dct2000 tree */ @@ -2835,6 +2835,8 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) PROTO_ITEM_SET_GENERATED(ti_local); } } + + return tvb_captured_length(tvb); } @@ -3293,7 +3295,7 @@ void proto_register_catapult_dct2000(void) expert_register_field_array(expert_catapult_dct2000, ei, array_length(ei)); /* Allow dissector to find be found by name. */ - register_dissector("dct2000", dissect_catapult_dct2000, proto_catapult_dct2000); + new_register_dissector("dct2000", dissect_catapult_dct2000, proto_catapult_dct2000); /* Preferences */ catapult_dct2000_module = prefs_register_protocol(proto_catapult_dct2000, NULL); diff --git a/epan/dissectors/packet-cbor.c b/epan/dissectors/packet-cbor.c index 80b674ca76..a8d95ecbec 100644 --- a/epan/dissectors/packet-cbor.c +++ b/epan/dissectors/packet-cbor.c @@ -696,8 +696,8 @@ dissect_cbor_main_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *cbor_tree, return NULL; } -static void -dissect_cbor(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_cbor(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) { gint offset = 0; proto_item *cbor_root; @@ -706,6 +706,8 @@ dissect_cbor(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) cbor_root = proto_tree_add_item(parent_tree, proto_cbor, tvb, offset, -1, ENC_NA); cbor_tree = proto_item_add_subtree(cbor_root, ett_cbor); dissect_cbor_main_type(tvb, pinfo, cbor_tree, &offset); + + return tvb_captured_length(tvb); } void @@ -851,7 +853,7 @@ proto_register_cbor(void) expert_cbor = expert_register_protocol(proto_cbor); expert_register_field_array(expert_cbor, ei, array_length(ei)); - register_dissector("cbor", dissect_cbor, proto_cbor); + new_register_dissector("cbor", dissect_cbor, proto_cbor); } void @@ -859,7 +861,7 @@ proto_reg_handoff_cbor(void) { static dissector_handle_t cbor_handle; - cbor_handle = create_dissector_handle(dissect_cbor, proto_cbor); + cbor_handle = new_create_dissector_handle(dissect_cbor, proto_cbor); dissector_add_string("media_type", "application/cbor", cbor_handle); /* RFC 7049 */ } diff --git a/epan/dissectors/packet-cell_broadcast.c b/epan/dissectors/packet-cell_broadcast.c index 068c88b070..0bcfeb967d 100644 --- a/epan/dissectors/packet-cell_broadcast.c +++ b/epan/dissectors/packet-cell_broadcast.c @@ -293,8 +293,8 @@ tvbuff_t * dissect_cbs_data(guint8 sms_encoding, tvbuff_t *tvb, proto_tree *tree return tvb_out; } -static void -dissect_gsm_cell_broadcast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_gsm_cell_broadcast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint8 sms_encoding, total_pages, current_page; guint32 offset = 0; @@ -382,9 +382,11 @@ dissect_gsm_cell_broadcast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_string(cbs_msg_tree, hf_gsm_cbs_message_content, cbs_msg_tvb, 0, len, tvb_get_string_enc(wmem_packet_scope(), cbs_msg_tvb, 0, len, ENC_ASCII)); } + + return tvb_captured_length(tvb); } -void dissect_umts_cell_broadcast_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +int dissect_umts_cell_broadcast_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint8 sms_encoding; guint32 offset = 0; @@ -412,6 +414,7 @@ void dissect_umts_cell_broadcast_message(tvbuff_t *tvb, packet_info *pinfo, prot ett_cbs_msg, NULL, "Cell Broadcast Message Contents (length: %d)", msg_len); msg = tvb_get_string_enc(wmem_packet_scope(), cbs_msg_tvb, 0, msg_len, ENC_ASCII); proto_tree_add_string_format(cbs_subtree, hf_gsm_cbs_message_content, cbs_msg_tvb, 0, -1, msg, "%s", msg); + return tvb_captured_length(tvb); } /* Register the protocol with Wireshark */ @@ -574,8 +577,8 @@ proto_register_cbs(void) register_cleanup_routine(gsm_cbs_message_reassembly_cleanup); /* subdissector code */ - register_dissector("gsm_cbs", dissect_gsm_cell_broadcast, proto_cell_broadcast); - register_dissector("umts_cell_broadcast", dissect_umts_cell_broadcast_message, proto_cell_broadcast); + new_register_dissector("gsm_cbs", dissect_gsm_cell_broadcast, proto_cell_broadcast); + new_register_dissector("umts_cell_broadcast", dissect_umts_cell_broadcast_message, proto_cell_broadcast); /* subtree array */ proto_register_subtree_array(ett, array_length(ett)); diff --git a/epan/dissectors/packet-cell_broadcast.h b/epan/dissectors/packet-cell_broadcast.h index f03487628e..20a333fe77 100644 --- a/epan/dissectors/packet-cell_broadcast.h +++ b/epan/dissectors/packet-cell_broadcast.h @@ -56,7 +56,7 @@ guint dissect_cbs_serial_number(tvbuff_t *tvb, proto_tree *tree, guint offset); * @param pinfo the packet info of the current data * @param tree the tree to append this item to */ -void dissect_umts_cell_broadcast_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +int dissect_umts_cell_broadcast_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data); /** * Dissects CB Data diff --git a/epan/dissectors/packet-cfdp.c b/epan/dissectors/packet-cfdp.c index 1df89820d4..f9180d31b4 100644 --- a/epan/dissectors/packet-cfdp.c +++ b/epan/dissectors/packet-cfdp.c @@ -1107,8 +1107,8 @@ static guint32 dissect_cfdp_keep_alive_pdu(tvbuff_t *tvb, proto_tree *tree, guin } /* Code to actually dissect the packets */ -static void -dissect_cfdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_cfdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int offset = 0; proto_item *cfdp_packet; @@ -1270,6 +1270,7 @@ dissect_cfdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } /* Give the data dissector any bytes past the CFDP packet length */ call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo, tree); + return tvb_captured_length(tvb); } void @@ -1624,7 +1625,7 @@ proto_register_cfdp(void) expert_cfdp = expert_register_protocol(proto_cfdp); expert_register_field_array(expert_cfdp, ei, array_length(ei)); - register_dissector ( "cfdp", dissect_cfdp, proto_cfdp ); + new_register_dissector ( "cfdp", dissect_cfdp, proto_cfdp ); } void @@ -1632,7 +1633,7 @@ proto_reg_handoff_cfdp(void) { static dissector_handle_t cfdp_handle; - cfdp_handle = create_dissector_handle(dissect_cfdp, proto_cfdp); + cfdp_handle = new_create_dissector_handle(dissect_cfdp, proto_cfdp); dissector_add_uint("ccsds.apid", CFDP_APID, cfdp_handle); dissector_add_for_decode_as ( "udp.port", cfdp_handle ); data_handle = find_dissector("data"); diff --git a/epan/dissectors/packet-cfm.c b/epan/dissectors/packet-cfm.c index a9cf7a99c3..b1d9e6bfaf 100644 --- a/epan/dissectors/packet-cfm.c +++ b/epan/dissectors/packet-cfm.c @@ -1208,7 +1208,7 @@ static int dissect_cfm_slr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr /* Main CFM EOAM protocol dissector */ -static void dissect_cfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_cfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { gint offset = 0; guint8 cfm_pdu_type; @@ -1550,6 +1550,7 @@ static void dissect_cfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } } + return tvb_captured_length(tvb); } /* Register CFM EOAM protocol */ @@ -2148,7 +2149,7 @@ void proto_register_cfm(void) "cfm" /* abbrev */ ); - cfm_handle = register_dissector("cfm", dissect_cfm, proto_cfm); + cfm_handle = new_register_dissector("cfm", dissect_cfm, proto_cfm); proto_register_field_array(proto_cfm, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); diff --git a/epan/dissectors/packet-chdlc.c b/epan/dissectors/packet-chdlc.c index 1a6740b242..06e0c7872e 100644 --- a/epan/dissectors/packet-chdlc.c +++ b/epan/dissectors/packet-chdlc.c @@ -160,8 +160,8 @@ chdlctype(guint16 chdlc_type, tvbuff_t *tvb, int offset_after_chdlctype, static gint chdlc_fcs_decode = 0; /* 0 = No FCS, 1 = 16 bit FCS, 2 = 32 bit FCS */ -static void -dissect_chdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_chdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *fh_tree = NULL; @@ -201,6 +201,7 @@ dissect_chdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) decode_fcs(tvb, fh_tree, chdlc_fcs_decode, 2); chdlctype(proto, tvb, 4, pinfo, tree, fh_tree, hf_chdlc_proto); + return tvb_captured_length(tvb); } void @@ -236,7 +237,7 @@ proto_register_chdlc(void) "Cisco HDLC protocol", FT_UINT16, BASE_HEX, DISSECTOR_TABLE_NOT_ALLOW_DUPLICATE); - register_dissector("chdlc", dissect_chdlc, proto_chdlc); + new_register_dissector("chdlc", dissect_chdlc, proto_chdlc); /* Register the preferences for the chdlc protocol */ chdlc_module = prefs_register_protocol(proto_chdlc, NULL); diff --git a/epan/dissectors/packet-cimetrics.c b/epan/dissectors/packet-cimetrics.c index 80bb216f47..640585e671 100644 --- a/epan/dissectors/packet-cimetrics.c +++ b/epan/dissectors/packet-cimetrics.c @@ -48,8 +48,8 @@ static int hf_cimetrics_mstp_timer = -1; static int hf_cimetrics_mstp_value = -1; -static void -dissect_cimetrics_mstp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_cimetrics_mstp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *subtree; @@ -79,6 +79,7 @@ dissect_cimetrics_mstp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(subtree, hf_cimetrics_mstp_value, tvb, offset++, 1, ENC_LITTLE_ENDIAN); dissect_mstp(tvb, pinfo, tree, subtree, offset); + return tvb_captured_length(tvb); } void @@ -113,7 +114,7 @@ proto_register_cimetrics(void) proto_register_field_array(proto_cimetrics_mstp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - register_dissector("cimetrics", dissect_cimetrics_mstp, + new_register_dissector("cimetrics", dissect_cimetrics_mstp, proto_cimetrics_mstp); llc_add_oui(OUI_CIMETRICS, "llc.cimetrics_pid", diff --git a/epan/dissectors/packet-cipmotion.c b/epan/dissectors/packet-cipmotion.c index 476b11c76f..311a44be60 100644 --- a/epan/dissectors/packet-cipmotion.c +++ b/epan/dissectors/packet-cipmotion.c @@ -1776,8 +1776,8 @@ dissect_var_devce_conn_header(tvbuff_t* tvb, proto_tree* tree, guint32* inst_cou * * Returns: void */ -static void -dissect_cipmotion(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) +static int +dissect_cipmotion(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U_) { guint32 con_format; /* guint32 seq_number; */ @@ -1878,6 +1878,8 @@ dissect_cipmotion(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) } /* End of instance for( ) loop */ } } + + return tvb_captured_length(tvb); } /* @@ -2919,7 +2921,7 @@ proto_register_cipmotion(void) /* Register the subtrees for the protocol dissection */ proto_register_subtree_array(cip_subtree, array_length(cip_subtree)); - register_dissector( "cipmotion", dissect_cipmotion, proto_cipmotion); + new_register_dissector( "cipmotion", dissect_cipmotion, proto_cipmotion); } void proto_reg_handoff_cipmotion(void) @@ -2927,7 +2929,7 @@ void proto_reg_handoff_cipmotion(void) dissector_handle_t cipmotion_handle; /* Create and register dissector for I/O data handling */ - cipmotion_handle = create_dissector_handle( dissect_cipmotion, proto_cipmotion ); + cipmotion_handle = new_create_dissector_handle( dissect_cipmotion, proto_cipmotion ); dissector_add_for_decode_as("enip.io", cipmotion_handle ); } diff --git a/epan/dissectors/packet-cipsafety.c b/epan/dissectors/packet-cipsafety.c index a3580279fb..ab52066f83 100644 --- a/epan/dissectors/packet-cipsafety.c +++ b/epan/dissectors/packet-cipsafety.c @@ -1603,8 +1603,8 @@ dissect_cip_safety_data( proto_tree *tree, proto_item *item, tvbuff_t *tvb, int } } -static void -dissect_cipsafety(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_cipsafety(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *safety_tree; @@ -1614,6 +1614,7 @@ dissect_cipsafety(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) safety_tree = proto_item_add_subtree( ti, ett_cip_safety); dissect_cip_safety_data(safety_tree, ti, tvb, tvb_reported_length(tvb), pinfo ); + return tvb_captured_length(tvb); } static int dissect_sercosiii_link_error_count_p1p2(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb, @@ -2581,7 +2582,7 @@ proto_register_cipsafety(void) expert_cip_safety = expert_register_protocol(proto_cipsafety); expert_register_field_array(expert_cip_safety, ei, array_length(ei)); - register_dissector( "cipsafety", dissect_cipsafety, proto_cipsafety); + new_register_dissector( "cipsafety", dissect_cipsafety, proto_cipsafety); /* Register CIP Safety objects */ proto_cip_class_s_supervisor = proto_register_protocol("CIP Safety Supervisor", @@ -2622,7 +2623,7 @@ proto_reg_handoff_cipsafety(void) heur_dissector_add("cip.sc", dissect_class_svalidator_heur, "CIP Safety Validator", "s_validator_cip", proto_cip_class_s_validator, HEURISTIC_ENABLE); /* Create and register dissector for I/O data handling */ - cipsafety_handle = create_dissector_handle( dissect_cipsafety, proto_cipsafety ); + cipsafety_handle = new_create_dissector_handle( dissect_cipsafety, proto_cipsafety ); dissector_add_for_decode_as("enip.io", cipsafety_handle ); proto_cip = proto_get_id_by_filter_name( "cip" ); diff --git a/epan/dissectors/packet-cisco-sm.c b/epan/dissectors/packet-cisco-sm.c index 14cf1d3cf9..3e8e881e21 100644 --- a/epan/dissectors/packet-cisco-sm.c +++ b/epan/dissectors/packet-cisco-sm.c @@ -264,8 +264,8 @@ static dissector_handle_t q931_handle; static dissector_handle_t data_handle; /* Code to actually dissect the packets */ -static void -dissect_sm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_sm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *sm_tree; @@ -299,9 +299,6 @@ dissect_sm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) switch(protocol){ /* start case RUDP BSM v.1 ---------------------------------------------------------- */ case SM_PROTOCOL_X004: - if (!tree) - return; - proto_tree_add_item(sm_tree, hf_sm_msg_id, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset +2; msg_type = tvb_get_ntohs(tvb,offset); @@ -334,8 +331,6 @@ dissect_sm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case SM_PROTOCOL_X100: case SM_PROTOCOL_X122: - if (!tree) - return; /* Protocol 0x100/0x122 only contains a length and then an EISUP packet */ proto_tree_add_item(sm_tree, hf_sm_len, tvb, offset, 2, ENC_BIG_ENDIAN); length = tvb_get_ntohs(tvb,offset); @@ -349,8 +344,6 @@ dissect_sm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; case SM_PROTOCOL_X101: - if (!tree) - return; /* XXX Reverse enginered so this may not be correct!!! * EISUP - used between Cisco HSI and Cisco PGW devices, * uses RUDP with default port number 8003. @@ -387,8 +380,6 @@ dissect_sm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /*return;*/ break; case SM_PROTOCOL_X114: - if (!tree) - return; /* XXX Reverse enginered so this may not be correct!!! */ proto_tree_add_item(sm_tree, hf_sm_len, tvb, offset, 2, ENC_BIG_ENDIAN); length = tvb_get_ntohs(tvb,offset); @@ -483,6 +474,8 @@ dissect_sm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } } + + return tvb_captured_length(tvb); } void @@ -602,7 +595,7 @@ proto_register_sm(void) proto_sm = proto_register_protocol("Cisco Session Management", "SM", "sm"); - register_dissector("sm", dissect_sm, proto_sm); + new_register_dissector("sm", dissect_sm, proto_sm); /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_sm, hf, array_length(hf)); diff --git a/epan/dissectors/packet-dmx-chan.c b/epan/dissectors/packet-dmx-chan.c index dab05239c9..3fc8b0f94d 100644 --- a/epan/dissectors/packet-dmx-chan.c +++ b/epan/dissectors/packet-dmx-chan.c @@ -55,8 +55,8 @@ static gint global_disp_chan_val_type = 0; static gint global_disp_col_count = 16; static gint global_disp_chan_nr_type = 0; -static void -dissect_dmx_chan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_dmx_chan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { col_set_str(pinfo->cinfo, COL_PROTOCOL, "DMX Channels"); col_clear(pinfo->cinfo, COL_INFO); @@ -114,6 +114,7 @@ dissect_dmx_chan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset, length, ENC_NA ); PROTO_ITEM_SET_HIDDEN(item); } + return tvb_captured_length(tvb); } void @@ -164,7 +165,7 @@ proto_register_dmx_chan(void) proto_dmx_chan = proto_register_protocol("DMX Channels","DMX Channels", "dmx-chan"); proto_register_field_array(proto_dmx_chan, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - register_dissector("dmx-chan", dissect_dmx_chan, proto_dmx_chan); + new_register_dissector("dmx-chan", dissect_dmx_chan, proto_dmx_chan); dmx_chan_module = prefs_register_protocol(proto_dmx_chan, NULL); diff --git a/epan/dissectors/packet-dmx-sip.c b/epan/dissectors/packet-dmx-sip.c index 4171a53061..0c06bd432c 100644 --- a/epan/dissectors/packet-dmx-sip.c +++ b/epan/dissectors/packet-dmx-sip.c @@ -76,8 +76,8 @@ dmx_sip_checksum(tvbuff_t *tvb, guint length) return sum; } -static void -dissect_dmx_sip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_dmx_sip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { col_set_str(pinfo->cinfo, COL_PROTOCOL, "DMX SIP"); col_clear(pinfo->cinfo, COL_INFO); @@ -191,6 +191,7 @@ dissect_dmx_sip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_trailer, tvb, offset, -1, ENC_NA); } + return tvb_captured_length(tvb); } void @@ -300,7 +301,7 @@ proto_register_dmx_sip(void) proto_dmx_sip = proto_register_protocol("DMX SIP", "DMX SIP", "dmx-sip"); proto_register_field_array(proto_dmx_sip, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - register_dissector("dmx-sip", dissect_dmx_sip, proto_dmx_sip); + new_register_dissector("dmx-sip", dissect_dmx_sip, proto_dmx_sip); } /* diff --git a/epan/dissectors/packet-dmx-test.c b/epan/dissectors/packet-dmx-test.c index cd50bf1a74..5791a44954 100644 --- a/epan/dissectors/packet-dmx-test.c +++ b/epan/dissectors/packet-dmx-test.c @@ -51,8 +51,8 @@ static int hf_dmx_test_data_bad = -1; static int ett_dmx_test = -1; -static void -dissect_dmx_test(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_dmx_test(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { col_set_str(pinfo->cinfo, COL_PROTOCOL, "DMX Test Frame"); col_clear(pinfo->cinfo, COL_INFO); @@ -109,6 +109,7 @@ dissect_dmx_test(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) PROTO_ITEM_SET_GENERATED(item); } } + return tvb_captured_length(tvb); } void @@ -138,7 +139,7 @@ proto_register_dmx_test(void) proto_dmx_test = proto_register_protocol("DMX Test Frame", "DMX Test Frame", "dmx-test"); proto_register_field_array(proto_dmx_test, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - register_dissector("dmx-test", dissect_dmx_test, proto_dmx_test); + new_register_dissector("dmx-test", dissect_dmx_test, proto_dmx_test); } /* diff --git a/epan/dissectors/packet-dmx-text.c b/epan/dissectors/packet-dmx-text.c index f3c7fa543e..0035bedde7 100644 --- a/epan/dissectors/packet-dmx-text.c +++ b/epan/dissectors/packet-dmx-text.c @@ -48,8 +48,8 @@ static int hf_dmx_text_string = -1; static int ett_dmx_text = -1; -static void -dissect_dmx_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_dmx_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { col_set_str(pinfo->cinfo, COL_PROTOCOL, "DMX Text"); col_clear(pinfo->cinfo, COL_INFO); @@ -75,6 +75,7 @@ dissect_dmx_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(dmx_text_tree, hf_dmx_text_string, tvb, offset, size, ENC_ASCII|ENC_NA); } + return tvb_captured_length(tvb); } void @@ -105,7 +106,7 @@ proto_register_dmx_text(void) proto_dmx_text = proto_register_protocol("DMX Text Frame", "DMX Text Frame", "dmx-text"); proto_register_field_array(proto_dmx_text, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - register_dissector("dmx-text", dissect_dmx_text, proto_dmx_text); + new_register_dissector("dmx-text", dissect_dmx_text, proto_dmx_text); } /* diff --git a/epan/dissectors/packet-dmx.c b/epan/dissectors/packet-dmx.c index 94a7f81e3b..d73eda1376 100644 --- a/epan/dissectors/packet-dmx.c +++ b/epan/dissectors/packet-dmx.c @@ -69,8 +69,8 @@ static dissector_handle_t dmx_sip_handle; static dissector_handle_t data_handle; -static void -dissect_dmx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_dmx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { tvbuff_t *next_tvb; guint offset = 0; @@ -107,6 +107,7 @@ dissect_dmx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) call_dissector(data_handle, next_tvb, pinfo, tree); break; } + return tvb_captured_length(tvb); } void @@ -121,7 +122,7 @@ proto_register_dmx(void) proto_dmx = proto_register_protocol("DMX", "DMX", "dmx"); proto_register_field_array(proto_dmx, hf, array_length(hf)); - register_dissector("dmx", dissect_dmx, proto_dmx); + new_register_dissector("dmx", dissect_dmx, proto_dmx); } void diff --git a/epan/dissectors/packet-dpnss-link.c b/epan/dissectors/packet-dpnss-link.c index caa20d4682..3bf708f8ad 100644 --- a/epan/dissectors/packet-dpnss-link.c +++ b/epan/dissectors/packet-dpnss-link.c @@ -93,8 +93,8 @@ static const value_string dpnss_link_frameType_vals[] = { static int ett_dpnss_link = -1; /* Code to actually dissect the packets */ -static void -dissect_dpnss_link(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_dpnss_link(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *item; proto_tree *dpnss_link_tree; @@ -149,6 +149,7 @@ dissect_dpnss_link(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) default: break; } + return tvb_captured_length(tvb); } @@ -205,7 +206,7 @@ proto_register_dpnss_link(void) /* Register the protocol name and description */ proto_dpnss_link = proto_register_protocol("Digital Private Signalling System No 1 Link Layer", "DPNSS Link", "dpnss_link"); - register_dissector("dpnss_link", dissect_dpnss_link, proto_dpnss_link); + new_register_dissector("dpnss_link", dissect_dpnss_link, proto_dpnss_link); /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_dpnss_link, hf, array_length(hf)); diff --git a/epan/dissectors/packet-dpnss.c b/epan/dissectors/packet-dpnss.c index 0a504d01ab..f28bfc9d19 100644 --- a/epan/dissectors/packet-dpnss.c +++ b/epan/dissectors/packet-dpnss.c @@ -1453,8 +1453,8 @@ dissect_dpnss_cc_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) return offset; } /* Code to actually dissect the packets */ -static void -dissect_dpnss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_dpnss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int offset = 0; proto_item *item, *group_item; @@ -1485,6 +1485,7 @@ dissect_dpnss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) expert_add_info(pinfo, group_item, &ei_dpnss_msg_grp_id); break; } + return tvb_captured_length(tvb); } void @@ -1645,7 +1646,7 @@ proto_register_dpnss(void) /* Register the protocol name and description */ proto_dpnss = proto_register_protocol("Digital Private Signalling System No 1","DPNSS", "dpnss"); - register_dissector("dpnss", dissect_dpnss, proto_dpnss); + new_register_dissector("dpnss", dissect_dpnss, proto_dpnss); /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_dpnss, hf, array_length(hf)); diff --git a/epan/dissectors/packet-dua.c b/epan/dissectors/packet-dua.c index a117eab0ed..ba9a2df8ec 100644 --- a/epan/dissectors/packet-dua.c +++ b/epan/dissectors/packet-dua.c @@ -714,8 +714,8 @@ dissect_dua_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, dissect_parameters(parameters_tvb, pinfo, tree, dua_tree); } -static void -dissect_dua(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_dua(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *dua_item; proto_tree *dua_tree; @@ -723,17 +723,13 @@ dissect_dua(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree) /* make entry in the Protocol column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "DUA"); - /* In the interest of speed, if "tree" is NULL, don't do any work not - necessary to generate protocol tree items. */ - if (tree) { - /* create the m3ua protocol tree */ - dua_item = proto_tree_add_item(tree, proto_dua, message_tvb, 0, -1, ENC_NA); - dua_tree = proto_item_add_subtree(dua_item, ett_dua); - } else { - dua_tree = NULL; - }; + /* create the m3ua protocol tree */ + dua_item = proto_tree_add_item(tree, proto_dua, message_tvb, 0, -1, ENC_NA); + dua_tree = proto_item_add_subtree(dua_item, ett_dua); + /* dissect the message */ dissect_dua_message(message_tvb, pinfo, tree, dua_tree); + return tvb_captured_length(message_tvb); } /* Register the protocol with Wireshark */ @@ -908,7 +904,7 @@ proto_register_dua(void) proto_register_subtree_array(ett, array_length(ett)); /* Allow other dissectors to find this one by name. */ - register_dissector("dua", dissect_dua, proto_dua); + new_register_dissector("dua", dissect_dua, proto_dua); } void diff --git a/epan/dissectors/packet-dvb-ipdc.c b/epan/dissectors/packet-dvb-ipdc.c index aa5064930f..be8a417e91 100644 --- a/epan/dissectors/packet-dvb-ipdc.c +++ b/epan/dissectors/packet-dvb-ipdc.c @@ -48,8 +48,8 @@ static dissector_handle_t sub_handles[DVB_IPDC_SUB_MAX]; /* Code to actually dissect the packets */ -static void -dissect_ipdc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ipdc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { tvbuff_t *next_tvb; proto_tree *esg_tree = NULL; @@ -68,6 +68,7 @@ dissect_ipdc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) next_tvb = tvb_new_subset_remaining(tvb, 0); call_dissector(sub_handles[DVB_IPDC_SUB_FLUTE], next_tvb, pinfo, esg_tree); + return tvb_captured_length(tvb); } void @@ -92,7 +93,7 @@ proto_register_dvb_ipdc(void) #endif proto_register_subtree_array(ett, array_length(ett)); - register_dissector("dvb_ipdc", dissect_ipdc, proto_ipdc); + new_register_dissector("dvb_ipdc", dissect_ipdc, proto_ipdc); } void @@ -102,7 +103,7 @@ proto_reg_handoff_dvb_ipdc(void) sub_handles[DVB_IPDC_SUB_FLUTE] = find_dissector("alc"); - ipdc_handle = create_dissector_handle(dissect_ipdc, proto_ipdc); + ipdc_handle = new_create_dissector_handle(dissect_ipdc, proto_ipdc); dissector_add_uint("udp.port", UDP_PORT_IPDC_ESG_BOOTSTRAP, ipdc_handle); } diff --git a/epan/dissectors/packet-eapol.c b/epan/dissectors/packet-eapol.c index d845ba80bd..20825281d5 100644 --- a/epan/dissectors/packet-eapol.c +++ b/epan/dissectors/packet-eapol.c @@ -101,8 +101,8 @@ static const true_false_string keytype_tfs = { "Unicast", "Broadcast" }; #define KEYDES_KEY_INDEX_TYPE_MASK 0x80 #define KEYDES_KEY_INDEX_NUMBER_MASK 0x7F -static void -dissect_eapol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_eapol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int offset = 0; guint8 eapol_type; @@ -166,6 +166,7 @@ dissect_eapol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) call_dissector(data_handle, next_tvb, pinfo, eapol_tree); break; } + return tvb_captured_length(tvb); } static int @@ -300,7 +301,7 @@ proto_register_eapol(void) }; proto_eapol = proto_register_protocol("802.1X Authentication", "EAPOL", "eapol"); - eapol_handle = register_dissector("eapol", dissect_eapol, proto_eapol); + eapol_handle = new_register_dissector("eapol", dissect_eapol, proto_eapol); proto_register_field_array(proto_eapol, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); diff --git a/epan/dissectors/packet-ecp-oui.c b/epan/dissectors/packet-ecp-oui.c index 14fd8ae8a5..a544b0324a 100644 --- a/epan/dissectors/packet-ecp-oui.c +++ b/epan/dissectors/packet-ecp-oui.c @@ -302,8 +302,8 @@ dissect_vdp_end_of_vdpdu_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * return -1; /* Force the VDP dissector to terminate */ } -static void -dissect_ecp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ecp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *ecp_tree; proto_item *ti; @@ -348,7 +348,7 @@ dissect_ecp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tempLen < 0) end = TRUE; } - + return tvb_captured_length(tvb); } void proto_register_ecp_oui(void) @@ -438,7 +438,7 @@ void proto_register_ecp_oui(void) proto_register_field_array(proto_ecp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - register_dissector("ecp", dissect_ecp, proto_ecp); + new_register_dissector("ecp", dissect_ecp, proto_ecp); } void proto_reg_handoff_ecp(void) diff --git a/epan/dissectors/packet-ehdlc.c b/epan/dissectors/packet-ehdlc.c index e16d2fa840..8b342f793e 100644 --- a/epan/dissectors/packet-ehdlc.c +++ b/epan/dissectors/packet-ehdlc.c @@ -108,8 +108,8 @@ enum { static dissector_handle_t sub_handles[SUB_MAX]; /* Code to actually dissect the packets */ -static void -dissect_ehdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ehdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int offset = 4; @@ -200,6 +200,7 @@ dissect_ehdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) len = 1; offset += len; } + return tvb_captured_length(tvb); } void @@ -312,7 +313,7 @@ proto_register_ehdlc(void) proto_register_field_array(proto_ehdlc, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - register_dissector("ehdlc", dissect_ehdlc, proto_ehdlc); + new_register_dissector("ehdlc", dissect_ehdlc, proto_ehdlc); } void @@ -324,7 +325,7 @@ proto_reg_handoff_ehdlc(void) sub_handles[SUB_OML] = find_dissector("gsm_abis_oml"); sub_handles[SUB_DATA] = find_dissector("data"); - ehdlc_handle = create_dissector_handle( dissect_ehdlc, proto_ehdlc ); + ehdlc_handle = new_create_dissector_handle( dissect_ehdlc, proto_ehdlc ); dissector_add_uint("l2tp.pw_type", L2TPv3_PROTOCOL_ERICSSON, ehdlc_handle); } diff --git a/epan/dissectors/packet-erf.c b/epan/dissectors/packet-erf.c index 8fd25b1d30..ba817ccf13 100644 --- a/epan/dissectors/packet-erf.c +++ b/epan/dissectors/packet-erf.c @@ -1186,8 +1186,8 @@ guint64* erf_get_ehdr(packet_info *pinfo, guint8 hdrtype, gint* afterindex) { return NULL; } -static void -dissect_erf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_erf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint8 flags; guint8 erf_type; @@ -1463,6 +1463,7 @@ dissect_erf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) default: break; } /* erf type */ + return tvb_captured_length(tvb); } void @@ -1896,7 +1897,7 @@ proto_register_erf(void) expert_module_t* expert_erf; proto_erf = proto_register_protocol("Extensible Record Format", "ERF", "erf"); - erf_handle = register_dissector("erf", dissect_erf, proto_erf); + erf_handle = new_register_dissector("erf", dissect_erf, proto_erf); proto_register_field_array(proto_erf, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); diff --git a/epan/dissectors/packet-eth.c b/epan/dissectors/packet-eth.c index 04e689fe8a..b5d45e95ef 100644 --- a/epan/dissectors/packet-eth.c +++ b/epan/dissectors/packet-eth.c @@ -799,8 +799,8 @@ add_ethernet_trailer(packet_info *pinfo, proto_tree *tree, proto_tree *fh_tree, /* Called for the Ethernet Wiretap encapsulation type; pass the FCS length reported to us, or, if the "assume_fcs" preference is set, pass 4. */ -static void -dissect_eth_maybefcs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_eth_maybefcs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *fh_tree; @@ -827,21 +827,24 @@ dissect_eth_maybefcs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } else { dissect_eth_common(tvb, pinfo, tree, eth_assume_fcs ? 4 : pinfo->pseudo_header->eth.fcs_len); } + return tvb_captured_length(tvb); } /* Called by other dissectors This one's for encapsulated Ethernet packets that don't include an FCS. */ -static void -dissect_eth_withoutfcs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_eth_withoutfcs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { dissect_eth_common(tvb, pinfo, tree, 0); + return tvb_captured_length(tvb); } /* ...and this one's for encapsulated packets that do. */ -static void -dissect_eth_withfcs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_eth_withfcs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { dissect_eth_common(tvb, pinfo, tree, 4); + return tvb_captured_length(tvb); } void @@ -1007,9 +1010,9 @@ proto_register_eth(void) "Set the condition that must be true for the CCSDS dissector to be called", &ccsds_heuristic_bit); - register_dissector("eth_withoutfcs", dissect_eth_withoutfcs, proto_eth); - register_dissector("eth_withfcs", dissect_eth_withfcs, proto_eth); - register_dissector("eth", dissect_eth_maybefcs, proto_eth); + new_register_dissector("eth_withoutfcs", dissect_eth_withoutfcs, proto_eth); + new_register_dissector("eth_withfcs", dissect_eth_withfcs, proto_eth); + new_register_dissector("eth", dissect_eth_maybefcs, proto_eth); eth_tap = register_tap("eth"); register_conversation_table(proto_eth, TRUE, eth_conversation_packet, eth_hostlist_packet); diff --git a/epan/dissectors/packet-etherip.c b/epan/dissectors/packet-etherip.c index 9ce80cb809..50f6601ad1 100644 --- a/epan/dissectors/packet-etherip.c +++ b/epan/dissectors/packet-etherip.c @@ -54,8 +54,8 @@ static dissector_handle_t eth_withoutfcs_handle; #define ETHERIP_RESERVE_MASK 0x0FFF -static void -dissect_etherip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_etherip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { tvbuff_t *next_tvb; proto_tree *etherip_tree; @@ -92,6 +92,7 @@ dissect_etherip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) next_tvb = tvb_new_subset_remaining(tvb, 2); call_dissector(eth_withoutfcs_handle, next_tvb, pinfo, tree); + return tvb_captured_length(tvb); } void @@ -124,7 +125,7 @@ proto_register_etherip(void) expert_etherip = expert_register_protocol(proto_etherip); expert_register_field_array(expert_etherip, ei, array_length(ei)); - register_dissector("etherip", dissect_etherip, proto_etherip); + new_register_dissector("etherip", dissect_etherip, proto_etherip); } void diff --git a/epan/dissectors/packet-exported_pdu.c b/epan/dissectors/packet-exported_pdu.c index fac79199ee..0ad9c4c11c 100644 --- a/epan/dissectors/packet-exported_pdu.c +++ b/epan/dissectors/packet-exported_pdu.c @@ -88,8 +88,8 @@ static const value_string exported_pdu_tag_vals[] = { }; /* Code to actually dissect the packets */ -static void -dissect_exported_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_exported_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *exported_pdu_tree, *tag_tree; @@ -223,6 +223,7 @@ dissect_exported_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } proto_tree_add_item(exported_pdu_tree, hf_exported_pdu_exported_pdu, payload_tvb, 0, -1, ENC_NA); + return tvb_captured_length(tvb); } /* Register the protocol with Wireshark. @@ -338,7 +339,7 @@ proto_register_exported_pdu(void) proto_exported_pdu = proto_register_protocol("EXPORTED_PDU", "exported_pdu", "exported_pdu"); - register_dissector("exported_pdu", dissect_exported_pdu, proto_exported_pdu); + new_register_dissector("exported_pdu", dissect_exported_pdu, proto_exported_pdu); /* Required function calls to register the header fields and subtrees */ proto_register_field_array(proto_exported_pdu, hf, array_length(hf)); diff --git a/epan/dissectors/packet-fc.c b/epan/dissectors/packet-fc.c index 7897ae5cd7..4c0a5d9256 100644 --- a/epan/dissectors/packet-fc.c +++ b/epan/dissectors/packet-fc.c @@ -1271,8 +1271,8 @@ dissect_fc_ifcp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data return tvb_captured_length(tvb); } -static void -dissect_fcsof(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { +static int +dissect_fcsof(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *it = NULL; proto_tree *fcsof_tree = NULL; @@ -1353,6 +1353,7 @@ dissect_fcsof(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { /* Call FC dissector */ call_dissector_with_data(fc_handle, next_tvb, pinfo, tree, &fc_data); + return tvb_captured_length(tvb); } /* Register the protocol with Wireshark */ @@ -1605,7 +1606,7 @@ proto_register_fc(void) proto_register_field_array(proto_fcsof, sof_hf, array_length(sof_hf)); proto_register_subtree_array(sof_ett, array_length(sof_ett)); - fcsof_handle = register_dissector("fcsof", dissect_fcsof, proto_fcsof); + fcsof_handle = new_register_dissector("fcsof", dissect_fcsof, proto_fcsof); register_conversation_table(proto_fc, TRUE, fc_conversation_packet, fc_hostlist_packet); register_srt_table(proto_fc, NULL, 1, fcstat_packet, fcstat_init, NULL); diff --git a/epan/dissectors/packet-fcsp.c b/epan/dissectors/packet-fcsp.c index 1939afff09..dd6e7facec 100644 --- a/epan/dissectors/packet-fcsp.c +++ b/epan/dissectors/packet-fcsp.c @@ -373,7 +373,7 @@ static void dissect_fcsp_auth_rjt(tvbuff_t *tvb, proto_tree *tree) } } -static void dissect_fcsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_fcsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti = NULL; guint8 opcode; @@ -429,6 +429,7 @@ static void dissect_fcsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; } } + return tvb_captured_length(tvb); } void @@ -606,7 +607,7 @@ proto_register_fcsp(void) /* Register the protocol name and description */ proto_fcsp = proto_register_protocol("Fibre Channel Security Protocol", "FC-SP", "fcsp"); - register_dissector("fcsp", dissect_fcsp, proto_fcsp); + new_register_dissector("fcsp", dissect_fcsp, proto_fcsp); proto_register_field_array(proto_fcsp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); diff --git a/epan/dissectors/packet-fddi.c b/epan/dissectors/packet-fddi.c index abda0ff52e..df740c0312 100644 --- a/epan/dissectors/packet-fddi.c +++ b/epan/dissectors/packet-fddi.c @@ -443,16 +443,18 @@ dissect_fddi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } /* dissect_fddi */ -static void -dissect_fddi_bitswapped(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_fddi_bitswapped(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { dissect_fddi(tvb, pinfo, tree, TRUE); + return tvb_captured_length(tvb); } -static void -dissect_fddi_not_bitswapped(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_fddi_not_bitswapped(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { dissect_fddi(tvb, pinfo, tree, FALSE); + return tvb_captured_length(tvb); } void @@ -509,7 +511,7 @@ proto_register_fddi(void) * Called from various dissectors for encapsulated FDDI frames. * We assume the MAC addresses in them aren't bitswapped. */ - register_dissector("fddi", dissect_fddi_not_bitswapped, proto_fddi); + new_register_dissector("fddi", dissect_fddi_not_bitswapped, proto_fddi); fddi_module = prefs_register_protocol(proto_fddi, NULL); prefs_register_bool_preference(fddi_module, "padding", @@ -538,7 +540,7 @@ proto_reg_handoff_fddi(void) dissector_add_uint("sflow_245.header_protocol", SFLOW_245_HEADER_FDDI, fddi_handle); fddi_bitswapped_handle = - create_dissector_handle(dissect_fddi_bitswapped, proto_fddi); + new_create_dissector_handle(dissect_fddi_bitswapped, proto_fddi); dissector_add_uint("wtap_encap", WTAP_ENCAP_FDDI_BITSWAPPED, fddi_bitswapped_handle); } diff --git a/epan/dissectors/packet-fp_hint.c b/epan/dissectors/packet-fp_hint.c index e83f9f9ab5..d8c757e66f 100644 --- a/epan/dissectors/packet-fp_hint.c +++ b/epan/dissectors/packet-fp_hint.c @@ -486,13 +486,13 @@ static void attach_info(tvbuff_t *tvb, packet_info *pinfo, guint16 offset, guint } } -static void dissect_fp_hint(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int dissect_fp_hint(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint8 frame_type, channel_type; guint16 hdrlen; guint32 atm_hdr, aal2_ext; tvbuff_t *next_tvb; - dissector_handle_t *next_dissector; + dissector_handle_t next_dissector; proto_item *ti; proto_tree *fph_tree = NULL; @@ -523,17 +523,18 @@ static void dissect_fp_hint(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) pinfo->pseudo_header->atm.vci = ((atm_hdr & 0x000ffff0) >> 4); pinfo->pseudo_header->atm.aal2_cid = aal2_ext & 0x000000ff; pinfo->pseudo_header->atm.type = TRAF_UMTS_FP; - next_dissector = &atm_untrunc_handle; + next_dissector = atm_untrunc_handle; break; case FPH_FRAME_ETHERNET: - next_dissector = ðwithfcs_handle; + next_dissector = ethwithfcs_handle; break; default: - next_dissector = &data_handle; + next_dissector = data_handle; } next_tvb = tvb_new_subset_remaining(tvb, hdrlen); - call_dissector(*next_dissector, next_tvb, pinfo, tree); + call_dissector(next_dissector, next_tvb, pinfo, tree); + return tvb_captured_length(tvb); } void @@ -582,7 +583,7 @@ proto_register_fp_hint(void) expert_module_t* expert_fp_hint; proto_fp_hint = proto_register_protocol("FP Hint", "FP Hint", "fp_hint"); - register_dissector("fp_hint", dissect_fp_hint, proto_fp_hint); + new_register_dissector("fp_hint", dissect_fp_hint, proto_fp_hint); proto_register_field_array(proto_fp_hint, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); diff --git a/epan/dissectors/packet-fr.c b/epan/dissectors/packet-fr.c index f9029093d2..fa27e2ece4 100644 --- a/epan/dissectors/packet-fr.c +++ b/epan/dissectors/packet-fr.c @@ -617,27 +617,29 @@ dissect_fr_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } } -static void -dissect_fr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_fr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { dissect_fr_common(tvb, pinfo, tree, FALSE, TRUE ); + return tvb_captured_length(tvb); } -static void -dissect_fr_phdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_fr_phdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { dissect_fr_common(tvb, pinfo, tree, TRUE, TRUE ); + return tvb_captured_length(tvb); } -static void -dissect_fr_stripped_address(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_fr_stripped_address(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { dissect_fr_common(tvb, pinfo, tree, TRUE, FALSE ); + return tvb_captured_length(tvb); } -static void -dissect_fr_uncompressed(tvbuff_t *tvb, packet_info *pinfo, - proto_tree *tree) +static int +dissect_fr_uncompressed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *fr_tree; @@ -649,6 +651,7 @@ dissect_fr_uncompressed(tvbuff_t *tvb, packet_info *pinfo, fr_tree = proto_item_add_subtree(ti, ett_fr); dissect_fr_nlpid(tvb, 0, pinfo, tree, ti, fr_tree, XDLC_U); + return tvb_captured_length(tvb); } static void @@ -982,9 +985,9 @@ proto_register_fr(void) fr_osinl_subdissector_table = register_dissector_table("fr.osinl", "Frame Relay OSI NLPID", FT_UINT8, BASE_HEX, DISSECTOR_TABLE_NOT_ALLOW_DUPLICATE); - register_dissector("fr_uncompressed", dissect_fr_uncompressed, proto_fr); - register_dissector("fr", dissect_fr, proto_fr); - register_dissector("fr_stripped_address", dissect_fr_stripped_address, proto_fr); + new_register_dissector("fr_uncompressed", dissect_fr_uncompressed, proto_fr); + new_register_dissector("fr", dissect_fr, proto_fr); + new_register_dissector("fr_stripped_address", dissect_fr_stripped_address, proto_fr); frencap_module = prefs_register_protocol(proto_fr, NULL); /* @@ -1013,7 +1016,7 @@ proto_reg_handoff_fr(void) dissector_add_uint("atm.aal5.type", TRAF_FR, fr_handle); dissector_add_uint("l2tp.pw_type", L2TPv3_PROTOCOL_FR, fr_handle); - fr_phdr_handle = create_dissector_handle(dissect_fr_phdr, proto_fr); + fr_phdr_handle = new_create_dissector_handle(dissect_fr_phdr, proto_fr); dissector_add_uint("wtap_encap", WTAP_ENCAP_FRELAY_WITH_PHDR, fr_phdr_handle); eth_withfcs_handle = find_dissector("eth_withfcs"); diff --git a/epan/dissectors/packet-fw1.c b/epan/dissectors/packet-fw1.c index d6280cf5c0..e2611bb100 100644 --- a/epan/dissectors/packet-fw1.c +++ b/epan/dissectors/packet-fw1.c @@ -121,8 +121,8 @@ fw1_init(void) interface_anzahl = 0; } -static void -dissect_fw1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_fw1(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; @@ -219,6 +219,7 @@ dissect_fw1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ethertype_data.fcs_len = 0; call_dissector_with_data(ethertype_handle, tvb, pinfo, tree, ðertype_data); + return tvb_captured_length(tvb); } void @@ -279,7 +280,7 @@ proto_register_fw1(void) "Whether the interface list includes the chain position", &fw1_iflist_with_chain); - register_dissector("fw1", dissect_fw1, proto_fw1); + new_register_dissector("fw1", dissect_fw1, proto_fw1); for (i=0; i