diff options
author | Michael Mann <mmann78@netscape.net> | 2015-11-08 19:30:18 -0500 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2015-11-09 15:59:59 +0000 |
commit | 2fe0fc5a1afbbd8218190736decbecec14582691 (patch) | |
tree | a5d7860915c351039bbb16979f0a05532533a276 /epan/dissectors | |
parent | 0aa9e9864721d5f425ffeba85bbb642ebd12e771 (diff) |
Convert some TCP subdissectors to "new" style.
Change-Id: I28ce51f3c06f78b85792bce4a13ef39eb75d7890
Reviewed-on: https://code.wireshark.org/review/11648
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-bfcp.c | 127 | ||||
-rw-r--r-- | epan/dissectors/packet-bzr.c | 10 | ||||
-rw-r--r-- | epan/dissectors/packet-coap.c | 10 | ||||
-rw-r--r-- | epan/dissectors/packet-db-lsp.c | 9 | ||||
-rw-r--r-- | epan/dissectors/packet-ftp.c | 16 | ||||
-rw-r--r-- | epan/dissectors/packet-imap.c | 8 | ||||
-rw-r--r-- | epan/dissectors/packet-knet.c | 15 | ||||
-rw-r--r-- | epan/dissectors/packet-kt.c | 10 | ||||
-rw-r--r-- | epan/dissectors/packet-reload.c | 12 | ||||
-rw-r--r-- | epan/dissectors/packet-smtp.c | 10 | ||||
-rw-r--r-- | epan/dissectors/packet-synergy.c | 10 | ||||
-rw-r--r-- | epan/dissectors/packet-syslog.c | 8 |
12 files changed, 135 insertions, 110 deletions
diff --git a/epan/dissectors/packet-bfcp.c b/epan/dissectors/packet-bfcp.c index 0747af43e0..8022e0d778 100644 --- a/epan/dissectors/packet-bfcp.c +++ b/epan/dissectors/packet-bfcp.c @@ -386,15 +386,54 @@ dissect_bfcp_attributes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int return offset; } + +static gboolean +dissect_bfcp_heur_check(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) +{ + guint8 primitive; + guint8 first_byte; + const gchar *str; + + + /* Size of smallest BFCP packet: 12 octets */ + if (tvb_captured_length(tvb) < 12) + return FALSE; + + /* Check version and reserved bits in first byte */ + first_byte = tvb_get_guint8(tvb, 0); + + /* If first_byte of bfcp_packet is a combination of the + * version and the I bit. The value must be either 0x20 or 0x30 + * if the bit is set, otherwise it is not BFCP. + */ + if ((first_byte != 0x20) && (first_byte != 0x30)) + return FALSE; + + primitive = tvb_get_guint8(tvb, 1); + + if ((primitive < 1) || (primitive > 18)) + return FALSE; + + str = try_val_to_str(primitive, map_bfcp_primitive); + if (NULL == str) + return FALSE; + + return TRUE; +} + /* Code to actually dissect BFCP packets */ -static void -dissect_bfcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_bfcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int offset = 0; guint8 primitive; const gchar *str; gint bfcp_payload_length; - proto_tree *bfcp_tree = NULL; + proto_tree *bfcp_tree; + proto_item *ti; + + if (!dissect_bfcp_heur_check(tvb, pinfo, tree, data)) + return 0; primitive = tvb_get_guint8(tvb, 1); str = try_val_to_str(primitive, map_bfcp_primitive); @@ -403,11 +442,8 @@ dissect_bfcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "BFCP"); col_add_str(pinfo->cinfo, COL_INFO, str); - if (tree) { - proto_item *ti; - - ti = proto_tree_add_item(tree, proto_bfcp, tvb, 0, -1, ENC_NA); - bfcp_tree = proto_item_add_subtree(ti, ett_bfcp); + ti = proto_tree_add_item(tree, proto_bfcp, tvb, 0, -1, ENC_NA); + bfcp_tree = proto_item_add_subtree(ti, ett_bfcp); /* The following is the format of the common header. @@ -425,62 +461,37 @@ dissect_bfcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) */ - /* Add items to BFCP tree */ - proto_tree_add_item(bfcp_tree, hf_bfcp_version, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(bfcp_tree, hf_bfcp_hdr_r_bit, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(bfcp_tree, hf_bfcp_hdr_f_bit, tvb, offset, 1, ENC_BIG_ENDIAN); - offset++; - proto_tree_add_item(bfcp_tree, hf_bfcp_primitive, tvb, offset, 1, ENC_BIG_ENDIAN); - offset++; - proto_tree_add_item(bfcp_tree, hf_bfcp_payload_length, tvb, offset, 2, ENC_BIG_ENDIAN); - offset+=2; - proto_tree_add_item(bfcp_tree, hf_bfcp_conference_id, tvb, offset, 4, ENC_BIG_ENDIAN); - offset+=4; - proto_tree_add_item(bfcp_tree, hf_bfcp_transaction_id, tvb, offset, 2, ENC_BIG_ENDIAN); - offset+=2; - proto_tree_add_item(bfcp_tree, hf_bfcp_user_id, tvb, offset, 2, ENC_BIG_ENDIAN); - offset+=2; - - bfcp_payload_length = tvb_get_ntohs(tvb, - BFCP_OFFSET_PAYLOAD_LENGTH) * 4; - - /*offset = */dissect_bfcp_attributes(tvb, pinfo, bfcp_tree, offset, bfcp_payload_length); - - } /* if(tree) */ + /* Add items to BFCP tree */ + proto_tree_add_item(bfcp_tree, hf_bfcp_version, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(bfcp_tree, hf_bfcp_hdr_r_bit, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(bfcp_tree, hf_bfcp_hdr_f_bit, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + proto_tree_add_item(bfcp_tree, hf_bfcp_primitive, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + proto_tree_add_item(bfcp_tree, hf_bfcp_payload_length, tvb, offset, 2, ENC_BIG_ENDIAN); + offset+=2; + proto_tree_add_item(bfcp_tree, hf_bfcp_conference_id, tvb, offset, 4, ENC_BIG_ENDIAN); + offset+=4; + proto_tree_add_item(bfcp_tree, hf_bfcp_transaction_id, tvb, offset, 2, ENC_BIG_ENDIAN); + offset+=2; + proto_tree_add_item(bfcp_tree, hf_bfcp_user_id, tvb, offset, 2, ENC_BIG_ENDIAN); + offset+=2; + + bfcp_payload_length = tvb_get_ntohs(tvb, + BFCP_OFFSET_PAYLOAD_LENGTH) * 4; + + /*offset = */dissect_bfcp_attributes(tvb, pinfo, bfcp_tree, offset, bfcp_payload_length); + + return tvb_captured_length(tvb); } static gboolean dissect_bfcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { - guint8 primitive; - guint8 first_byte; - const gchar *str; - - - /* Size of smallest BFCP packet: 12 octets */ - if (tvb_captured_length(tvb) < 12) - return FALSE; - - /* Check version and reserved bits in first byte */ - first_byte = tvb_get_guint8(tvb, 0); - - /* If first_byte of bfcp_packet is a combination of the - * version and the I bit. The value must be either 0x20 or 0x30 - * if the bit is set, otherwise it is not BFCP. - */ - if ((first_byte != 0x20) && (first_byte != 0x30)) - return FALSE; - - primitive = tvb_get_guint8(tvb, 1); - - if ((primitive < 1) || (primitive > 18)) - return FALSE; - - str = try_val_to_str(primitive, map_bfcp_primitive); - if (NULL == str) + if (!dissect_bfcp_heur_check(tvb, pinfo, tree, data)) return FALSE; - dissect_bfcp(tvb, pinfo, tree); + dissect_bfcp(tvb, pinfo, tree, data); return TRUE; } @@ -679,7 +690,7 @@ void proto_register_bfcp(void) proto_bfcp = proto_register_protocol("Binary Floor Control Protocol", "BFCP", "bfcp"); - bfcp_handle = register_dissector("bfcp", dissect_bfcp, proto_bfcp); + bfcp_handle = new_register_dissector("bfcp", dissect_bfcp, proto_bfcp); bfcp_module = prefs_register_protocol(proto_bfcp, proto_reg_handoff_bfcp); diff --git a/epan/dissectors/packet-bzr.c b/epan/dissectors/packet-bzr.c index b53c327dbb..88798c61f5 100644 --- a/epan/dissectors/packet-bzr.c +++ b/epan/dissectors/packet-bzr.c @@ -224,8 +224,8 @@ dissect_bzr_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /*offset +=*/ dissect_body(tvb, offset, pinfo, bzr_tree); } -static void -dissect_bzr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_bzr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { gint offset = 0, pdu_len; tvbuff_t *next_tvb; @@ -240,7 +240,7 @@ dissect_bzr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (pinfo->can_desegment && bzr_desegment) { pinfo->desegment_offset = offset; pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT; - return; + return tvb_captured_length(tvb); } else { pdu_len = tvb_reported_length_remaining(tvb, offset); } @@ -249,6 +249,8 @@ dissect_bzr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect_bzr_pdu(next_tvb, pinfo, tree); offset += pdu_len; } + + return tvb_captured_length(tvb); } void @@ -300,7 +302,7 @@ proto_register_bzr(void) module_t *bzr_module; proto_bzr = proto_register_protocol("Bazaar Smart Protocol", "Bazaar", "bzr"); - register_dissector("bzr", dissect_bzr, proto_bzr); + new_register_dissector("bzr", dissect_bzr, proto_bzr); proto_register_field_array(proto_bzr, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); diff --git a/epan/dissectors/packet-coap.c b/epan/dissectors/packet-coap.c index 1ade51a991..5521749913 100644 --- a/epan/dissectors/packet-coap.c +++ b/epan/dissectors/packet-coap.c @@ -784,8 +784,8 @@ dissect_coap_options(tvbuff_t *tvb, packet_info *pinfo, proto_tree *coap_tree, g return offset; } -static void -dissect_coap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_coap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) { gint offset = 0; proto_item *coap_root; @@ -862,7 +862,7 @@ dissect_coap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) /* process options */ offset = dissect_coap_options(tvb, pinfo, coap_tree, offset, coap_length); if (offset == -1) - return; + return tvb_captured_length(tvb); /* add informations to the packet list */ if (coap_token_str != NULL) @@ -919,6 +919,8 @@ dissect_coap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) dissector_try_string(media_type_dissector_table, coap_ctype_str_dis, payload_tvb, pinfo, payload_tree, NULL); } + + return tvb_captured_length(tvb); } /* @@ -1124,7 +1126,7 @@ proto_register_coap(void) expert_coap = expert_register_protocol(proto_coap); expert_register_field_array(expert_coap, ei, array_length(ei)); - register_dissector("coap", dissect_coap, proto_coap); + new_register_dissector("coap", dissect_coap, proto_coap); /* Register our configuration options */ coap_module = prefs_register_protocol (proto_coap, proto_reg_handoff_coap); diff --git a/epan/dissectors/packet-db-lsp.c b/epan/dissectors/packet-db-lsp.c index a9168a2a8d..ae058301c3 100644 --- a/epan/dissectors/packet-db-lsp.c +++ b/epan/dissectors/packet-db-lsp.c @@ -161,8 +161,8 @@ dissect_db_lsp_tcp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d return tvb_reported_length(tvb); } -static void -dissect_db_lsp_disc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_db_lsp_disc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *db_lsp_tree; proto_item *db_lsp_item; @@ -180,12 +180,13 @@ dissect_db_lsp_disc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (try_heuristic) { data_subtree = proto_item_add_subtree(db_lsp_item, ett_db_lsp); if (dissector_try_heuristic(heur_subdissector_list, tvb, pinfo, data_subtree, &hdtbl_entry, NULL)) { - return; + return tvb_captured_length(tvb); } } /* heuristic failed. Print remaining bytes as text */ proto_tree_add_item (db_lsp_tree, hf_text, tvb, offset, -1, ENC_ASCII|ENC_NA); + return tvb_captured_length(tvb); } void @@ -237,7 +238,7 @@ proto_register_db_lsp (void) proto_db_lsp = proto_register_protocol (PNAME, PSNAME, PFNAME); proto_db_lsp_disc = proto_register_protocol (PNAME_DISC, PSNAME_DISC, PFNAME_DISC); new_register_dissector ("db-lsp.tcp", dissect_db_lsp_tcp, proto_db_lsp); - register_dissector ("db-lsp.udp", dissect_db_lsp_disc, proto_db_lsp_disc); + new_register_dissector ("db-lsp.udp", dissect_db_lsp_disc, proto_db_lsp_disc); heur_subdissector_list = register_heur_dissector_list("db-lsp"); diff --git a/epan/dissectors/packet-ftp.c b/epan/dissectors/packet-ftp.c index f2fe62ce6a..03292aa672 100644 --- a/epan/dissectors/packet-ftp.c +++ b/epan/dissectors/packet-ftp.c @@ -511,8 +511,8 @@ parse_extended_pasv_response(const guchar *line, gint linelen, guint16 *ftp_port } -static void -dissect_ftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { gboolean is_request; proto_tree *ftp_tree; @@ -876,10 +876,12 @@ dissect_ftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) next_offset - offset); offset = next_offset; } + + return tvb_captured_length(tvb); } -static void -dissect_ftpdata(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_ftpdata(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; int data_length; @@ -912,6 +914,8 @@ dissect_ftpdata(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Assume binary, just show the number of bytes */ proto_item_append_text(ti, " (%u bytes data)", data_length); } + + return tvb_captured_length(tvb); } void @@ -1028,9 +1032,9 @@ proto_register_ftp(void) proto_ftp = proto_register_protocol("File Transfer Protocol (FTP)", "FTP", "ftp"); - register_dissector("ftp", dissect_ftp, proto_ftp); + new_register_dissector("ftp", dissect_ftp, proto_ftp); proto_ftp_data = proto_register_protocol("FTP Data", "FTP-DATA", "ftp-data"); - register_dissector("ftp-data", dissect_ftpdata, proto_ftp_data); + new_register_dissector("ftp-data", dissect_ftpdata, proto_ftp_data); proto_register_field_array(proto_ftp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); expert_ftp = expert_register_protocol(proto_ftp); diff --git a/epan/dissectors/packet-imap.c b/epan/dissectors/packet-imap.c index 9673f6b149..c0e0f4028c 100644 --- a/epan/dissectors/packet-imap.c +++ b/epan/dissectors/packet-imap.c @@ -60,8 +60,8 @@ typedef struct imap_state { gboolean ssl_requested; } imap_state_t; -static void -dissect_imap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_imap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { gboolean is_request; proto_tree *imap_tree, *reqresp_tree; @@ -283,6 +283,8 @@ dissect_imap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset = next_offset; /* Skip over last line and \r\n at the end of it */ } } + + return tvb_captured_length(tvb); } void @@ -349,7 +351,7 @@ proto_register_imap(void) proto_imap = proto_register_protocol("Internet Message Access Protocol", "IMAP", "imap"); - imap_handle = register_dissector("imap", dissect_imap, proto_imap); + imap_handle = new_register_dissector("imap", dissect_imap, proto_imap); proto_register_field_array(proto_imap, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); diff --git a/epan/dissectors/packet-knet.c b/epan/dissectors/packet-knet.c index 948c4d3fc1..4328815020 100644 --- a/epan/dissectors/packet-knet.c +++ b/epan/dissectors/packet-knet.c @@ -584,13 +584,14 @@ dissect_knet_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data * @param tree the parent tree where the dissected data is going to be inserted * */ -static void -dissect_knet_sctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_knet_sctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { col_clear(pinfo->cinfo, COL_INFO); col_set_str(pinfo->cinfo, COL_PROTOCOL, "KNET"); dissect_knet(tvb, pinfo, tree, KNET_SCTP_PACKET); + return tvb_captured_length(tvb); } /** @@ -602,8 +603,8 @@ dissect_knet_sctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * @param tree the parent tree where the dissected data is going to be inserted * */ -static void -dissect_knet_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_knet_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { /* Common subtrees */ proto_item *knet_ti; @@ -650,6 +651,8 @@ dissect_knet_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += dissect_knet_message(tvb, pinfo, knet_tree, offset, messageindex); /* Call the message subdissector */ messageindex++; } + + return tvb_captured_length(tvb); } /** * proto_register_knet registers our kNet protocol, @@ -753,9 +756,9 @@ proto_register_knet(void) /* Register protocols */ proto_knet = proto_register_protocol ("kNet Protocol", "KNET", "knet"); - knet_handle_sctp = register_dissector("knetsctp", dissect_knet_sctp, proto_knet); + knet_handle_sctp = new_register_dissector("knetsctp", dissect_knet_sctp, proto_knet); knet_handle_tcp = new_register_dissector("knettcp", dissect_knet_tcp, proto_knet); - knet_handle_udp = register_dissector("knetudp", dissect_knet_udp, proto_knet); + knet_handle_udp = new_register_dissector("knetudp", dissect_knet_udp, proto_knet); knet_module = prefs_register_protocol(proto_knet, proto_reg_handoff_knet); diff --git a/epan/dissectors/packet-kt.c b/epan/dissectors/packet-kt.c index 0161efb744..064656871d 100644 --- a/epan/dissectors/packet-kt.c +++ b/epan/dissectors/packet-kt.c @@ -605,8 +605,8 @@ dissect_kt_error(tvbuff_t *tvb, proto_tree *tree, gint offset) return new_offset; } -static void -dissect_kt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_kt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { gint magic; proto_item *ti; @@ -620,7 +620,7 @@ dissect_kt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* If the magic is not one of the known values, exit */ if (try_val_to_str(magic, kt_magic_vals) == NULL) - return; + return offset; /* Otherwise, the magic value is known. Continue */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "KT"); @@ -657,6 +657,8 @@ dissect_kt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item_set_len(ti, offset-offset_start); } + + return tvb_captured_length(tvb); } void @@ -778,7 +780,7 @@ proto_register_kt(void) }; proto_kt = proto_register_protocol("Kyoto Tycoon Protocol", "Kyoto Tycoon", "kt"); - register_dissector("kt", dissect_kt, proto_kt); + new_register_dissector("kt", dissect_kt, proto_kt); proto_register_field_array(proto_kt, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); diff --git a/epan/dissectors/packet-reload.c b/epan/dissectors/packet-reload.c index 3978502137..2477dbf903 100644 --- a/epan/dissectors/packet-reload.c +++ b/epan/dissectors/packet-reload.c @@ -3907,7 +3907,7 @@ extern gint dissect_reload_messagecontents(tvbuff_t *tvb, packet_info *pinfo, pr } static int -dissect_reload_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +dissect_reload_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *reload_tree; @@ -4353,16 +4353,10 @@ dissect_reload_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) return dgram_msg_length; } -static void -dissect_reload_message_no_return(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) -{ - dissect_reload_message(tvb, pinfo, tree); -} - static gboolean dissect_reload_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { - if (dissect_reload_message(tvb, pinfo, tree) == 0) { + if (dissect_reload_message(tvb, pinfo, tree, data) == 0) { /* * It wasn't a valid RELOAD message, and wasn't * dissected as such. @@ -5894,7 +5888,7 @@ proto_register_reload(void) /* Register the protocol name and description */ proto_reload = proto_register_protocol("REsource LOcation And Discovery", "RELOAD", "reload"); - register_dissector("reload", dissect_reload_message_no_return, proto_reload); + new_register_dissector("reload", dissect_reload_message, proto_reload); /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_reload, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); diff --git a/epan/dissectors/packet-smtp.c b/epan/dissectors/packet-smtp.c index d8621300d5..49be0fdd3e 100644 --- a/epan/dissectors/packet-smtp.c +++ b/epan/dissectors/packet-smtp.c @@ -348,8 +348,8 @@ decode_plain_auth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } } -static void -dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { struct smtp_proto_data *spd_frame_data; proto_tree *smtp_tree = NULL; @@ -463,7 +463,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) */ pinfo->desegment_offset = loffset; pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT; - return; + return tvb_captured_length(tvb); } else { linelen = tvb_reported_length_remaining(tvb, loffset); next_offset = loffset + linelen; @@ -1138,6 +1138,8 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } + + return tvb_captured_length(tvb); } static void @@ -1268,7 +1270,7 @@ proto_register_smtp(void) register_cleanup_routine (&smtp_data_reassemble_cleanup); /* Allow dissector to find be found by name. */ - register_dissector("smtp", dissect_smtp, proto_smtp); + new_register_dissector("smtp", dissect_smtp, proto_smtp); /* Preferences */ smtp_module = prefs_register_protocol(proto_smtp, NULL); diff --git a/epan/dissectors/packet-synergy.c b/epan/dissectors/packet-synergy.c index b8425e00c8..473ed6adc8 100644 --- a/epan/dissectors/packet-synergy.c +++ b/epan/dissectors/packet-synergy.c @@ -135,8 +135,8 @@ static void dissect_synergy_eicv(tvbuff_t *tvb, packet_info *pinfo, proto_tree * /* Code to actually dissect the packets */ -static void -dissect_synergy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_synergy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { col_set_str(pinfo->cinfo, COL_PROTOCOL, "synergy"); @@ -205,7 +205,9 @@ dissect_synergy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(synergy_tree,hf_synergy_ebad,tvb,offset+4,-1,ENC_NA); else proto_tree_add_item(synergy_tree,hf_synergy_unknown,tvb,offset+4,-1,ENC_NA); - } + } + + return tvb_captured_length(tvb); } static void dissect_synergy_handshake( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset ) @@ -560,7 +562,7 @@ proto_register_synergy(void) /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_synergy, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - register_dissector("synergy", dissect_synergy, proto_synergy); + new_register_dissector("synergy", dissect_synergy, proto_synergy); } void diff --git a/epan/dissectors/packet-syslog.c b/epan/dissectors/packet-syslog.c index 92bf700b88..c250e60365 100644 --- a/epan/dissectors/packet-syslog.c +++ b/epan/dissectors/packet-syslog.c @@ -224,8 +224,8 @@ mtp3_msu_present(tvbuff_t *tvb, packet_info *pinfo, gint fac, gint level, const } /* The message format is defined in RFC 3164 */ -static void -dissect_syslog(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_syslog(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { gint pri = -1, lev = -1, fac = -1; gint msg_off = 0, msg_len, reported_msg_len; @@ -302,7 +302,7 @@ dissect_syslog(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) call_dissector(mtp_handle, mtp3_tvb, pinfo, tree); } - return; + return tvb_captured_length(tvb); } /* Register the protocol with Wireshark */ @@ -346,7 +346,7 @@ void proto_register_syslog(void) proto_register_field_array(proto_syslog, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - syslog_handle = register_dissector("syslog", dissect_syslog, proto_syslog); + syslog_handle = new_register_dissector("syslog", dissect_syslog, proto_syslog); } void |