aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2013-11-09 17:46:28 +0000
committerMichael Mann <mmann78@netscape.net>2013-11-09 17:46:28 +0000
commit8081cf1d90397cbbb4404f9720595e1537ed5e14 (patch)
tree353220f46e08be1f0020603538f501b65bea8f3b /epan
parentc9b2ee3768abb730b49fc4fc779e77578a1c4971 (diff)
Add data parameter to tcp_dissect_pdus() as well as convert it to using "new" style dissectors.
Now that "bytes consumed" can be determined, should tcp_dissect_pdus() take advantage of that? Should tcp_dissect_pdus return length (bytes consumed)? There are many dissectors that just call tcp_dissect_pdus() then return tvb_length(tvb). Seems like that could all be rolled into one. svn path=/trunk/; revision=53198
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-adwin-config.c14
-rw-r--r--epan/dissectors/packet-agentx.c17
-rw-r--r--epan/dissectors/packet-aim.c9
-rw-r--r--epan/dissectors/packet-ajp13.c16
-rw-r--r--epan/dissectors/packet-amqp.c28
-rw-r--r--epan/dissectors/packet-ancp.c18
-rw-r--r--epan/dissectors/packet-aol.c8
-rw-r--r--epan/dissectors/packet-assa_r3.c15
-rw-r--r--epan/dissectors/packet-bitcoin.c9
-rw-r--r--epan/dissectors/packet-bittorrent.c14
-rw-r--r--epan/dissectors/packet-c1222.c21
-rw-r--r--epan/dissectors/packet-cast.c21
-rw-r--r--epan/dissectors/packet-cmp.c15
-rw-r--r--epan/dissectors/packet-cmpp.c16
-rw-r--r--epan/dissectors/packet-cops.c37
-rw-r--r--epan/dissectors/packet-db-lsp.c16
-rw-r--r--epan/dissectors/packet-dbus.c10
-rw-r--r--epan/dissectors/packet-dhcp-failover.c21
-rw-r--r--epan/dissectors/packet-dhcpv6.c15
-rw-r--r--epan/dissectors/packet-diameter.c21
-rw-r--r--epan/dissectors/packet-disp.c26
-rw-r--r--epan/dissectors/packet-dlsw.c17
-rw-r--r--epan/dissectors/packet-dnp.c14
-rw-r--r--epan/dissectors/packet-dns.c14
-rw-r--r--epan/dissectors/packet-drda.c19
-rw-r--r--epan/dissectors/packet-dsi.c16
-rw-r--r--epan/dissectors/packet-dtn.c22
-rw-r--r--epan/dissectors/packet-edonkey.c8
-rw-r--r--epan/dissectors/packet-enip.c15
-rw-r--r--epan/dissectors/packet-erldp.c22
-rw-r--r--epan/dissectors/packet-etch.c9
-rw-r--r--epan/dissectors/packet-fcgi.c15
-rw-r--r--epan/dissectors/packet-ff.c15
-rw-r--r--epan/dissectors/packet-fix.c33
-rw-r--r--epan/dissectors/packet-fmtp.c10
-rw-r--r--epan/dissectors/packet-gadu-gadu.c10
-rw-r--r--epan/dissectors/packet-gearman.c15
-rw-r--r--epan/dissectors/packet-ged125.c16
-rw-r--r--epan/dissectors/packet-giop.c31
-rw-r--r--epan/dissectors/packet-git.c31
-rw-r--r--epan/dissectors/packet-gnutella.c12
-rw-r--r--epan/dissectors/packet-hartip.c10
-rw-r--r--epan/dissectors/packet-hazelcast.c37
-rw-r--r--epan/dissectors/packet-hdfs.c17
-rw-r--r--epan/dissectors/packet-hdfsdata.c15
-rw-r--r--epan/dissectors/packet-hpfeeds.c22
-rw-r--r--epan/dissectors/packet-http2.c12
-rw-r--r--epan/dissectors/packet-icep.c11
-rw-r--r--epan/dissectors/packet-idmp.c12
-rw-r--r--epan/dissectors/packet-iec104.c13
-rw-r--r--epan/dissectors/packet-ifcp.c27
-rw-r--r--epan/dissectors/packet-ilp.c20
-rw-r--r--epan/dissectors/packet-ipdc.c36
-rw-r--r--epan/dissectors/packet-isns.c57
-rw-r--r--epan/dissectors/packet-kafka.c11
-rw-r--r--epan/dissectors/packet-kdsp.c15
-rw-r--r--epan/dissectors/packet-kerberos.c21
-rw-r--r--epan/dissectors/packet-knet.c14
-rw-r--r--epan/dissectors/packet-kpasswd.c15
-rw-r--r--epan/dissectors/packet-laplink.c14
-rw-r--r--epan/dissectors/packet-ldap.c30
-rw-r--r--epan/dissectors/packet-llrp.c15
-rw-r--r--epan/dissectors/packet-lsc.c25
-rw-r--r--epan/dissectors/packet-mbtcp.c18
-rw-r--r--epan/dissectors/packet-memcache.c26
-rw-r--r--epan/dissectors/packet-mongo.c26
-rw-r--r--epan/dissectors/packet-mq.c328
-rw-r--r--epan/dissectors/packet-mrcpv2.c10
-rw-r--r--epan/dissectors/packet-mysql.c327
-rw-r--r--epan/dissectors/packet-nbd.c14
-rw-r--r--epan/dissectors/packet-ncp.c14
-rw-r--r--epan/dissectors/packet-ndmp.c28
-rw-r--r--epan/dissectors/packet-ndps.c23
-rw-r--r--epan/dissectors/packet-netsync.c18
-rw-r--r--epan/dissectors/packet-openflow.c9
-rw-r--r--epan/dissectors/packet-openvpn.c103
-rw-r--r--epan/dissectors/packet-openwire.c21
-rw-r--r--epan/dissectors/packet-opsi.c14
-rw-r--r--epan/dissectors/packet-paltalk.c62
-rw-r--r--epan/dissectors/packet-pcep.c14
-rw-r--r--epan/dissectors/packet-pcp.c12
-rw-r--r--epan/dissectors/packet-pgsql.c246
-rw-r--r--epan/dissectors/packet-pvfs2.c8
-rw-r--r--epan/dissectors/packet-reload-framing.c21
-rw-r--r--epan/dissectors/packet-rpcap.c16
-rw-r--r--epan/dissectors/packet-rpki-rtr.c13
-rw-r--r--epan/dissectors/packet-s5066sis.c23
-rw-r--r--epan/dissectors/packet-sabp.c22
-rw-r--r--epan/dissectors/packet-sametime.c14
-rw-r--r--epan/dissectors/packet-sasp.c52
-rw-r--r--epan/dissectors/packet-scop.c104
-rw-r--r--epan/dissectors/packet-selfm.c13
-rw-r--r--epan/dissectors/packet-simulcrypt.c17
-rw-r--r--epan/dissectors/packet-skinny.c9
-rw-r--r--epan/dissectors/packet-slsk.c12
-rw-r--r--epan/dissectors/packet-smpp.c30
-rw-r--r--epan/dissectors/packet-soupbintcp.c14
-rw-r--r--epan/dissectors/packet-srvloc.c14
-rw-r--r--epan/dissectors/packet-starteam.c19
-rw-r--r--epan/dissectors/packet-stun.c21
-rw-r--r--epan/dissectors/packet-synphasor.c50
-rw-r--r--epan/dissectors/packet-tali.c19
-rw-r--r--epan/dissectors/packet-tcp.c4
-rw-r--r--epan/dissectors/packet-tcp.h2
-rw-r--r--epan/dissectors/packet-tipc.c32
-rw-r--r--epan/dissectors/packet-tns.c12
-rw-r--r--epan/dissectors/packet-tpncp.c16
-rw-r--r--epan/dissectors/packet-turnchannel.c17
-rw-r--r--epan/dissectors/packet-ucp.c113
-rw-r--r--epan/dissectors/packet-ulp.c20
-rw-r--r--epan/dissectors/packet-uma.c17
-rw-r--r--epan/dissectors/packet-winsrepl.c25
-rw-r--r--epan/dissectors/packet-wow.c64
-rw-r--r--epan/dissectors/packet-xmcp.c27
-rw-r--r--epan/dissectors/packet-xot.c15
-rw-r--r--epan/dissectors/packet-yami.c18
-rw-r--r--epan/dissectors/packet-ymsg.c43
-rw-r--r--epan/dissectors/packet-ziop.c188
118 files changed, 1841 insertions, 1736 deletions
diff --git a/epan/dissectors/packet-adwin-config.c b/epan/dissectors/packet-adwin-config.c
index b5b94a78fb..c6c55bef35 100644
--- a/epan/dissectors/packet-adwin-config.c
+++ b/epan/dissectors/packet-adwin-config.c
@@ -328,8 +328,8 @@ get_adwin_TCPUpdate_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return tvb_get_ntohl(tvb, offset);
}
-static void
-dissect_TCPFlashUpdate(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *adwin_tree)
+static int
+dissect_TCPFlashUpdate(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *adwin_tree, void* data _U_)
{
gint length, offset;
guint8 *filename;
@@ -337,7 +337,7 @@ dissect_TCPFlashUpdate(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *adwin
tmp_time.nsecs = 0;
if (! adwin_tree)
- return;
+ return 0;
ADWIN_ADD_BE(adwin_tree, stream_length, 0, 4);
offset = 4;
@@ -346,12 +346,12 @@ dissect_TCPFlashUpdate(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *adwin
if (strncmp(filename, "eeprom_on", length) == 0) {
proto_tree_add_text(adwin_tree, tvb, offset, length,
"Enable EEPROM Support");
- return;
+ return offset+length;
}
if (strncmp(filename, "eeprom_off", length) == 0) {
proto_tree_add_text(adwin_tree, tvb, offset, length,
"Disable EEPROM Support");
- return;
+ return offset+length;
}
ADWIN_ADD_BE(adwin_tree, filename, 4, length);
offset += length;
@@ -372,6 +372,8 @@ dissect_TCPFlashUpdate(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *adwin
offset += 128;
length = tvb_length(tvb) - offset;
ADWIN_ADD_BE(adwin_tree, data, offset, length);
+
+ return tvb_length(tvb);
}
/* 00:50:c2:0a:2*:** */
@@ -472,7 +474,7 @@ dissect_adwin_config(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *
switch (pinfo->ipproto) {
case IP_PROTO_TCP:
- tcp_dissect_pdus(tvb, pinfo, tree, 1, 4, get_adwin_TCPUpdate_len, dissect_TCPFlashUpdate);
+ tcp_dissect_pdus(tvb, pinfo, tree, 1, 4, get_adwin_TCPUpdate_len, dissect_TCPFlashUpdate, NULL);
col_set_str(pinfo->cinfo, COL_INFO, "TCPFlashUpdate");
break;
case IP_PROTO_UDP:
diff --git a/epan/dissectors/packet-agentx.c b/epan/dissectors/packet-agentx.c
index 7de74ef404..9eaff52650 100644
--- a/epan/dissectors/packet-agentx.c
+++ b/epan/dissectors/packet-agentx.c
@@ -824,8 +824,8 @@ get_agentx_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return plen + 20;
}
-static void
-dissect_agentx_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_agentx_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
int offset = 0;
proto_tree* agentx_tree, *pdu_hdr_tree, *flags_tree;
@@ -857,7 +857,7 @@ dissect_agentx_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if(!tree)
- return;
+ return 0;
/*t_item = proto_tree_add_item(tree, proto_agentx, tvb, 0, -1, ENC_NA);*/
t_item = proto_tree_add_protocol_format(tree, proto_agentx, tvb, 0, -1,
@@ -954,13 +954,16 @@ dissect_agentx_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dissect_response_pdu(tvb, agentx_tree, offset, payload_len, flags);
break;
}
+
+ return tvb_length(tvb);
}
-static void
-dissect_agentx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_agentx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 20, get_agentx_pdu_len,
- dissect_agentx_pdu);
+ dissect_agentx_pdu, data);
+ return tvb_length(tvb);
}
static const true_false_string tfs_agentx_include = { "Yes", "No" };
@@ -1180,7 +1183,7 @@ proto_reg_handoff_agentx(void)
static guint agentx_tcp_port;
if(!agentx_prefs_initialized) {
- agentx_handle = create_dissector_handle(dissect_agentx, proto_agentx);
+ agentx_handle = new_create_dissector_handle(dissect_agentx, proto_agentx);
agentx_prefs_initialized = TRUE;
}
else {
diff --git a/epan/dissectors/packet-aim.c b/epan/dissectors/packet-aim.c
index 6aaf764636..b808dce634 100644
--- a/epan/dissectors/packet-aim.c
+++ b/epan/dissectors/packet-aim.c
@@ -1407,8 +1407,8 @@ get_aim_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return plen + 6;
}
-static void
-dissect_aim_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_aim_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
/* Header fields */
unsigned char hdr_channel; /* channel ID */
@@ -1469,11 +1469,12 @@ dissect_aim_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
}
+ return tvb_length(tvb);
}
/* Code to actually dissect the packets */
static int
-dissect_aim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_aim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
/* check, if this is really an AIM packet, they start with 0x2a */
/* XXX - I've seen some stuff starting with 0x5a followed by 0x2a */
@@ -1490,7 +1491,7 @@ dissect_aim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
}
tcp_dissect_pdus(tvb, pinfo, tree, aim_desegment, 6, get_aim_pdu_len,
- dissect_aim_pdu);
+ dissect_aim_pdu, data);
return tvb_length(tvb);
}
diff --git a/epan/dissectors/packet-ajp13.c b/epan/dissectors/packet-ajp13.c
index e1f2be9a1e..99ccbaede3 100644
--- a/epan/dissectors/packet-ajp13.c
+++ b/epan/dissectors/packet-ajp13.c
@@ -748,8 +748,8 @@ display_req_forward(tvbuff_t *tvb, packet_info *pinfo,
/* main dissector function. wireshark calls it for segments in both
* directions.
*/
-static void
-dissect_ajp13_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ajp13_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
guint16 mag;
/* guint16 len; */
@@ -829,6 +829,8 @@ dissect_ajp13_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
display_rsp(tvb, pinfo, ajp13_tree, cd);
}
+
+ return tvb_length(tvb);
}
@@ -851,8 +853,8 @@ get_ajp13_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
/* Code to actually dissect the packets.
*/
-static void
-dissect_ajp13(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ajp13(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
/* Set up structures needed to add the protocol subtree and manage it
*/
@@ -860,7 +862,9 @@ dissect_ajp13(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
TRUE, /* desegment or not */
4, /* magic + length */
get_ajp13_pdu_len, /* use first 4, calc data len */
- dissect_ajp13_tcp_pdu); /* the naive dissector */
+ dissect_ajp13_tcp_pdu, data); /* the naive dissector */
+
+ return tvb_length(tvb);
}
@@ -1118,6 +1122,6 @@ void
proto_reg_handoff_ajp13(void)
{
dissector_handle_t ajp13_handle;
- ajp13_handle = create_dissector_handle(dissect_ajp13, proto_ajp13);
+ ajp13_handle = new_create_dissector_handle(dissect_ajp13, proto_ajp13);
dissector_add_uint("tcp.port", 8009, ajp13_handle);
}
diff --git a/epan/dissectors/packet-amqp.c b/epan/dissectors/packet-amqp.c
index fa388aab07..3b0df18275 100644
--- a/epan/dissectors/packet-amqp.c
+++ b/epan/dissectors/packet-amqp.c
@@ -415,11 +415,11 @@ static void
dissect_amqp_0_10_struct32(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
int offset, guint32 struct_length);
-static void
-dissect_amqp_0_10_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+static int
+dissect_amqp_0_10_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_);
-static void
-dissect_amqp_0_9_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+static int
+dissect_amqp_0_9_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_);
static int
dissect_amqp_0_9_method_connection_start(tvbuff_t *tvb, packet_info *pinfo,
@@ -1825,7 +1825,7 @@ dissect_amqp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
amqp_conv *conn;
guint fixed_length;
guint (*length_getter)(packet_info *, tvbuff_t *, int);
- dissector_t dissector;
+ new_dissector_t dissector;
/* Minimal frame size is 8 bytes - smaller frames are malformed */
if (tvb_reported_length (tvb) < 8) {
@@ -1858,7 +1858,7 @@ dissect_amqp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
return;
}
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, fixed_length,
- length_getter, dissector);
+ length_getter, dissector, NULL);
}
static void
@@ -5557,8 +5557,8 @@ dissect_amqp_0_10_struct32(tvbuff_t *tvb,
}
}
-static void
-dissect_amqp_0_10_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_amqp_0_10_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
proto_item *amqp_tree = NULL;
@@ -5604,7 +5604,7 @@ dissect_amqp_0_10_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_item(amqp_tree, hf_amqp_init_version_major, tvb, 6, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(amqp_tree, hf_amqp_init_version_minor, tvb, 7, 1, ENC_BIG_ENDIAN);
}
- return;
+ return 8;
}
/* Protocol frame */
@@ -5703,12 +5703,14 @@ dissect_amqp_0_10_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
default:
expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_frame_type, "Unknown frame type %d", frame_type);
}
+
+ return tvb_length(tvb);
}
/* Dissection routine for AMQP 0-9 frames */
-static void
-dissect_amqp_0_9_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_amqp_0_9_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
proto_item *amqp_tree = NULL;
@@ -5746,7 +5748,7 @@ dissect_amqp_0_9_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_item(amqp_tree, hf_amqp_init_version_major, tvb, 6, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(amqp_tree, hf_amqp_init_version_minor, tvb, 7, 1, ENC_BIG_ENDIAN);
}
- return;
+ return 8;
}
if (tree) {
@@ -6348,6 +6350,8 @@ dissect_amqp_0_9_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
default:
expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_frame_type, "Unknown frame type %u", frame_type);
}
+
+ return tvb_length(tvb);
}
/* Dissection routine for method Connection.Start */
diff --git a/epan/dissectors/packet-ancp.c b/epan/dissectors/packet-ancp.c
index a0b9ae1d34..4240dad51b 100644
--- a/epan/dissectors/packet-ancp.c
+++ b/epan/dissectors/packet-ancp.c
@@ -541,8 +541,8 @@ ancp_stats_tree_packet(stats_tree* st, packet_info* pinfo _U_,
return 1;
}
-static void
-dissect_ancp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ancp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
gint offset;
guint8 mtype;
@@ -554,7 +554,7 @@ dissect_ancp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset = 0;
if (tvb_get_ntohs(tvb, offset) != ANCP_GSMP_ETHER_TYPE)
- return; /* XXX: this dissector is not a heuristic dissector */
+ return 0; /* XXX: this dissector is not a heuristic dissector */
/* Should do "expert" & dissect rest as "data" */
/* (after setting COL_PROTOCOL & etc) ? */
@@ -635,6 +635,8 @@ dissect_ancp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
}
tap_queue_packet(ancp_tap, pinfo, ancp_info);
+
+ return tvb_length(tvb);
}
static guint
@@ -643,11 +645,13 @@ get_ancp_msg_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return (guint)tvb_get_ntohs(tvb, offset + 2) + 4; /* 2B len + 4B hdr */
}
-static void
-dissect_ancp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ancp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, ANCP_MIN_HDR,
- get_ancp_msg_len, dissect_ancp_message);
+ get_ancp_msg_len, dissect_ancp_message, data);
+
+ return tvb_length(tvb);
}
void
@@ -928,7 +932,7 @@ proto_reg_handoff_ancp(void)
{
dissector_handle_t ancp_handle;
- ancp_handle = create_dissector_handle(dissect_ancp, proto_ancp);
+ ancp_handle = new_create_dissector_handle(dissect_ancp, proto_ancp);
dissector_add_uint("tcp.port", ANCP_PORT, ancp_handle);
stats_tree_register("ancp", "ancp", "ANCP", 0,
ancp_stats_tree_packet, ancp_stats_tree_init, NULL);
diff --git a/epan/dissectors/packet-aol.c b/epan/dissectors/packet-aol.c
index a957255330..5882251a81 100644
--- a/epan/dissectors/packet-aol.c
+++ b/epan/dissectors/packet-aol.c
@@ -211,7 +211,7 @@ static guint get_aol_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
/**
* Dissect a PDU
*/
-static void dissect_aol_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
+static int dissect_aol_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) {
proto_item *ti = NULL;
proto_tree *aol_tree = NULL;
guint offset = 0;
@@ -296,18 +296,18 @@ static void dissect_aol_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
expert_add_info(pinfo,ti,&ei_aol_end_missing);
}
- return;
+ return tvb_length(tvb);
}
/**
* Dissect a packet
*/
-static int dissect_aol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
+static int dissect_aol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) {
/* Ensure this really is an AOL packet */
if (tvb_length(tvb) >= 1 && tvb_get_guint8(tvb,0) != AOL_P3_FRAME_START) return 0;
/* Dissect PDUs */
- tcp_dissect_pdus(tvb,pinfo,tree,aol_desegment,9,get_aol_pdu_len,dissect_aol_pdu);
+ tcp_dissect_pdus(tvb,pinfo,tree,aol_desegment,9,get_aol_pdu_len,dissect_aol_pdu,data);
return tvb_length(tvb);
}
diff --git a/epan/dissectors/packet-assa_r3.c b/epan/dissectors/packet-assa_r3.c
index 7c2939be13..4c50898763 100644
--- a/epan/dissectors/packet-assa_r3.c
+++ b/epan/dissectors/packet-assa_r3.c
@@ -6740,8 +6740,8 @@ dissect_r3_packet (tvbuff_t *tvb, packet_info *pinfo, proto_tree *r3_tree)
*
* Main dissector entry points
*/
-static void
-dissect_r3_message (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_r3_message (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data_U_)
{
proto_tree *r3_tree = NULL;
@@ -6761,7 +6761,7 @@ dissect_r3_message (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dissect_r3_packet (tvb, pinfo, r3_tree);
- return;
+ return tvb_length(tvb);
}
static guint
@@ -6770,10 +6770,11 @@ get_r3_message_len (packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return (guint) tvb_get_guint8 (tvb, offset + 3) + 1;
}
-static void
-dissect_r3 (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_r3 (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
- tcp_dissect_pdus (tvb, pinfo, tree, TRUE, 4, get_r3_message_len, dissect_r3_message);
+ tcp_dissect_pdus (tvb, pinfo, tree, TRUE, 4, get_r3_message_len, dissect_r3_message, data);
+ return tvb_length(tvb);
}
/*
@@ -10068,7 +10069,7 @@ void proto_register_r3 (void)
expert_module_t* expert_r3;
proto_r3 = proto_register_protocol ("Assa Abloy R3", "R3", "r3");
- register_dissector ("r3", dissect_r3, proto_r3);
+ new_register_dissector ("r3", dissect_r3, proto_r3);
proto_register_field_array (proto_r3, hf, array_length (hf));
proto_register_subtree_array (ett, array_length (ett));
expert_r3 = expert_register_protocol(proto_r3);
diff --git a/epan/dissectors/packet-bitcoin.c b/epan/dissectors/packet-bitcoin.c
index 337503459d..55ae1af59d 100644
--- a/epan/dissectors/packet-bitcoin.c
+++ b/epan/dissectors/packet-bitcoin.c
@@ -1043,7 +1043,7 @@ static msg_dissector_t msg_dissectors[] =
{"alert", dissect_bitcoin_msg_empty}
};
-static void dissect_bitcoin_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_bitcoin_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
proto_item *ti;
guint32 i;
@@ -1074,7 +1074,7 @@ static void dissect_bitcoin_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tre
tvb_sub = tvb_new_subset_remaining(tvb, offset);
msg_dissectors[i].function(tvb_sub, pinfo, tree);
- return;
+ return tvb_length(tvb);
}
}
@@ -1082,14 +1082,15 @@ static void dissect_bitcoin_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tre
col_append_sep_str(pinfo->cinfo, COL_INFO, ", ", "[unknown command]");
expert_add_info(pinfo, ti, &ei_bitcoin_command_unknown);
+ return tvb_length(tvb);
}
static int
-dissect_bitcoin(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_bitcoin(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
col_clear(pinfo->cinfo, COL_INFO);
tcp_dissect_pdus(tvb, pinfo, tree, bitcoin_desegment, BITCOIN_HEADER_LENGTH,
- get_bitcoin_pdu_length, dissect_bitcoin_tcp_pdu);
+ get_bitcoin_pdu_length, dissect_bitcoin_tcp_pdu, data);
return tvb_reported_length(tvb);
}
diff --git a/epan/dissectors/packet-bittorrent.c b/epan/dissectors/packet-bittorrent.c
index 04c3c4da7c..384ad2906a 100644
--- a/epan/dissectors/packet-bittorrent.c
+++ b/epan/dissectors/packet-bittorrent.c
@@ -794,7 +794,7 @@ dissect_bittorrent_welcome (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *t
}
static
-void dissect_bittorrent_tcp_pdu (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+int dissect_bittorrent_tcp_pdu (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
@@ -815,18 +815,20 @@ void dissect_bittorrent_tcp_pdu (tvbuff_t *tvb, packet_info *pinfo, proto_tree *
col_append_str(pinfo->cinfo, COL_INFO, " ");
col_set_fence(pinfo->cinfo, COL_INFO);
+ return tvb_length(tvb);
}
static
-void dissect_bittorrent (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+int dissect_bittorrent (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, bittorrent_desegment, BITTORRENT_HEADER_LENGTH,
- get_bittorrent_pdu_length, dissect_bittorrent_tcp_pdu);
+ get_bittorrent_pdu_length, dissect_bittorrent_tcp_pdu, data);
+ return tvb_length(tvb);
}
static
gboolean test_bittorrent_packet (tvbuff_t *tvb, packet_info *pinfo,
- proto_tree *tree, void *data _U_)
+ proto_tree *tree, void *data)
{
conversation_t *conversation;
@@ -836,7 +838,7 @@ gboolean test_bittorrent_packet (tvbuff_t *tvb, packet_info *pinfo,
conversation = find_or_create_conversation(pinfo);
conversation_set_dissector(conversation, dissector_handle);
- dissect_bittorrent(tvb, pinfo, tree);
+ dissect_bittorrent(tvb, pinfo, tree, data);
return TRUE;
}
@@ -957,7 +959,7 @@ proto_register_bittorrent(void)
proto_register_field_array(proto_bittorrent, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
- register_dissector("bittorrent.tcp", dissect_bittorrent, proto_bittorrent);
+ new_register_dissector("bittorrent.tcp", dissect_bittorrent, proto_bittorrent);
bittorrent_module = prefs_register_protocol(proto_bittorrent, NULL);
prefs_register_bool_preference(bittorrent_module, "desegment",
diff --git a/epan/dissectors/packet-c1222.c b/epan/dissectors/packet-c1222.c
index 6e66bfecd7..df2b111704 100644
--- a/epan/dissectors/packet-c1222.c
+++ b/epan/dissectors/packet-c1222.c
@@ -1576,8 +1576,8 @@ static void dissect_MESSAGE_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto
* \param pinfo the packet info of the current data
* \param tree the tree to append this item to
*/
-static void
-dissect_c1222_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_c1222_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *c1222_item = NULL;
proto_tree *c1222_tree = NULL;
@@ -1591,6 +1591,8 @@ dissect_c1222_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
c1222_tree = proto_item_add_subtree(c1222_item, ett_c1222);
dissect_MESSAGE_PDU(tvb, pinfo, c1222_tree);
}
+
+ return tvb_length(tvb);
}
/**
@@ -1621,11 +1623,12 @@ get_c1222_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset)
* \param pinfo the packet info of the current data
* \param tree the tree to append this item to
*/
-static void
-dissect_c1222(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_c1222(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, c1222_desegment, 5,
- get_c1222_message_len, dissect_c1222_common);
+ get_c1222_message_len, dissect_c1222_common, data);
+ return tvb_length(tvb);
}
/*--- proto_register_c1222 -------------------------------------------*/
@@ -1954,7 +1957,7 @@ void proto_register_c1222(void) {
"OCTET_STRING_SIZE_CONSTR002", HFILL }},
/*--- End of included file: packet-c1222-hfarr.c ---*/
-#line 1333 "../../asn1/c1222/packet-c1222-template.c"
+#line 1336 "../../asn1/c1222/packet-c1222-template.c"
};
/* List of subtrees */
@@ -1977,7 +1980,7 @@ void proto_register_c1222(void) {
&ett_c1222_Calling_authentication_value_c1221_U,
/*--- End of included file: packet-c1222-ettarr.c ---*/
-#line 1343 "../../asn1/c1222/packet-c1222-template.c"
+#line 1346 "../../asn1/c1222/packet-c1222-template.c"
};
static ei_register_info ei[] = {
@@ -2058,8 +2061,8 @@ proto_reg_handoff_c1222(void)
guint8 *temp = NULL;
if( !initialized ) {
- c1222_handle = create_dissector_handle(dissect_c1222, proto_c1222);
- c1222_udp_handle = create_dissector_handle(dissect_c1222_common, proto_c1222);
+ c1222_handle = new_create_dissector_handle(dissect_c1222, proto_c1222);
+ c1222_udp_handle = new_create_dissector_handle(dissect_c1222_common, proto_c1222);
dissector_add_uint("tcp.port", global_c1222_port, c1222_handle);
dissector_add_uint("udp.port", global_c1222_port, c1222_udp_handle);
initialized = TRUE;
diff --git a/epan/dissectors/packet-cast.c b/epan/dissectors/packet-cast.c
index b3b076b318..4370628af6 100644
--- a/epan/dissectors/packet-cast.c
+++ b/epan/dissectors/packet-cast.c
@@ -283,8 +283,6 @@ static const value_string cast_callSecurityStatusTypes[] = {
#define StationMaxDirnumSize 24 /* max size of calling or called party dirnum */
-static void dissect_cast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-
/* Initialize the protocol and registered fields */
static int proto_cast = -1;
static int hf_cast_data_length = -1;
@@ -400,8 +398,8 @@ static gboolean cast_desegment = TRUE;
static dissector_handle_t data_handle;
/* Dissect a single CAST PDU */
-static void
-dissect_cast_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_cast_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
int offset = 0;
@@ -1030,6 +1028,8 @@ dissect_cast_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
}
}
+
+ return tvb_length(tvb);
}
/* Get the length of a single CAST PDU */
@@ -1051,8 +1051,8 @@ get_cast_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
}
/* Code to actually dissect the packets */
-static void
-dissect_cast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_cast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
/* The general structure of a packet: {IP-Header|TCP-Header|n*CAST}
* CAST-Packet: {Header(Size, Reserved)|Data(MessageID, Message-Data)}
@@ -1070,16 +1070,15 @@ dissect_cast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* data_size = MIN(8+hdr_data_length, tvb_length(tvb)) - 0xC; */
if (hdr_data_length < 4 || hdr_marker != 0) {
- /* Not an CAST packet, just happened to use the same port */
- call_dissector(data_handle,tvb, pinfo, tree);
- return;
+ return 0;
}
/* Make entries in Protocol column and Info column on summary display */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "CAST");
col_set_str(pinfo->cinfo, COL_INFO, "Cast Client Control Protocol");
- tcp_dissect_pdus(tvb, pinfo, tree, cast_desegment, 4, get_cast_pdu_len, dissect_cast_pdu);
+ tcp_dissect_pdus(tvb, pinfo, tree, cast_desegment, 4, get_cast_pdu_len, dissect_cast_pdu, data);
+ return tvb_length(tvb);
}
/* Register the protocol with Wireshark */
@@ -1745,7 +1744,7 @@ proto_reg_handoff_cast(void)
dissector_handle_t cast_handle;
data_handle = find_dissector("data");
- cast_handle = create_dissector_handle(dissect_cast, proto_cast);
+ cast_handle = new_create_dissector_handle(dissect_cast, proto_cast);
dissector_add_uint("tcp.port", TCP_PORT_CAST, cast_handle);
}
diff --git a/epan/dissectors/packet-cmp.c b/epan/dissectors/packet-cmp.c
index 7dbc310f81..9f35ab30ba 100644
--- a/epan/dissectors/packet-cmp.c
+++ b/epan/dissectors/packet-cmp.c
@@ -1574,11 +1574,6 @@ static int dissect_cmp_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *pa
return offset;
}
-static void dissect_cmp_tcp_pdu_no_return(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
-{
- dissect_cmp_tcp_pdu(tvb, pinfo, parent_tree, NULL);
-}
-
static guint get_cmp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
{
guint32 plen;
@@ -1594,7 +1589,7 @@ static guint get_cmp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
/* CMP over TCP: RFC2510 section 5.2 and "Transport Protocols for CMP" draft */
static int
-dissect_cmp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *data _U_)
+dissect_cmp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *data)
{
guint32 pdu_len;
guint8 pdu_type;
@@ -1644,7 +1639,7 @@ dissect_cmp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void
}
tcp_dissect_pdus(tvb, pinfo, parent_tree, cmp_desegment, offset, get_cmp_pdu_len,
- dissect_cmp_tcp_pdu_no_return);
+ dissect_cmp_tcp_pdu, data);
return tvb_length(tvb);
}
@@ -2342,7 +2337,7 @@ void proto_register_cmp(void) {
NULL, HFILL }},
/*--- End of included file: packet-cmp-hfarr.c ---*/
-#line 331 "../../asn1/cmp/packet-cmp-template.c"
+#line 326 "../../asn1/cmp/packet-cmp-template.c"
};
/* List of subtrees */
@@ -2400,7 +2395,7 @@ void proto_register_cmp(void) {
&ett_cmp_PollRepContent_item,
/*--- End of included file: packet-cmp-ettarr.c ---*/
-#line 337 "../../asn1/cmp/packet-cmp-template.c"
+#line 332 "../../asn1/cmp/packet-cmp-template.c"
};
module_t *cmp_module;
@@ -2494,7 +2489,7 @@ void proto_reg_handoff_cmp(void) {
/*--- End of included file: packet-cmp-dis-tab.c ---*/
-#line 409 "../../asn1/cmp/packet-cmp-template.c"
+#line 404 "../../asn1/cmp/packet-cmp-template.c"
inited = TRUE;
}
diff --git a/epan/dissectors/packet-cmpp.c b/epan/dissectors/packet-cmpp.c
index 56cc0af445..59d2b7830c 100644
--- a/epan/dissectors/packet-cmpp.c
+++ b/epan/dissectors/packet-cmpp.c
@@ -536,8 +536,8 @@ cmpp_deliver_resp(proto_tree *tree, tvbuff_t *tvb)
}
/* Code to actually dissect the packets */
-static void
-dissect_cmpp_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_cmpp_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
/* Set up structures needed to add the protocol subtree and manage it */
@@ -552,7 +552,7 @@ dissect_cmpp_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tvb_len = tvb_length(tvb);
/* if the length of the tvb is shorder then the cmpp header length exit */
if (tvb_len < CMPP_FIX_HEADER_LENGTH)
- return;
+ return 0;
total_length = tvb_get_ntohl(tvb, 0); /* Get the pdu length */
command_id = tvb_get_ntohl(tvb, 4); /* get the pdu command id */
@@ -560,7 +560,7 @@ dissect_cmpp_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (try_val_to_str(command_id, vals_command_Id) == NULL)
{
/* Should never happen: we checked this in dissect_cmpp() */
- return;
+ return 0;
}
command_str = val_to_str(command_id, vals_command_Id,
@@ -570,7 +570,7 @@ dissect_cmpp_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (tvb_len < total_length)
{
/* Should never happen: TCP should have desegmented for us */
- return;
+ return 0;
}
/* Make entries in Protocol column and Info column on summary display */
@@ -618,6 +618,8 @@ dissect_cmpp_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
}
}
+
+ return tvb_length(tvb);
}
@@ -630,7 +632,7 @@ get_cmpp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, gint offset)
static int
-dissect_cmpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_cmpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
guint total_length, command_id, tvb_len;
/* Check that there's enough data */
@@ -655,7 +657,7 @@ dissect_cmpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
col_clear(pinfo->cinfo, COL_INFO);
tcp_dissect_pdus(tvb, pinfo, tree, cmpp_desegment, CMPP_FIX_HEADER_LENGTH,
- get_cmpp_pdu_len, dissect_cmpp_tcp_pdu);
+ get_cmpp_pdu_len, dissect_cmpp_tcp_pdu, data);
/* Return the amount of data this dissector was able to dissect */
return tvb_length(tvb);
diff --git a/epan/dissectors/packet-cops.c b/epan/dissectors/packet-cops.c
index b14cc535c6..887ae5e9df 100644
--- a/epan/dissectors/packet-cops.c
+++ b/epan/dissectors/packet-cops.c
@@ -812,10 +812,6 @@ typedef struct _cops_call_t
} cops_call_t;
void proto_reg_handoff_cops(void);
-
-static guint get_cops_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset);
-static void dissect_cops_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-
static int dissect_cops_object(tvbuff_t *tvb, packet_info *pinfo, guint8 op_code, guint32 offset, proto_tree *tree, guint16 client_type, guint32* handle_value);
static void dissect_cops_object_data(tvbuff_t *tvb, packet_info *pinfo, guint32 offset, proto_tree *tree,
guint8 op_code, guint16 client_type, guint8 c_num, guint8 c_type, int len, guint32* handle_value);
@@ -919,16 +915,6 @@ static int cops_tag_cls2syntax ( guint tag, guint cls ) {
return hf_cops_epd_unknown;
}
-
-
-/* Code to actually dissect the packets */
-static void
-dissect_cops(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
-{
- tcp_dissect_pdus(tvb, pinfo, tree, cops_desegment, 8,
- get_cops_pdu_len, dissect_cops_pdu);
-}
-
static guint
get_cops_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
{
@@ -938,8 +924,8 @@ get_cops_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return tvb_get_ntohl(tvb, offset + 4);
}
-static void
-dissect_cops_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_cops_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
guint8 op_code;
guint16 client_type;
@@ -998,7 +984,7 @@ dissect_cops_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
while (tvb_reported_length_remaining(tvb, offset) >= COPS_OBJECT_HDR_SIZE) {
object_len = dissect_cops_object(tvb, pinfo, op_code, offset, cops_tree, client_type, &handle_value);
if (object_len < 0)
- return;
+ return offset;
offset += object_len;
}
@@ -1018,7 +1004,7 @@ dissect_cops_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
op_code != COPS_MSG_CC &&
op_code != COPS_MSG_KA &&
op_code != COPS_MSG_SSC) ) {
- return ;
+ return offset;
}
@@ -1090,7 +1076,7 @@ dissect_cops_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
pdus_array = (GPtrArray *)wmem_tree_lookup32(cops_conv_info->pdus_tree, handle_value);
if (pdus_array == NULL) /* There's no request with this handle value */
- return;
+ return offset;
if (!pinfo->fd->flags.visited) {
for (i=0; i < pdus_array->len; i++) {
@@ -1136,6 +1122,17 @@ dissect_cops_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
}
+
+ return tvb_length(tvb);
+}
+
+/* Code to actually dissect the packets */
+static int
+dissect_cops(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
+{
+ tcp_dissect_pdus(tvb, pinfo, tree, cops_desegment, 8,
+ get_cops_pdu_len, dissect_cops_pdu, data);
+ return tvb_length(tvb);
}
static const char *cops_c_type_to_str(guint8 c_num, guint8 c_type)
@@ -2771,7 +2768,7 @@ void proto_register_cops(void)
expert_register_field_array(expert_cops, ei, array_length(ei));
/* Make dissector findable by name */
- register_dissector("cops", dissect_cops, proto_cops);
+ new_register_dissector("cops", dissect_cops, proto_cops);
/* Register our configuration options for cops */
cops_module = prefs_register_protocol(proto_cops, proto_reg_handoff_cops);
diff --git a/epan/dissectors/packet-db-lsp.c b/epan/dissectors/packet-db-lsp.c
index 167c40ba9f..9450ce66fb 100644
--- a/epan/dissectors/packet-db-lsp.c
+++ b/epan/dissectors/packet-db-lsp.c
@@ -81,8 +81,8 @@ static const value_string op_vals[] = {
{ 0, NULL }
};
-static void
-dissect_db_lsp_pdu (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_db_lsp_pdu (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *db_lsp_tree;
proto_item *db_lsp_item;
@@ -116,7 +116,7 @@ dissect_db_lsp_pdu (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (magic != 0x0301 || length > tvb_length_remaining (tvb, offset)) {
/* Probably an unknown packet */
/* expert_add_info_format (pinfo, db_lsp_item, PI_UNDECODED, PI_WARN, "Unknown packet"); */
- return;
+ return 0;
}
if (type == TYPE_CONFIG) {
@@ -139,6 +139,7 @@ dissect_db_lsp_pdu (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_item_append_text (db_lsp_item, ", Type: %d, Length: %d", type, length);
proto_item_set_len (db_lsp_item, length + 5);
+ return tvb_length(tvb);
}
static guint
@@ -152,11 +153,12 @@ get_db_lsp_pdu_len (packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return tvb_get_ntohs (tvb, offset + 3) + 5;
}
-static void
-dissect_db_lsp_tcp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_db_lsp_tcp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus (tvb, pinfo, tree, db_lsp_desegment, 5,
- get_db_lsp_pdu_len, dissect_db_lsp_pdu);
+ get_db_lsp_pdu_len, dissect_db_lsp_pdu, data);
+ return tvb_length(tvb);
}
static void
@@ -223,7 +225,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);
- register_dissector ("db-lsp.tcp", dissect_db_lsp_tcp, proto_db_lsp);
+ 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);
proto_register_field_array (proto_db_lsp, hf, array_length (hf));
diff --git a/epan/dissectors/packet-dbus.c b/epan/dissectors/packet-dbus.c
index 5bb91b072c..9e5a37acf3 100644
--- a/epan/dissectors/packet-dbus.c
+++ b/epan/dissectors/packet-dbus.c
@@ -612,16 +612,16 @@ get_dbus_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return len_hdr + len_body;
}
-static void
-dissect_dbus_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_dbus_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
- dissect_dbus(tvb, pinfo, tree, NULL);
+ return dissect_dbus(tvb, pinfo, tree, data);
}
static int
-dissect_dbus_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_dbus_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
- tcp_dissect_pdus(tvb, pinfo, tree, dbus_desegment, DBUS_HEADER_LEN, get_dbus_message_len, dissect_dbus_pdu);
+ tcp_dissect_pdus(tvb, pinfo, tree, dbus_desegment, DBUS_HEADER_LEN, get_dbus_message_len, dissect_dbus_pdu, data);
return tvb_length(tvb);
}
diff --git a/epan/dissectors/packet-dhcp-failover.c b/epan/dissectors/packet-dhcp-failover.c
index e1b10e28f3..101cf6ac9a 100644
--- a/epan/dissectors/packet-dhcp-failover.c
+++ b/epan/dissectors/packet-dhcp-failover.c
@@ -361,8 +361,8 @@ get_dhcpfo_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return tvb_get_ntohs(tvb, offset);
}
-static void
-dissect_dhcpfo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_dhcpfo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
int offset = 0;
proto_item *ti, *pi, *oi;
@@ -467,10 +467,10 @@ dissect_dhcpfo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset += 4;
if (bogus_poffset)
- return; /* payload offset was bogus */
+ return offset; /* payload offset was bogus */
if (!tree)
- return;
+ return tvb_length(tvb);
/* if there are any additional header bytes */
if (poffset != offset) {
@@ -481,7 +481,7 @@ dissect_dhcpfo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* payload-data */
if (poffset == length)
- return; /* no payload */
+ return length; /* no payload */
/* create display subtree for the payload */
pi = proto_tree_add_item(dhcpfo_tree, hf_dhcpfo_payload_data,
tvb, poffset, length-poffset, ENC_NA);
@@ -871,13 +871,16 @@ dissect_dhcpfo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset += option_length;
}
+
+ return tvb_length(tvb);
}
-static void
-dissect_dhcpfo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_dhcpfo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, dhcpfo_desegment, 2,
- get_dhcpfo_pdu_len, dissect_dhcpfo_pdu);
+ get_dhcpfo_pdu_len, dissect_dhcpfo_pdu, data);
+ return tvb_length(tvb);
}
/* Register the protocol with Wireshark */
@@ -1158,7 +1161,7 @@ proto_reg_handoff_dhcpfo(void)
static guint saved_tcp_port;
if (!initialized) {
- dhcpfo_handle = create_dissector_handle(dissect_dhcpfo, proto_dhcpfo);
+ dhcpfo_handle = new_create_dissector_handle(dissect_dhcpfo, proto_dhcpfo);
initialized = TRUE;
} else {
dissector_delete_uint("tcp.port", saved_tcp_port, dhcpfo_handle);
diff --git a/epan/dissectors/packet-dhcpv6.c b/epan/dissectors/packet-dhcpv6.c
index a3bd95892b..0b3278a92b 100644
--- a/epan/dissectors/packet-dhcpv6.c
+++ b/epan/dissectors/packet-dhcpv6.c
@@ -2116,8 +2116,8 @@ get_dhcpv6_bulk_leasequery_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int of
return (tvb_get_ntohs(tvb, offset)+2);
}
-static void
-dissect_dhcpv6_bulk_leasequery_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_dhcpv6_bulk_leasequery_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
proto_tree *bulk_tree, *option_tree;
@@ -2162,13 +2162,16 @@ dissect_dhcpv6_bulk_leasequery_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree
while ((offset < end) && !at_end)
offset += dhcpv6_option(tvb, pinfo, option_tree, FALSE, offset,
end, &at_end, proto_dhcpv6_bulk_leasequery);
+
+ return tvb_length(tvb);
}
-static void
-dissect_dhcpv6_bulk_leasequery(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_dhcpv6_bulk_leasequery(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, dhcpv6_bulk_leasequery_desegment, 2,
- get_dhcpv6_bulk_leasequery_pdu_len, dissect_dhcpv6_bulk_leasequery_pdu);
+ get_dhcpv6_bulk_leasequery_pdu_len, dissect_dhcpv6_bulk_leasequery_pdu, data);
+ return tvb_length(tvb);
}
void
@@ -2521,7 +2524,7 @@ proto_reg_handoff_dhcpv6(void)
dhcpv6_handle = create_dissector_handle(dissect_dhcpv6_upstream,
proto_dhcpv6);
dissector_add_uint("udp.port", UDP_PORT_DHCPV6_UPSTREAM, dhcpv6_handle);
- dhcpv6_bulkquery_handle = create_dissector_handle(dissect_dhcpv6_bulk_leasequery,
+ dhcpv6_bulkquery_handle = new_create_dissector_handle(dissect_dhcpv6_bulk_leasequery,
proto_dhcpv6_bulk_leasequery);
dissector_add_uint("tcp.port", UDP_PORT_DHCPV6_UPSTREAM, dhcpv6_bulkquery_handle);
}
diff --git a/epan/dissectors/packet-diameter.c b/epan/dissectors/packet-diameter.c
index 0776526220..9d98f18167 100644
--- a/epan/dissectors/packet-diameter.c
+++ b/epan/dissectors/packet-diameter.c
@@ -896,8 +896,8 @@ static const char *msgflags_str[] = {
"RP--", "RP-T", "RPE-", "RPET"
};
-static void
-dissect_diameter_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_diameter_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
guint32 first_word = tvb_get_ntohl(tvb,0);
guint32 version = (first_word & 0xff000000) >> 24;
@@ -1137,6 +1137,8 @@ dissect_diameter_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if(have_tap_listener(exported_pdu_tap)){
export_diameter_pdu(pinfo,tvb);
}
+
+ return tvb_length(tvb);
}
static guint
@@ -1166,16 +1168,15 @@ check_diameter(tvbuff_t *tvb)
/************************************************/
/* Main dissection function */
static int
-dissect_diameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_diameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
if (!check_diameter(tvb))
return 0;
- dissect_diameter_common(tvb, pinfo, tree);
- return tvb_length(tvb);
+ return dissect_diameter_common(tvb, pinfo, tree, data);
}
-static void
-dissect_diameter_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_diameter_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
/* Check if we have the start of a PDU or if this is segment */
if (!check_diameter(tvb)) {
@@ -1184,8 +1185,10 @@ dissect_diameter_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
call_dissector(data_handle, tvb, pinfo, tree);
} else {
tcp_dissect_pdus(tvb, pinfo, tree, gbl_diameter_desegment, 4,
- get_diameter_pdu_len, dissect_diameter_common);
+ get_diameter_pdu_len, dissect_diameter_common, data);
}
+
+ return tvb_length(tvb);
}
@@ -1929,7 +1932,7 @@ proto_reg_handoff_diameter(void)
if (!Initialized) {
diameter_sctp_handle = find_dissector("diameter");
- diameter_tcp_handle = create_dissector_handle(dissect_diameter_tcp,
+ diameter_tcp_handle = new_create_dissector_handle(dissect_diameter_tcp,
proto_diameter);
diameter_udp_handle = new_create_dissector_handle(dissect_diameter, proto_diameter);
data_handle = find_dissector("data");
diff --git a/epan/dissectors/packet-disp.c b/epan/dissectors/packet-disp.c
index d7c16da442..5968e7b7f6 100644
--- a/epan/dissectors/packet-disp.c
+++ b/epan/dissectors/packet-disp.c
@@ -69,8 +69,6 @@ static void prefs_register_disp(void); /* forward declaration for use in prefere
/* Initialize the protocol and registered fields */
static int proto_disp = -1;
-static struct SESSION_DATA_STRUCTURE* session = NULL;
-
/*--- Included file: packet-disp-hf.c ---*/
#line 1 "../../asn1/disp/packet-disp-hf.c"
@@ -183,7 +181,7 @@ static int hf_disp_signedShadowError = -1; /* T_signedShadowError */
static int hf_disp_shadowError = -1; /* ShadowErrorData */
/*--- End of included file: packet-disp-hf.c ---*/
-#line 67 "../../asn1/disp/packet-disp-template.c"
+#line 65 "../../asn1/disp/packet-disp-template.c"
/* Initialize the subtree pointers */
static gint ett_disp = -1;
@@ -246,7 +244,7 @@ static gint ett_disp_ShadowError = -1;
static gint ett_disp_T_signedShadowError = -1;
/*--- End of included file: packet-disp-ett.c ---*/
-#line 71 "../../asn1/disp/packet-disp-template.c"
+#line 69 "../../asn1/disp/packet-disp-template.c"
/*--- Included file: packet-disp-fn.c ---*/
@@ -1496,7 +1494,7 @@ static void dissect_ShadowingAgreementInfo_PDU(tvbuff_t *tvb _U_, packet_info *p
/*--- End of included file: packet-disp-fn.c ---*/
-#line 73 "../../asn1/disp/packet-disp-template.c"
+#line 71 "../../asn1/disp/packet-disp-template.c"
/*
* Dissect DISP PDUs inside a ROS PDUs
@@ -1506,8 +1504,9 @@ dissect_disp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
{
int offset = 0;
int old_offset;
- proto_item *item=NULL;
- proto_tree *tree=NULL;
+ proto_item *item;
+ proto_tree *tree;
+ struct SESSION_DATA_STRUCTURE* session;
int (*disp_dissector)(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) = NULL;
const char *disp_op_name;
asn1_ctx_t asn1_ctx;
@@ -1521,14 +1520,15 @@ dissect_disp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
"Internal error: can't get operation information from ROS dissector.");
}
return 0;
- } else {
- session = ((struct SESSION_DATA_STRUCTURE*)data);
}
- if(parent_tree){
- item = proto_tree_add_item(parent_tree, proto_disp, tvb, 0, -1, ENC_NA);
- tree = proto_item_add_subtree(item, ett_disp);
- }
+ session = ((struct SESSION_DATA_STRUCTURE*)data);
+
+ asn1_ctx.private_data = session;
+
+ item = proto_tree_add_item(parent_tree, proto_disp, tvb, 0, -1, ENC_NA);
+ tree = proto_item_add_subtree(item, ett_disp);
+
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DISP");
col_clear(pinfo->cinfo, COL_INFO);
diff --git a/epan/dissectors/packet-dlsw.c b/epan/dissectors/packet-dlsw.c
index 96c35fc463..66b22ebda0 100644
--- a/epan/dissectors/packet-dlsw.c
+++ b/epan/dissectors/packet-dlsw.c
@@ -270,8 +270,8 @@ static const value_string dlsw_refuse_vals[] = {
static void
dissect_dlsw_capex(tvbuff_t *tvb, proto_tree *tree, proto_tree *ti);
-static void
-dissect_dlsw_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_dlsw_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
guint version,hlen = 0,mlen = 0,mtype,dlchlen = 0,flags;
proto_tree *dlsw_tree = NULL, *dlsw_header_tree = NULL;
@@ -360,7 +360,7 @@ dissect_dlsw_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
expert_add_info_format(pinfo, ti, &ei_dlsw_dlc_header_length,
"DLC Header Length = %u (bogus, must be <= message length %u)",dlchlen, mlen) ;
- return;
+ return 44;
}
proto_tree_add_item(dlsw_header_tree, hf_dlsw_origin_dlc_port_id, tvb, 44, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(dlsw_header_tree, hf_dlsw_origin_dlc, tvb, 48, 4, ENC_BIG_ENDIAN);
@@ -404,6 +404,8 @@ dissect_dlsw_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
+
+ return tvb_length(tvb);
}
static void
@@ -495,7 +497,7 @@ dissect_dlsw_capex(tvbuff_t *tvb, proto_tree *tree, proto_tree *ti2)
}
static int
-dissect_dlsw_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_dlsw_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
if (try_val_to_str(tvb_get_guint8(tvb, 0), dlsw_version_vals) == NULL)
{
@@ -503,8 +505,7 @@ dissect_dlsw_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
return 0;
}
- dissect_dlsw_pdu(tvb, pinfo, tree);
- return tvb_length(tvb);
+ return dissect_dlsw_pdu(tvb, pinfo, tree, data);
}
static guint
@@ -529,7 +530,7 @@ get_dlsw_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
}
static int
-dissect_dlsw_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_dlsw_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
if (try_val_to_str(tvb_get_guint8(tvb, 0), dlsw_version_vals) == NULL)
{
@@ -537,7 +538,7 @@ dissect_dlsw_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
return 0;
}
- tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 4, get_dlsw_pdu_len, dissect_dlsw_pdu);
+ tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 4, get_dlsw_pdu_len, dissect_dlsw_pdu, data);
return tvb_length(tvb);
}
diff --git a/epan/dissectors/packet-dnp.c b/epan/dissectors/packet-dnp.c
index cf63879ff6..97d72dfbf2 100644
--- a/epan/dissectors/packet-dnp.c
+++ b/epan/dissectors/packet-dnp.c
@@ -3064,8 +3064,8 @@ dissect_dnp3_al(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/*****************************************************************/
/* Data Link and Transport layer dissector */
/*****************************************************************/
-static void
-dissect_dnp3_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_dnp3_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti, *tdl, *tc;
proto_tree *dnp3_tree, *dl_tree, *field_tree;
@@ -3381,6 +3381,8 @@ dissect_dnp3_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_set_fence(pinfo->cinfo, COL_INFO);
}
}
+
+ return tvb_length(tvb);
}
static guint
@@ -3403,7 +3405,7 @@ get_dnp3_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
}
static gboolean
-dissect_dnp3_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_dnp3_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
gint length = tvb_length(tvb);
@@ -3414,13 +3416,13 @@ dissect_dnp3_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
}
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, DNP_HDR_LEN,
- get_dnp3_message_len, dissect_dnp3_message);
+ get_dnp3_message_len, dissect_dnp3_message, data);
return TRUE;
}
static gboolean
-dissect_dnp3_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_dnp3_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
gint length = tvb_length(tvb);
@@ -3430,7 +3432,7 @@ dissect_dnp3_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
return FALSE;
}
- dissect_dnp3_message(tvb, pinfo, tree);
+ dissect_dnp3_message(tvb, pinfo, tree, data);
return TRUE;
}
diff --git a/epan/dissectors/packet-dns.c b/epan/dissectors/packet-dns.c
index 47a54858b9..463a284c01 100644
--- a/epan/dissectors/packet-dns.c
+++ b/epan/dissectors/packet-dns.c
@@ -3839,19 +3839,21 @@ get_dns_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return plen + 2;
}
-static void
-dissect_dns_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_dns_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DNS");
dissect_dns_common(tvb, pinfo, tree, TRUE, FALSE, FALSE);
+ return tvb_length(tvb);
}
-static void
-dissect_dns_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_dns_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, dns_desegment, 2, get_dns_pdu_len,
- dissect_dns_tcp_pdu);
+ dissect_dns_tcp_pdu, data);
+ return tvb_length(tvb);
}
void
@@ -3868,7 +3870,7 @@ proto_reg_handoff_dns(void)
if (!Initialized) {
dns_udp_handle = create_dissector_handle(dissect_dns_udp, proto_dns);
- dns_tcp_handle = create_dissector_handle(dissect_dns_tcp, proto_dns);
+ dns_tcp_handle = new_create_dissector_handle(dissect_dns_tcp, proto_dns);
Initialized = TRUE;
} else {
diff --git a/epan/dissectors/packet-drda.c b/epan/dissectors/packet-drda.c
index 9d666345e6..0f29ff9207 100644
--- a/epan/dissectors/packet-drda.c
+++ b/epan/dissectors/packet-drda.c
@@ -671,8 +671,8 @@ drda_init(void)
iPreviousFrameNumber = 0;
}
-static void
-dissect_drda(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_drda(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
gint offset = 0;
@@ -788,6 +788,8 @@ dissect_drda(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset += iLength;
}
}
+
+ return tvb_length(tvb);
}
static guint
@@ -800,15 +802,16 @@ get_drda_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return 0;
}
-static void
-dissect_drda_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_drda_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
- tcp_dissect_pdus(tvb, pinfo, tree, drda_desegment, 10, get_drda_pdu_len, dissect_drda);
+ tcp_dissect_pdus(tvb, pinfo, tree, drda_desegment, 10, get_drda_pdu_len, dissect_drda, data);
+ return tvb_length(tvb);
}
static gboolean
-dissect_drda_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_drda_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
conversation_t * conversation;
if (tvb_length(tvb) >= 10)
@@ -824,7 +827,7 @@ dissect_drda_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
conversation_set_dissector(conversation, drda_tcp_handle);
/* Dissect the packet */
- dissect_drda(tvb, pinfo, tree);
+ dissect_drda(tvb, pinfo, tree, data);
return TRUE;
}
}
@@ -957,5 +960,5 @@ void
proto_reg_handoff_drda(void)
{
heur_dissector_add("tcp", dissect_drda_heur, proto_drda);
- drda_tcp_handle = create_dissector_handle(dissect_drda_tcp, proto_drda);
+ drda_tcp_handle = new_create_dissector_handle(dissect_drda_tcp, proto_drda);
}
diff --git a/epan/dissectors/packet-dsi.c b/epan/dissectors/packet-dsi.c
index 18a5d9cf07..a8b2c9fbfc 100644
--- a/epan/dissectors/packet-dsi.c
+++ b/epan/dissectors/packet-dsi.c
@@ -501,8 +501,8 @@ dissect_dsi_reply_get_status(tvbuff_t *tvb, proto_tree *tree, gint offset)
return ofs;
}
-static void
-dissect_dsi_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_dsi_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *dsi_tree;
proto_item *ti;
@@ -598,6 +598,8 @@ dissect_dsi_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
pinfo, dsi_tree);
break;
}
+
+ return tvb_length(tvb);
}
static guint
@@ -626,11 +628,13 @@ get_dsi_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return plen + 16;
}
-static void
-dissect_dsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_dsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, dsi_desegment, 12,
- get_dsi_pdu_len, dissect_dsi_packet);
+ get_dsi_pdu_len, dissect_dsi_packet, data);
+
+ return tvb_length(tvb);
}
void
@@ -880,7 +884,7 @@ proto_reg_handoff_dsi(void)
{
dissector_handle_t dsi_handle;
- dsi_handle = create_dissector_handle(dissect_dsi, proto_dsi);
+ dsi_handle = new_create_dissector_handle(dissect_dsi, proto_dsi);
dissector_add_uint("tcp.port", TCP_PORT_DSI, dsi_handle);
data_handle = find_dissector("data");
diff --git a/epan/dissectors/packet-dtn.c b/epan/dissectors/packet-dtn.c
index e54716732b..ce5c637164 100644
--- a/epan/dissectors/packet-dtn.c
+++ b/epan/dissectors/packet-dtn.c
@@ -1703,8 +1703,8 @@ get_dtn_contact_header_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return len+bytecount+8;
}
-static void
-dissect_dtn_contact_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_dtn_contact_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
proto_tree *conv_proto_tree, *conv_tree, *conv_flag_tree;
@@ -1743,10 +1743,11 @@ dissect_dtn_contact_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ti = proto_tree_add_int(tree, hf_contact_hdr_local_eid_length, tvb, offset, sdnv_length, eid_length);
if(eid_length < 0) {
expert_add_info(pinfo, ti, &ei_bundle_sdnv_length);
- return;
+ return offset;
}
proto_tree_add_item(conv_tree, hf_contact_hdr_local_eid, tvb, sdnv_length + offset, eid_length, ENC_NA|ENC_ASCII);
+ return tvb_length(tvb);
}
static guint
@@ -1786,8 +1787,8 @@ get_tcpcl_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return 0;
}
-static void
-dissect_tcpcl_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_tcpcl_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
guint8 conv_hdr;
int offset = 0;
@@ -1831,7 +1832,7 @@ dissect_tcpcl_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
sub_item = proto_tree_add_int(conv_tree, hf_tcp_convergence_data_segment_length, tvb, 1, sdnv_length, segment_length);
if(segment_length < 0) {
expert_add_info(pinfo, sub_item, &ei_tcp_convergence_segment_length);
- return;
+ return 1;
}
convergence_hdr_size = sdnv_length + 1;
@@ -1876,7 +1877,7 @@ dissect_tcpcl_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if(bundle_size == 0) {
/*Couldn't parse bundle, treat as raw data */
call_dissector(data_handle, new_tvb, pinfo, sub_tree);
- return;
+ return tvb_length(tvb);
}
}
else {
@@ -1933,10 +1934,11 @@ dissect_tcpcl_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
}
+ return tvb_length(tvb);
}
static int
-dissect_tcpcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_tcpcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
guint8 conv_hdr;
int offset, bytecount;
@@ -1988,7 +1990,7 @@ dissect_tcpcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
return 0;
}
- tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 8, get_dtn_contact_header_len, dissect_dtn_contact_header);
+ tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 8, get_dtn_contact_header_len, dissect_dtn_contact_header, data);
return tvb_length(tvb);
}
@@ -1996,7 +1998,7 @@ dissect_tcpcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
return 0;
};
- tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 1, get_tcpcl_pdu_len, dissect_tcpcl_pdu);
+ tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 1, get_tcpcl_pdu_len, dissect_tcpcl_pdu, data);
return tvb_length(tvb);
}
diff --git a/epan/dissectors/packet-edonkey.c b/epan/dissectors/packet-edonkey.c
index d618ed3ab6..55d7c665c4 100644
--- a/epan/dissectors/packet-edonkey.c
+++ b/epan/dissectors/packet-edonkey.c
@@ -2934,7 +2934,7 @@ static guint get_edonkey_tcp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int
return msg_len + EDONKEY_TCP_HEADER_LENGTH;
}
-static void dissect_edonkey_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_edonkey_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
proto_tree *edonkey_tree = NULL, *edonkey_msg_tree = NULL, *emule_zlib_tree = NULL;
@@ -3024,9 +3024,11 @@ static void dissect_edonkey_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tre
}
}
}
+
+ return tvb_length(tvb);
}
-static int dissect_edonkey_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+static int dissect_edonkey_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
guint8 protocol;
@@ -3042,7 +3044,7 @@ static int dissect_edonkey_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
tcp_dissect_pdus(tvb, pinfo, tree, edonkey_desegment,
EDONKEY_TCP_HEADER_LENGTH, get_edonkey_tcp_pdu_len,
- dissect_edonkey_tcp_pdu);
+ dissect_edonkey_tcp_pdu, data);
return tvb_reported_length(tvb);
}
diff --git a/epan/dissectors/packet-enip.c b/epan/dissectors/packet-enip.c
index 420c23c2da..a2c0cdc726 100644
--- a/epan/dissectors/packet-enip.c
+++ b/epan/dissectors/packet-enip.c
@@ -2022,8 +2022,8 @@ get_enip_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
}
/* Code to actually dissect the packets */
-static void
-dissect_enip_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_enip_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
enum enip_packet_type packet_type;
guint16 encap_cmd, encap_data_length;
@@ -2194,10 +2194,12 @@ dissect_enip_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
} /* end of switch() */
} /* end of if( encapsulated data ) */
+
+ return tvb_length(tvb);
} /* end of dissect_enip_pdu() */
static int
-dissect_enip_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_enip_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
guint16 encap_cmd;
@@ -2210,12 +2212,11 @@ dissect_enip_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
if (try_val_to_str(encap_cmd, encap_cmd_vals) == NULL)
return 0; /* not a known command */
- dissect_enip_pdu(tvb, pinfo, tree);
- return tvb_length(tvb);
+ return dissect_enip_pdu(tvb, pinfo, tree, data);
}
static int
-dissect_enip_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_enip_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
guint16 encap_cmd;
@@ -2228,7 +2229,7 @@ dissect_enip_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
if (try_val_to_str(encap_cmd, encap_cmd_vals) == NULL)
return 0; /* not a known command */
- tcp_dissect_pdus(tvb, pinfo, tree, enip_desegment, 4, get_enip_pdu_len, dissect_enip_pdu);
+ tcp_dissect_pdus(tvb, pinfo, tree, enip_desegment, 4, get_enip_pdu_len, dissect_enip_pdu, data);
return tvb_length(tvb);
}
diff --git a/epan/dissectors/packet-erldp.c b/epan/dissectors/packet-erldp.c
index 735507e263..0f18aaa0af 100644
--- a/epan/dissectors/packet-erldp.c
+++ b/epan/dissectors/packet-erldp.c
@@ -474,7 +474,7 @@ static void dissect_erldp_handshake(tvbuff_t *tvb, packet_info *pinfo, proto_tre
}
/*--- dissect_erldp_pdu -------------------------------------------------*/
-static void dissect_erldp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
+static int dissect_erldp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) {
gint offset;
guint32 msg_len;
guint8 type, ctl_op;
@@ -489,7 +489,7 @@ static void dissect_erldp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
if (is_handshake(tvb, 0)) {
dissect_erldp_handshake(tvb, pinfo, erldp_tree);
- return;
+ return tvb_length(tvb);
}
offset = 0;
@@ -500,7 +500,7 @@ static void dissect_erldp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
if (msg_len == 0) {
col_set_str(pinfo->cinfo, COL_INFO, "KEEP_ALIVE");
- return;
+ return offset;
}
type = tvb_get_guint8(tvb, offset);
@@ -526,26 +526,28 @@ static void dissect_erldp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
proto_tree_add_item(erldp_tree, hf_erldp_type, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
col_set_str(pinfo->cinfo, COL_INFO, "unknown header format");
- return;
}
+
+ return tvb_length(tvb);
}
/*--- get_erldp_pdu_len -------------------------------------------------*/
static guint get_erldp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset) {
if (is_handshake(tvb, offset))
return(2 + tvb_get_ntohs(tvb, offset));
- else
- return(4 + tvb_get_ntohl(tvb, offset));
+
+ return(4 + tvb_get_ntohl(tvb, offset));
}
/*--- dissect_erldp -------------------------------------------------*/
-static void
-dissect_erldp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
+static int
+dissect_erldp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) {
tcp_dissect_pdus(tvb, pinfo, tree,
erldp_desegment, /* desegment or not */
4, /* fixed-length part of the PDU */
get_erldp_pdu_len, /* routine to get the length of the PDU */
- dissect_erldp_pdu); /* routine to dissect a PDU */
+ dissect_erldp_pdu, data); /* routine to dissect a PDU */
+ return tvb_length(tvb);
}
/*--- proto_register_erldp ----------------------------------------------*/
@@ -677,7 +679,7 @@ void proto_register_erldp(void) {
/* Register protocol and dissector */
proto_erldp = proto_register_protocol(PNAME, PSNAME, PFNAME);
- erldp_handle = register_dissector(PFNAME, dissect_erldp, proto_erldp);
+ erldp_handle = new_register_dissector(PFNAME, dissect_erldp, proto_erldp);
/* Register fields and subtrees */
proto_register_field_array(proto_erldp, hf, array_length(hf));
diff --git a/epan/dissectors/packet-etch.c b/epan/dissectors/packet-etch.c
index 226422eb54..2588475ee2 100644
--- a/epan/dissectors/packet-etch.c
+++ b/epan/dissectors/packet-etch.c
@@ -716,8 +716,8 @@ get_column_info(tvbuff_t *tvb)
/*
* main dissector function for an etch message
*/
-static void
-dissect_etch_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_etch_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
/* We've a full PDU: 8 bytes + pdu_packetlen bytes */
wmem_strbuf_t *colInfo = NULL;
@@ -758,6 +758,7 @@ dissect_etch_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
read_struct(&offset, tvb, etch_tree, 0);
}
+ return tvb_length(tvb);
}
/*
@@ -775,7 +776,7 @@ get_etch_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
* main dissector function for the etch protocol
*/
static int
-dissect_etch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_etch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
if (tvb_length(tvb) < 4) {
/* Too small for an etch packet. */
@@ -788,7 +789,7 @@ dissect_etch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
}
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 8, get_etch_message_len,
- dissect_etch_message);
+ dissect_etch_message, data);
if (gbl_pdu_counter > 0) {
col_set_writable(pinfo->cinfo, TRUE);
diff --git a/epan/dissectors/packet-fcgi.c b/epan/dissectors/packet-fcgi.c
index 67282b5e48..d468d3d345 100644
--- a/epan/dissectors/packet-fcgi.c
+++ b/epan/dissectors/packet-fcgi.c
@@ -232,8 +232,8 @@ dissect_get_values_result(tvbuff_t *tvb, proto_tree *fcgi_tree, gint offset, gui
return;
}
-static void
-dissect_fcgi_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_fcgi_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
gint offset = 0;
guint8 type;
@@ -321,6 +321,8 @@ dissect_fcgi_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/*offset += plen;*/
}
}
+
+ return tvb_length(tvb);
}
static guint
@@ -329,10 +331,11 @@ get_fcgi_record_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return 8 + tvb_get_ntohs(tvb, offset + 4) + tvb_get_guint8(tvb, offset + 6);
}
-static void
-dissect_fcgi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_fcgi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
- tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 8, get_fcgi_record_len, dissect_fcgi_record);
+ tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 8, get_fcgi_record_len, dissect_fcgi_record, data);
+ return tvb_length(tvb);
}
void
@@ -398,7 +401,7 @@ proto_register_fcgi(void)
10,
&tcp_port);
- fcgi_handle = register_dissector("fcgi", dissect_fcgi, proto_fcgi);
+ fcgi_handle = new_register_dissector("fcgi", dissect_fcgi, proto_fcgi);
}
void
diff --git a/epan/dissectors/packet-ff.c b/epan/dissectors/packet-ff.c
index a1a276b579..0bd5e27fc5 100644
--- a/epan/dissectors/packet-ff.c
+++ b/epan/dissectors/packet-ff.c
@@ -11913,8 +11913,8 @@ dissect_ff_msg_hdr(tvbuff_t *tvb,
-static void
-dissect_ff(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ff(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *sub_tree = NULL;
proto_item *ti = NULL;
@@ -11983,8 +11983,9 @@ dissect_ff(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset, trailer_len, sub_tree, Options);
/*offset += trailer_len;*/
}
-}
+ return tvb_length(tvb);
+}
static guint
@@ -11996,7 +11997,7 @@ get_ff_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
static int
-dissect_ff_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_ff_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
/*
*
@@ -12015,7 +12016,7 @@ dissect_ff_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
*/
tcp_dissect_pdus(tvb, pinfo, tree, ff_desegment,
- 12, get_ff_pdu_len, dissect_ff);
+ 12, get_ff_pdu_len, dissect_ff, data);
return tvb_reported_length(tvb);
}
@@ -12023,7 +12024,7 @@ dissect_ff_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
static int
-dissect_ff_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_ff_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
guint32 length;
@@ -12038,7 +12039,7 @@ dissect_ff_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
(length < 12))
return 0;
- dissect_ff(tvb, pinfo, tree);
+ dissect_ff(tvb, pinfo, tree, data);
return tvb_reported_length(tvb);
}
diff --git a/epan/dissectors/packet-fix.c b/epan/dissectors/packet-fix.c
index 9df65e9bd2..a62df58c50 100644
--- a/epan/dissectors/packet-fix.c
+++ b/epan/dissectors/packet-fix.c
@@ -218,8 +218,8 @@ static int fix_header_len(tvbuff_t *tvb, int offset)
}
/* ---------------------------------------------- */
-static void
-dissect_fix_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_fix_packet(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;
@@ -244,7 +244,7 @@ dissect_fix_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ti = proto_tree_add_item(tree, proto_fix, tvb, 0, -1, ENC_NA);
fix_tree = proto_item_add_subtree(ti, ett_fix);
proto_tree_add_item(fix_tree, hf_fix_data, tvb, 0, -1, ENC_NA);
- return;
+ return tvb_length(tvb);
}
pdu_len = tvb_reported_length(tvb);
@@ -254,20 +254,20 @@ dissect_fix_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* begin string */
ctrla_offset = tvb_find_guint8(tvb, offset, -1, 0x01);
if (ctrla_offset == -1) {
- return;
+ return tvb_length(tvb);
}
offset = ctrla_offset + 1;
/* msg length */
ctrla_offset = tvb_find_guint8(tvb, offset, -1, 0x01);
if (ctrla_offset == -1) {
- return;
+ return tvb_length(tvb);
}
offset = ctrla_offset + 1;
/* msg type */
if (!(tag = fix_param(tvb, offset)) || tag->value_len < 1) {
- return;
+ return tvb_length(tvb);
}
value = tvb_get_string(wmem_packet_scope(), tvb, tag->value_offset, tag->value_len);
@@ -385,7 +385,7 @@ dissect_fix_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tag_str = NULL;
}
- return;
+ return tvb_length(tvb);
}
static guint
@@ -409,23 +409,24 @@ get_fix_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
#define FIX_MIN_LEN 24
-static void
-dissect_fix_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_fix_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, fix_desegment, FIX_MIN_LEN,
- get_fix_pdu_len, dissect_fix_packet);
+ get_fix_pdu_len, dissect_fix_packet, data);
+ return tvb_length(tvb);
}
-static void
-dissect_fix(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_fix(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
- dissect_fix_pdus(tvb, pinfo, tree);
+ return dissect_fix_pdus(tvb, pinfo, tree, data);
}
/* Code to actually dissect the packets */
static gboolean
-dissect_fix_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_fix_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
conversation_t *conv;
@@ -438,7 +439,7 @@ dissect_fix_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
conv = find_or_create_conversation(pinfo);
conversation_set_dissector(conv, fix_handle);
- dissect_fix_pdus(tvb, pinfo, tree);
+ dissect_fix_pdus(tvb, pinfo, tree, data);
return TRUE;
}
@@ -504,7 +505,7 @@ proto_register_fix(void)
"FIX", "fix");
/* Allow dissector to find be found by name. */
- fix_handle = register_dissector("fix", dissect_fix, proto_fix);
+ fix_handle = new_register_dissector("fix", dissect_fix, proto_fix);
proto_register_field_array(proto_fix, hf, array_length(hf));
proto_register_field_array(proto_fix, hf_FIX, array_length(hf_FIX));
diff --git a/epan/dissectors/packet-fmtp.c b/epan/dissectors/packet-fmtp.c
index 2d9e046924..9bbe8d0406 100644
--- a/epan/dissectors/packet-fmtp.c
+++ b/epan/dissectors/packet-fmtp.c
@@ -69,8 +69,8 @@ static const value_string system_message_names[] = {
{ 0, NULL }
};
-static void
-dissect_fmtp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_fmtp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
guint8 packet_type;
guint16 packet_len;
@@ -123,6 +123,8 @@ dissect_fmtp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
next_tvb = tvb_new_subset_remaining(tvb, FMTP_HEADER_LEN);
call_dissector(data_handle, next_tvb, pinfo, fmtp_tree);
}
+
+ return tvb_length(tvb);
}
static guint
@@ -132,7 +134,7 @@ get_fmtp_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
}
static gboolean
-dissect_fmtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_fmtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
/*
* Check that packet looks like FMTP before going further
@@ -148,7 +150,7 @@ dissect_fmtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
return (FALSE);
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, FMTP_HEADER_LEN,
- get_fmtp_message_len, dissect_fmtp_message);
+ get_fmtp_message_len, dissect_fmtp_message, data);
return (TRUE);
}
diff --git a/epan/dissectors/packet-gadu-gadu.c b/epan/dissectors/packet-gadu-gadu.c
index 000ef179ed..ebf688cb84 100644
--- a/epan/dissectors/packet-gadu-gadu.c
+++ b/epan/dissectors/packet-gadu-gadu.c
@@ -1736,8 +1736,8 @@ dissect_gadu_gadu_xml_action(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
return offset + ret;
}
-static void
-dissect_gadu_gadu_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_gadu_gadu_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *gadu_gadu_tree = NULL;
@@ -2008,6 +2008,8 @@ dissect_gadu_gadu_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (tvb_reported_length_remaining(tvb, offset) > 0) {
proto_tree_add_item(gadu_gadu_tree, &hfi_gadu_gadu_data, tvb, offset, -1, ENC_NA);
}
+
+ return tvb_length(tvb);
}
static guint
@@ -2019,7 +2021,7 @@ get_gadu_gadu_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
}
static int
-dissect_gadu_gadu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_gadu_gadu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
if (pinfo->srcport == pinfo->match_uint && pinfo->destport != pinfo->match_uint)
pinfo->p2p_dir = P2P_DIR_RECV;
@@ -2031,7 +2033,7 @@ dissect_gadu_gadu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
col_set_str(pinfo->cinfo, COL_PROTOCOL, "Gadu-Gadu");
col_clear(pinfo->cinfo, COL_INFO);
- tcp_dissect_pdus(tvb, pinfo, tree, gadu_gadu_desegment, 8, get_gadu_gadu_pdu_len, dissect_gadu_gadu_pdu);
+ tcp_dissect_pdus(tvb, pinfo, tree, gadu_gadu_desegment, 8, get_gadu_gadu_pdu_len, dissect_gadu_gadu_pdu, data);
return tvb_length(tvb);
}
diff --git a/epan/dissectors/packet-gearman.c b/epan/dissectors/packet-gearman.c
index 4e482dd17e..5408cfbd78 100644
--- a/epan/dissectors/packet-gearman.c
+++ b/epan/dissectors/packet-gearman.c
@@ -177,8 +177,8 @@ get_gearman_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return tvb_get_ntohl(tvb, offset+8)+GEARMAN_COMMAND_HEADER_SIZE;
}
-static void
-dissect_binary_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_binary_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
gint offset, start_offset;
char *magic_code;
@@ -414,6 +414,7 @@ dissect_binary_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
col_set_fence(pinfo->cinfo, COL_INFO);
+ return tvb_length(tvb);
}
static void
@@ -466,18 +467,20 @@ dissect_management_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
-static void
-dissect_gearman(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_gearman(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
if ((0 == tvb_memeql(tvb, 0, GEARMAN_MAGIC_CODE_REQUEST, 4)) ||
(0 == tvb_memeql(tvb, 0, GEARMAN_MAGIC_CODE_RESPONSE, 4)))
{
- tcp_dissect_pdus(tvb, pinfo, tree, gearman_desegment, GEARMAN_COMMAND_HEADER_SIZE, get_gearman_pdu_len, dissect_binary_packet);
+ tcp_dissect_pdus(tvb, pinfo, tree, gearman_desegment, GEARMAN_COMMAND_HEADER_SIZE, get_gearman_pdu_len, dissect_binary_packet, data);
}
else
{
dissect_management_packet(tvb, pinfo, tree);
}
+
+ return tvb_length(tvb);
}
void
@@ -547,7 +550,7 @@ proto_reg_handoff_gearman(void)
{
dissector_handle_t gearman_handle;
- gearman_handle = create_dissector_handle(dissect_gearman, proto_gearman);
+ gearman_handle = new_create_dissector_handle(dissect_gearman, proto_gearman);
dissector_add_uint("tcp.port", GEARMAN_PORT, gearman_handle);
}
diff --git a/epan/dissectors/packet-ged125.c b/epan/dissectors/packet-ged125.c
index dfd695d7e9..27e5794a9f 100644
--- a/epan/dissectors/packet-ged125.c
+++ b/epan/dissectors/packet-ged125.c
@@ -987,8 +987,8 @@ get_ged125_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, gint offset _U_)
return tvb_get_ntohl(tvb, 0) + 8;
}
-static void
-dissect_ged125_base_messages(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree)
+static int
+dissect_ged125_base_messages(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U_)
{
gint size = tvb_reported_length(tvb);
proto_item *ti, *message_item;
@@ -1233,7 +1233,7 @@ dissect_ged125_base_messages(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree
proto_tree_add_item(ged125_message_tree, hf_ged125_CallID, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
floating_fields(tvb, pinfo, ged125_tree, offset, size);
- return;
+ return tvb_length(tvb);
case GED125_ROUTE_SELECT_VALUE:
proto_tree_add_item(ged125_message_tree, hf_ged125_CrossRefID, tvb, offset, 4, ENC_BIG_ENDIAN);
@@ -1279,10 +1279,11 @@ dissect_ged125_base_messages(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree
}
proto_item_set_len(message_item, offset-8);
+ return tvb_length(tvb);
}
static int
-dissect_ged125(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_ged125(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
gint size;
guint32 message_type;
@@ -1298,11 +1299,8 @@ dissect_ged125(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
if (try_val_to_str(message_type, base_message_values) == NULL)
return 0; /* not a known command */
- if (tree)
- {
- tcp_dissect_pdus(tvb, pinfo, tree, ged125_desegment_body, 4,
- get_ged125_pdu_len, dissect_ged125_base_messages);
- }
+ tcp_dissect_pdus(tvb, pinfo, tree, ged125_desegment_body, 4,
+ get_ged125_pdu_len, dissect_ged125_base_messages, data);
return size;
}
diff --git a/epan/dissectors/packet-giop.c b/epan/dissectors/packet-giop.c
index 1dcdf0de9a..bb752aa901 100644
--- a/epan/dissectors/packet-giop.c
+++ b/epan/dissectors/packet-giop.c
@@ -4652,7 +4652,7 @@ dissect_giop_fragment( tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
/* Main entry point */
-static void dissect_giop_common (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) {
+static int dissect_giop_common (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_) {
guint offset = 0;
MessageHeader header;
tvbuff_t *payload_tvb;
@@ -4715,7 +4715,7 @@ static void dissect_giop_common (tvbuff_t * tvb, packet_info * pinfo, proto_tree
payload_tvb = tvb_new_subset_remaining (tvb, GIOP_HEADER_SIZE);
call_dissector(data_handle,payload_tvb, pinfo, tree);
- return;
+ return tvb_length(tvb);
}
switch (header.GIOP_version.minor)
@@ -4758,7 +4758,7 @@ static void dissect_giop_common (tvbuff_t * tvb, packet_info * pinfo, proto_tree
{
expert_add_info_format(pinfo, ti, &ei_giop_message_size_too_big,
"Message size %u is too big, perhaps it's an endian issue?", message_size);
- return;
+ return 8;
}
if (header.flags & GIOP_MESSAGE_FLAGS_ZIOP_ENABLED)
@@ -4767,7 +4767,7 @@ static void dissect_giop_common (tvbuff_t * tvb, packet_info * pinfo, proto_tree
rem_len = tvb_length_remaining(tvb, GIOP_HEADER_SIZE);
if (rem_len <= 0)
- return;
+ return 8;
payload_tvb = tvb_child_uncompress(tvb, tvb, GIOP_HEADER_SIZE, rem_len);
if (payload_tvb) {
@@ -4775,7 +4775,7 @@ static void dissect_giop_common (tvbuff_t * tvb, packet_info * pinfo, proto_tree
} else {
/* Decompression failed. */
/* XXX: Consider: add expert item ? do data dissection ? */
- return;
+ return 8;
}
} else {
payload_tvb = tvb_new_subset_remaining (tvb, GIOP_HEADER_SIZE);
@@ -4831,6 +4831,7 @@ static void dissect_giop_common (tvbuff_t * tvb, packet_info * pinfo, proto_tree
break;
} /* switch message_type */
+ return tvb_length(tvb);
}
static guint
@@ -4868,23 +4869,25 @@ gboolean dissect_giop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
}
-static void
-dissect_giop_tcp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) {
+static int
+dissect_giop_tcp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data) {
if (tvb_get_ntohl(tvb, 0) != GIOP_MAGIC_NUMBER) {
if ( tvb_memeql(tvb, 0, ZIOP_MAGIC ,4) == 0)
- dissect_ziop_heur(tvb, pinfo, tree, NULL);
+ if (!dissect_ziop_heur(tvb, pinfo, tree, NULL))
+ return 0;
- return;
+ return tvb_length(tvb);
}
tcp_dissect_pdus(tvb, pinfo, tree, giop_desegment, GIOP_HEADER_SIZE,
- get_giop_pdu_len, dissect_giop_common);
+ get_giop_pdu_len, dissect_giop_common, data);
+ return tvb_length(tvb);
}
static gboolean
-dissect_giop_heur (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * data _U_) {
+dissect_giop_heur (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * data) {
guint tot_len;
@@ -4922,11 +4925,11 @@ dissect_giop_heur (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void
/* Set dissector */
conversation_set_dissector(conversation, giop_tcp_handle);
}
- dissect_giop_tcp (tvb, pinfo, tree);
+ dissect_giop_tcp (tvb, pinfo, tree, data);
}
else
{
- dissect_giop_common (tvb, pinfo, tree);
+ dissect_giop_common (tvb, pinfo, tree, data);
}
return TRUE;
@@ -5383,7 +5386,7 @@ proto_register_giop (void)
proto_giop = proto_register_protocol("General Inter-ORB Protocol", "GIOP", "giop");
/* Register by name */
- giop_tcp_handle = register_dissector("giop", dissect_giop_tcp, proto_giop);
+ giop_tcp_handle = new_register_dissector("giop", dissect_giop_tcp, proto_giop);
proto_register_field_array (proto_giop, hf, array_length (hf));
proto_register_subtree_array (ett, array_length (ett));
diff --git a/epan/dissectors/packet-git.c b/epan/dissectors/packet-git.c
index afdc279820..bac4578b7a 100644
--- a/epan/dissectors/packet-git.c
+++ b/epan/dissectors/packet-git.c
@@ -49,7 +49,7 @@ static gint hf_git_packet_terminator = -1;
/* desegmentation of Git over TCP */
static gboolean git_desegment = TRUE;
-static gboolean tvb_get_packet_length(tvbuff_t *tvb, int offset,
+static gboolean get_packet_length(tvbuff_t *tvb, int offset,
guint16 *length)
{
guint8 *lenstr;
@@ -64,19 +64,19 @@ get_git_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
{
guint16 plen;
- if (!tvb_get_packet_length(tvb, offset, &plen))
+ if (!get_packet_length(tvb, offset, &plen))
return 0; /* No idea what this is */
if (plen == 0) {
/* Terminator packet */
return 4;
- } else {
- return plen;
}
+
+ return plen;
}
-static void
-dissect_git_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_git_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *git_tree;
proto_item *ti;
@@ -90,13 +90,13 @@ dissect_git_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ti = proto_tree_add_item(tree, proto_git, tvb, offset, -1, ENC_NA);
git_tree = proto_item_add_subtree(ti, ett_git);
- if (!tvb_get_packet_length(tvb, 0, &plen))
- return;
+ if (!get_packet_length(tvb, 0, &plen))
+ return 0;
if (plen == 0) {
proto_tree_add_uint(git_tree, hf_git_packet_terminator, tvb, offset,
4, plen);
- return;
+ return 4;
}
if (git_tree)
@@ -106,14 +106,17 @@ dissect_git_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_item(git_tree, hf_git_packet_data, tvb, offset+4,
plen-4, ENC_NA);
- }
+ }
+
+ return tvb_length(tvb);
}
-static void
-dissect_git(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_git(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, git_desegment, 4, get_git_pdu_len,
- dissect_git_pdu);
+ dissect_git_pdu, data);
+ return tvb_length(tvb);
}
void
@@ -137,7 +140,7 @@ proto_register_git(void)
module_t *git_module;
proto_git = proto_register_protocol("Git Smart Protocol", "GIT", "git");
- register_dissector("git", dissect_git, proto_git);
+ new_register_dissector("git", dissect_git, proto_git);
proto_register_field_array(proto_git, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
diff --git a/epan/dissectors/packet-gnutella.c b/epan/dissectors/packet-gnutella.c
index a0a281ce3e..df7890dacd 100644
--- a/epan/dissectors/packet-gnutella.c
+++ b/epan/dissectors/packet-gnutella.c
@@ -335,7 +335,7 @@ get_gnutella_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset) {
return GNUTELLA_HEADER_LENGTH + size;
}
-static void dissect_gnutella_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
+static int dissect_gnutella_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) {
proto_item *ti, *hi, *pi;
proto_tree *gnutella_tree = NULL;
@@ -507,10 +507,11 @@ static void dissect_gnutella_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
}
}
+ return tvb_length(tvb);
}
-static void dissect_gnutella(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
+static int dissect_gnutella(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) {
proto_item *ti;
proto_tree *gnutella_tree = NULL;
@@ -553,12 +554,13 @@ static void dissect_gnutella(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
-1,
ENC_NA);
}
- return;
+ return tvb_length(tvb);
}
}
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, GNUTELLA_HEADER_SIZE_OFFSET+4,
- get_gnutella_pdu_len, dissect_gnutella_pdu);
+ get_gnutella_pdu_len, dissect_gnutella_pdu, data);
+ return tvb_length(tvb);
}
void proto_register_gnutella(void) {
@@ -742,7 +744,7 @@ void proto_register_gnutella(void) {
void proto_reg_handoff_gnutella(void) {
dissector_handle_t gnutella_handle;
- gnutella_handle = create_dissector_handle(dissect_gnutella,
+ gnutella_handle = new_create_dissector_handle(dissect_gnutella,
proto_gnutella);
dissector_add_uint("tcp.port", GNUTELLA_TCP_PORT, gnutella_handle);
}
diff --git a/epan/dissectors/packet-hartip.c b/epan/dissectors/packet-hartip.c
index c33cd8ccc0..7aab582c57 100644
--- a/epan/dissectors/packet-hartip.c
+++ b/epan/dissectors/packet-hartip.c
@@ -950,21 +950,21 @@ get_dissect_hartip_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return tvb_get_ntohs(tvb, offset+6);
}
-static void
-dissect_hartip_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_hartip_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
- dissect_hartip_common(tvb, pinfo, tree, 0);
+ return dissect_hartip_common(tvb, pinfo, tree, 0);
}
static int
dissect_hartip_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
- void *data _U_)
+ void *data)
{
if (!tvb_bytes_exist(tvb, 0, HARTIP_HEADER_LENGTH))
return 0;
tcp_dissect_pdus(tvb, pinfo, tree, hartip_desegment, HARTIP_HEADER_LENGTH,
- get_dissect_hartip_len, dissect_hartip_pdu);
+ get_dissect_hartip_len, dissect_hartip_pdu, data);
return tvb_reported_length(tvb);
}
diff --git a/epan/dissectors/packet-hazelcast.c b/epan/dissectors/packet-hazelcast.c
index 8fb7ac98b4..73533e5c5b 100644
--- a/epan/dissectors/packet-hazelcast.c
+++ b/epan/dissectors/packet-hazelcast.c
@@ -93,10 +93,6 @@ static int hf_hazelcast_flags_lockAddrNull = -1;
static gint ett_hazelcast = -1;
static gint ett_hazelcast_flags = -1;
-static guint get_hazelcast_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset);
-static void dissect_hazelcast_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-
-
/* prefs */
static gboolean hazelcast_desegment = TRUE;
static guint gPORT_PREF = 5701;
@@ -239,18 +235,6 @@ static value_string_ext responseTypes_ext = VALUE_STRING_EXT_INIT(responseTypes)
-/*
- * Code to actually dissect the packets
- *
- * this really just works in TCP reassembly and calls the real dissector
- *
-*/
-static void dissect_hazelcast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
-
- tcp_dissect_pdus(tvb, pinfo, tree, hazelcast_desegment, 13, get_hazelcast_message_len, dissect_hazelcast_message);
-
-}
-
/* Get the length of a single HAZELCAST message */
static guint get_hazelcast_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset) {
@@ -271,8 +255,7 @@ static guint get_hazelcast_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, in
}
-
-static void dissect_hazelcast_message(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) {
+static int dissect_hazelcast_message(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) {
guint8 version;
@@ -310,13 +293,13 @@ static void dissect_hazelcast_message(tvbuff_t *tvb, packet_info *pinfo _U_, pro
}
if (tvb_length_remaining(tvb, 0) < 13) {
col_set_str(pinfo->cinfo, COL_INFO, "Hazelcast too short");
- return;
+ return 0;
}
version = tvb_get_guint8(tvb, 12);
if ( version != 6 ) {
col_set_str(pinfo->cinfo, COL_INFO, "Hazelcast unsupported version");
- return;
+ return 12;
}
proto_tree_add_item(hcast_tree, hf_hazelcast_headerLength, tvb, offset, 4, ENC_BIG_ENDIAN);
@@ -439,7 +422,19 @@ static void dissect_hazelcast_message(tvbuff_t *tvb, packet_info *pinfo _U_, pro
/*offset += valueLength;*/
}
+ return tvb_length(tvb);
+}
+
+/*
+ * Code to actually dissect the packets
+ *
+ * this really just works in TCP reassembly and calls the real dissector
+ *
+*/
+static int dissect_hazelcast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) {
+ tcp_dissect_pdus(tvb, pinfo, tree, hazelcast_desegment, 13, get_hazelcast_message_len, dissect_hazelcast_message, data);
+ return tvb_length(tvb);
}
void proto_register_hazelcast(void) {
@@ -592,7 +587,7 @@ proto_reg_handoff_hazelcast(void) {
static int currentPort;
if (!initialized) {
- hazelcast_handle = create_dissector_handle(dissect_hazelcast, proto_hazelcast);
+ hazelcast_handle = new_create_dissector_handle(dissect_hazelcast, proto_hazelcast);
initialized = TRUE;
} else {
dissector_delete_uint("tcp.port", currentPort, hazelcast_handle);
diff --git a/epan/dissectors/packet-hdfs.c b/epan/dissectors/packet-hdfs.c
index 3ceea4d5b9..b96427a10e 100644
--- a/epan/dissectors/packet-hdfs.c
+++ b/epan/dissectors/packet-hdfs.c
@@ -524,8 +524,8 @@ dissect_resp_locatedblocks (tvbuff_t *tvb, proto_tree *hdfs_tree, int offset) {
}
-static void
-dissect_hdfs_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_hdfs_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
guint offset = 0;
int success = 0;
@@ -556,7 +556,7 @@ dissect_hdfs_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset += 4;
if (success != 0) {
- return;
+ return offset;
}
if (!tvb_memeql(tvb, offset + 2, "long", 4)) {
@@ -653,6 +653,7 @@ dissect_hdfs_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
}
+ return tvb_length(tvb);
}
/* determine PDU length of protocol */
@@ -668,8 +669,8 @@ static guint get_hdfs_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int off
}
-static void
-dissect_hdfs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_hdfs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
int frame_header_len = 0;
gboolean need_reassemble = FALSE;
@@ -680,8 +681,8 @@ dissect_hdfs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
need_reassemble = TRUE;
}
-
- tcp_dissect_pdus(tvb, pinfo, tree, need_reassemble, frame_header_len, get_hdfs_message_len, dissect_hdfs_message);
+ tcp_dissect_pdus(tvb, pinfo, tree, need_reassemble, frame_header_len, get_hdfs_message_len, dissect_hdfs_message, data);
+ return tvb_length(tvb);
}
/* registers the protcol with the given names */
@@ -1061,7 +1062,7 @@ proto_register_hdfs(void)
10,
&tcp_port);
- hdfs_handle = register_dissector("hdfs", dissect_hdfs, proto_hdfs);
+ hdfs_handle = new_register_dissector("hdfs", dissect_hdfs, proto_hdfs);
}
/* registers handoff */
diff --git a/epan/dissectors/packet-hdfsdata.c b/epan/dissectors/packet-hdfsdata.c
index f0d72d9689..a3f0ba7958 100644
--- a/epan/dissectors/packet-hdfsdata.c
+++ b/epan/dissectors/packet-hdfsdata.c
@@ -400,8 +400,8 @@ get_hdfsdata_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
}
/* This method dissects fully reassembled messages */
-static void
-dissect_hdfsdata_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_hdfsdata_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
int offset = 0;
@@ -487,10 +487,12 @@ dissect_hdfsdata_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
}
+
+ return tvb_length(tvb);
}
-static void
-dissect_hdfsdata(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_hdfsdata(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
int frame_header_len = 0;
@@ -522,7 +524,8 @@ dissect_hdfsdata(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
frame_header_len = WRITE_REQ_HEAD_LEN;
}
- tcp_dissect_pdus(tvb, pinfo, tree, need_reassemble, frame_header_len, get_hdfsdata_message_len, dissect_hdfsdata_message);
+ tcp_dissect_pdus(tvb, pinfo, tree, need_reassemble, frame_header_len, get_hdfsdata_message_len, dissect_hdfsdata_message, data);
+ return tvb_length(tvb);
}
/* registers the protcol with the given names */
@@ -791,7 +794,7 @@ proto_register_hdfsdata(void)
10,
&tcp_port);
- hdfsdata_handle = register_dissector("hdfsdata", dissect_hdfsdata, proto_hdfsdata);
+ hdfsdata_handle = new_register_dissector("hdfsdata", dissect_hdfsdata, proto_hdfsdata);
}
/* registers handoff */
diff --git a/epan/dissectors/packet-hpfeeds.c b/epan/dissectors/packet-hpfeeds.c
index 2ad91b2a36..cca0855e32 100644
--- a/epan/dissectors/packet-hpfeeds.c
+++ b/epan/dissectors/packet-hpfeeds.c
@@ -248,8 +248,8 @@ get_hpfeeds_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return tvb_get_ntohl(tvb, offset + 0);
}
-static void
-dissect_hpfeeds_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_hpfeeds_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
/* We have already parsed msg length we need to skip to opcode offset */
guint offset = HPFEEDS_OPCODE_OFFSET;
@@ -297,10 +297,12 @@ dissect_hpfeeds_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* block earlier */
}
}
+
+ return tvb_length(tvb);
}
-static void
-dissect_hpfeeds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_hpfeeds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
guint msglen = 0;
guint8 offset = 0;
@@ -309,7 +311,7 @@ dissect_hpfeeds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* At lease header is needed */
if (tvb_reported_length(tvb) < HPFEEDS_HDR_LEN)
- return;
+ return 0;
/* get message length in order to decide if we need to reassemble packet */
msglen = tvb_get_ntohl(tvb, offset);
@@ -325,9 +327,11 @@ dissect_hpfeeds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (tvb_reported_length(tvb) < msglen) {
/* we need to reassemble */
tcp_dissect_pdus(tvb, pinfo, hpfeeds_tree, hpfeeds_desegment, 5,
- get_hpfeeds_pdu_len, dissect_hpfeeds_pdu);
- } else
- dissect_hpfeeds_pdu(tvb, pinfo, hpfeeds_tree);
+ get_hpfeeds_pdu_len, dissect_hpfeeds_pdu, data);
+ return tvb_length(tvb);
+ }
+
+ return dissect_hpfeeds_pdu(tvb, pinfo, hpfeeds_tree, data);
}
void
@@ -457,7 +461,7 @@ proto_reg_handoff_hpfeeds(void)
static gint16 hpfeeds_dissector_port;
if (!hpfeeds_prefs_initialized) {
- hpfeeds_handle = create_dissector_handle(dissect_hpfeeds, proto_hpfeeds);
+ hpfeeds_handle = new_create_dissector_handle(dissect_hpfeeds, proto_hpfeeds);
hpfeeds_prefs_initialized = TRUE;
}
else {
diff --git a/epan/dissectors/packet-http2.c b/epan/dissectors/packet-http2.c
index 951b578672..2c36d4f08a 100644
--- a/epan/dissectors/packet-http2.c
+++ b/epan/dissectors/packet-http2.c
@@ -430,8 +430,8 @@ dissect_http2_continuation(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *ht
return offset;
}
-static void
-dissect_http2_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
+static int
+dissect_http2_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ )
{
proto_item *ti;
proto_tree *http2_tree;
@@ -474,7 +474,7 @@ dissect_http2_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
proto_item_append_text(ti, ": Magic");
proto_tree_add_item(http2_tree, hf_http2_magic, tvb, offset, MAGIC_FRAME_LENGTH, ENC_ASCII|ENC_NA);
- return;
+ return MAGIC_FRAME_LENGTH;
}
proto_tree_add_item(http2_tree, hf_http2_length, tvb, offset, 2, ENC_NA);
@@ -543,7 +543,7 @@ dissect_http2_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
proto_tree_add_item(http2_tree, hf_http2_unknown, tvb, offset, -1, ENC_NA);
break;
}
- return;
+ return tvb_length(tvb);
}
@@ -559,7 +559,7 @@ static guint get_http2_message_len( packet_info *pinfo _U_, tvbuff_t *tvb, int o
static int
dissect_http2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
- void *data _U_)
+ void *data)
{
proto_item *ti;
proto_tree *http2_tree;
@@ -577,7 +577,7 @@ dissect_http2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
http2_tree = proto_item_add_subtree(ti, ett_http2);
tcp_dissect_pdus(tvb, pinfo, http2_tree, TRUE, FRAME_HEADER_LENGTH,
- get_http2_message_len, dissect_http2_pdu);
+ get_http2_message_len, dissect_http2_pdu, data);
return tvb_length(tvb);
}
diff --git a/epan/dissectors/packet-icep.c b/epan/dissectors/packet-icep.c
index bd65d3a1b0..7c2dd8f85d 100644
--- a/epan/dissectors/packet-icep.c
+++ b/epan/dissectors/packet-icep.c
@@ -921,7 +921,7 @@ static guint get_icep_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return tvb_get_letohl(tvb, offset + 10);
}
-static void dissect_icep_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_icep_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
/* p. 611, chapter 23.3.1:
*
@@ -1021,10 +1021,11 @@ static void dissect_icep_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
expert_add_info_format(pinfo, msg_item, &ei_icep_message_type, "Unknown Message Type: 0x%02x", tvb_get_guint8(tvb, 8));
break;
}
+ return tvb_length(tvb);
}
/* entry point */
-static gboolean dissect_icep_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+static gboolean dissect_icep_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
DBG0("triggered\n");
@@ -1036,12 +1037,12 @@ static gboolean dissect_icep_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
/* start dissecting */
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, ICEP_HEADER_SIZE,
- get_icep_pdu_len, dissect_icep_pdu);
+ get_icep_pdu_len, dissect_icep_pdu, data);
return TRUE;
}
-static gboolean dissect_icep_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+static gboolean dissect_icep_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
DBG0("triggered\n");
@@ -1051,7 +1052,7 @@ static gboolean dissect_icep_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
}
/* start dissecting */
- dissect_icep_pdu(tvb, pinfo, tree);
+ dissect_icep_pdu(tvb, pinfo, tree, data);
return TRUE;
}
diff --git a/epan/dissectors/packet-idmp.c b/epan/dissectors/packet-idmp.c
index 6ab14f31e1..bfc95a309f 100644
--- a/epan/dissectors/packet-idmp.c
+++ b/epan/dissectors/packet-idmp.c
@@ -628,7 +628,7 @@ register_idmp_protocol_info(const char *oid, const ros_info_t *rinfo, int proto
}
-static void dissect_idmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
+static int dissect_idmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_)
{
int offset = 0;
@@ -715,6 +715,7 @@ static void dissect_idmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_t
dissect_idmp_IDM_PDU(FALSE, tvb, offset, &asn1_ctx, tree, hf_idmp_PDU);
}
+ return tvb_length(tvb);
}
static guint get_idmp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
@@ -726,11 +727,10 @@ static guint get_idmp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return len + 6;
}
-static void dissect_idmp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
+static int dissect_idmp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data)
{
-
- tcp_dissect_pdus(tvb, pinfo, parent_tree, idmp_desegment, 0, get_idmp_pdu_len, dissect_idmp);
-
+ tcp_dissect_pdus(tvb, pinfo, parent_tree, idmp_desegment, 0, get_idmp_pdu_len, dissect_idmp, data);
+ return tvb_length(tvb);
}
static void idmp_reassemble_init (void)
@@ -963,7 +963,7 @@ void proto_register_idmp(void)
proto_register_field_array(proto_idmp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
- register_dissector("idmp", dissect_idmp_tcp, proto_idmp);
+ new_register_dissector("idmp", dissect_idmp_tcp, proto_idmp);
register_init_routine (&idmp_reassemble_init);
diff --git a/epan/dissectors/packet-iec104.c b/epan/dissectors/packet-iec104.c
index 454e7f1c83..f9e17705f8 100644
--- a/epan/dissectors/packet-iec104.c
+++ b/epan/dissectors/packet-iec104.c
@@ -1348,7 +1348,7 @@ static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
/* Is is called twice: For 'Packet List' and for 'Packet Details' */
-static void dissect_iec104apci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_iec104apci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
guint TcpLen = tvb_reported_length(tvb);
guint8 Start, len, type, temp8;
@@ -1383,7 +1383,7 @@ static void dissect_iec104apci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
if (len < APDU_MIN_LEN) {
expert_add_info_format(pinfo, ti, &ei_iec104_apdu_min_len, "APDU less than %d bytes", APDU_MIN_LEN);
wmem_strbuf_append_printf(res, "<ERR ApduLen=%u bytes> ", len);
- return;
+ return tvb_length(tvb);
}
temp8 = tvb_get_guint8(tvb, Off + 2);
@@ -1439,18 +1439,19 @@ static void dissect_iec104apci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
if (Start != APCI_START) {
/* Everything is bad (no APCI found) */
proto_tree_add_item(it104tree, hf_apcidata, tvb, 0, Off, ENC_NA);
- return;
}
+ return tvb_length(tvb);
}
-static void dissect_iec104reas(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_iec104reas(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
/* 5th parameter = 6 = minimum bytes received to calculate the length.
* (Not 2 in order to find more APCIs in case of 'noisy' bytes between the APCIs)
*/
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, APCI_LEN,
- get_iec104apdu_len, dissect_iec104apci);
+ get_iec104apdu_len, dissect_iec104apci, data);
+ return tvb_length(tvb);
}
/* The protocol has two subprotocols: Register APCI */
@@ -1798,7 +1799,7 @@ proto_reg_handoff_iec104(void)
{
dissector_handle_t iec104apci_handle;
- iec104apci_handle = create_dissector_handle(dissect_iec104reas, proto_iec104apci);
+ iec104apci_handle = new_create_dissector_handle(dissect_iec104reas, proto_iec104apci);
iec104asdu_handle = create_dissector_handle(dissect_iec104asdu, proto_iec104asdu);
dissector_add_uint("tcp.port", IEC104_PORT, iec104apci_handle);
diff --git a/epan/dissectors/packet-ifcp.c b/epan/dissectors/packet-ifcp.c
index da1dda0d13..74fba22ef3 100644
--- a/epan/dissectors/packet-ifcp.c
+++ b/epan/dissectors/packet-ifcp.c
@@ -307,8 +307,8 @@ dissect_commonflags(tvbuff_t *tvb, int offset, proto_tree *parent_tree)
}
}
-static void
-dissect_ifcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
+static int
+dissect_ifcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_)
{
gint offset = 0, frame_len = 0;
guint8 sof = 0, eof = 0;
@@ -324,7 +324,7 @@ dissect_ifcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
/* verify we have a full header (do we need to do this? */
if(tvb_length(tvb)<iFCP_ENCAP_HEADER_LEN){
- return;
+ return 0;
}
col_set_str(pinfo->cinfo, COL_PROTOCOL, "iFCP");
@@ -492,7 +492,7 @@ dissect_ifcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
call_dissector(data_handle, next_tvb, pinfo, parent_tree);
}
- return;
+ return tvb_length(tvb);
}
static guint
@@ -508,10 +508,11 @@ get_ifcp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return pdu_len;
}
-static void
-dissect_ifcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
+static int
+dissect_ifcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data)
{
- tcp_dissect_pdus(tvb, pinfo, parent_tree, ifcp_desegment, iFCP_MIN_HEADER_LEN, get_ifcp_pdu_len, dissect_ifcp_pdu);
+ tcp_dissect_pdus(tvb, pinfo, parent_tree, ifcp_desegment, iFCP_MIN_HEADER_LEN, get_ifcp_pdu_len, dissect_ifcp_pdu, data);
+ return tvb_length(tvb);
}
@@ -520,20 +521,20 @@ dissect_ifcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
* In this case we will not check the port number for sanity and just
* do as the user said.
*/
-static void
-dissect_ifcp_handle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ifcp_handle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
- dissect_ifcp(tvb, pinfo, tree);
+ return dissect_ifcp(tvb, pinfo, tree, data);
}
static gboolean
-dissect_ifcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_ifcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
if(!ifcp_header_test(tvb, 0)){
return FALSE;
}
- dissect_ifcp(tvb, pinfo, tree);
+ dissect_ifcp(tvb, pinfo, tree, data);
/* our heuristics are so strong that if the heuristics above passed
* and the dissection of the pdu did not cause any exceptions
@@ -660,7 +661,7 @@ proto_reg_handoff_ifcp (void)
{
heur_dissector_add("tcp", dissect_ifcp_heur, proto_ifcp);
- ifcp_handle = create_dissector_handle(dissect_ifcp_handle, proto_ifcp);
+ ifcp_handle = new_create_dissector_handle(dissect_ifcp_handle, proto_ifcp);
dissector_add_handle("tcp.port", ifcp_handle);
data_handle = find_dissector("data");
diff --git a/epan/dissectors/packet-ilp.c b/epan/dissectors/packet-ilp.c
index 5a80683719..7d4eb2febc 100644
--- a/epan/dissectors/packet-ilp.c
+++ b/epan/dissectors/packet-ilp.c
@@ -4081,10 +4081,13 @@ dissect_ilp_ILP_PDU(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, pro
/*--- PDUs ---*/
-static void dissect_ILP_PDU_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
+static int dissect_ILP_PDU_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
+ int offset = 0;
asn1_ctx_t asn1_ctx;
asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, FALSE, pinfo);
- dissect_ilp_ILP_PDU(tvb, 0, &asn1_ctx, tree, hf_ilp_ILP_PDU_PDU);
+ offset = dissect_ilp_ILP_PDU(tvb, offset, &asn1_ctx, tree, hf_ilp_ILP_PDU_PDU);
+ offset += 7; offset >>= 3;
+ return offset;
}
@@ -4099,11 +4102,12 @@ get_ilp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return tvb_get_ntohs(tvb,offset);
}
-static void
-dissect_ilp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ilp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, ilp_desegment, ILP_HEADER_SIZE,
- get_ilp_pdu_len, dissect_ILP_PDU_PDU);
+ get_ilp_pdu_len, dissect_ILP_PDU_PDU, data);
+ return tvb_length(tvb);
}
void proto_reg_handoff_ilp(void);
@@ -5639,7 +5643,7 @@ void proto_register_ilp(void) {
NULL, HFILL }},
/*--- End of included file: packet-ilp-hfarr.c ---*/
-#line 98 "../../asn1/ilp/packet-ilp-template.c"
+#line 99 "../../asn1/ilp/packet-ilp-template.c"
};
/* List of subtrees */
@@ -5785,7 +5789,7 @@ void proto_register_ilp(void) {
&ett_ilp_T_tia801Payload,
/*--- End of included file: packet-ilp-ettarr.c ---*/
-#line 104 "../../asn1/ilp/packet-ilp-template.c"
+#line 105 "../../asn1/ilp/packet-ilp-template.c"
};
module_t *ilp_module;
@@ -5793,7 +5797,7 @@ void proto_register_ilp(void) {
/* Register protocol */
proto_ilp = proto_register_protocol(PNAME, PSNAME, PFNAME);
- register_dissector("ilp", dissect_ilp_tcp, proto_ilp);
+ new_register_dissector("ilp", dissect_ilp_tcp, proto_ilp);
/* Register fields and subtrees */
proto_register_field_array(proto_ilp, hf, array_length(hf));
diff --git a/epan/dissectors/packet-ipdc.c b/epan/dissectors/packet-ipdc.c
index 19ddbf55dd..cd4f6157fa 100644
--- a/epan/dissectors/packet-ipdc.c
+++ b/epan/dissectors/packet-ipdc.c
@@ -695,7 +695,6 @@ static gint ett_ipdc_tag = -1;
static gboolean ipdc_desegment = TRUE;
static guint ipdc_port_pref = TCP_PORT_IPDC;
-static gboolean new_packet = FALSE;
static dissector_handle_t q931_handle;
@@ -711,8 +710,8 @@ get_ipdc_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return raw_len + 4;
}
-static void
-dissect_ipdc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ipdc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
proto_tree *ipdc_tree;
@@ -745,18 +744,12 @@ dissect_ipdc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* short frame... */
if (payload_len < 4)
- return;
+ return 0;
/* clear info column and display send/receive sequence numbers */
- if (new_packet == TRUE) {
- col_clear(pinfo->cinfo, COL_INFO);
- new_packet = FALSE;
- }
col_append_fstr(pinfo->cinfo, COL_INFO, "r=%u s=%u ", nr, ns);
if (payload_len == 4) {
- if (!tree)
- return;
ti = proto_tree_add_item(tree, proto_ipdc, tvb, 0, -1, ENC_NA);
ipdc_tree = proto_item_add_subtree(ti, ett_ipdc);
@@ -764,8 +757,8 @@ dissect_ipdc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_item(ipdc_tree, hf_ipdc_ns, tvb, 1, 1, ENC_BIG_ENDIAN);
proto_tree_add_uint(ipdc_tree, hf_ipdc_payload_len, tvb, 2, 2,
payload_len);
-
- return;
+ col_set_fence(pinfo->cinfo, COL_INFO);
+ return 4;
}
/* IPDC tags present - display message code and trans. ID */
@@ -945,20 +938,23 @@ dissect_ipdc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
} /* switch */
offset += len + 2;
}
+
+ col_set_fence(pinfo->cinfo, COL_INFO);
+ return tvb_length(tvb);
}
-static void
-dissect_ipdc_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ipdc_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
- dissect_ipdc_common(tvb, pinfo, tree);
+ return dissect_ipdc_common(tvb, pinfo, tree, data);
}
-static void
-dissect_ipdc_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ipdc_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
- new_packet = TRUE;
tcp_dissect_pdus(tvb, pinfo, tree, ipdc_desegment, 4,
- get_ipdc_pdu_len, dissect_ipdc_tcp_pdu);
+ get_ipdc_pdu_len, dissect_ipdc_tcp_pdu, data);
+ return tvb_length(tvb);
}
void
@@ -1044,7 +1040,7 @@ proto_reg_handoff_ipdc(void)
ipdc_tcp_handle);
} else {
ipdc_tcp_handle =
- create_dissector_handle(dissect_ipdc_tcp, proto_ipdc);
+ new_create_dissector_handle(dissect_ipdc_tcp, proto_ipdc);
q931_handle = find_dissector("q931");
}
diff --git a/epan/dissectors/packet-isns.c b/epan/dissectors/packet-isns.c
index 4937f22133..da4dc863b2 100644
--- a/epan/dissectors/packet-isns.c
+++ b/epan/dissectors/packet-isns.c
@@ -544,11 +544,18 @@ static gint ett_isns = -1;
/* Code to actually dissect the packets */
-static void
-dissect_isns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_isns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
guint offset = 0;
guint16 function_id;
+ guint packet_len;
+ proto_item *ti;
+ proto_tree *isns_tree;
+ guint16 flags;
+ proto_tree *tt;
+ proto_item *tflags;
+ proto_item *tpayload;
/* Make entries in Protocol column and Info column on summary display */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "iSNS");
@@ -562,13 +569,8 @@ dissect_isns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
val_to_str_ext(function_id, &isns_function_ids_ext,
"Unknown function ID 0x%04x"));
- if (tree) {
- proto_item *ti;
- proto_tree *isns_tree;
- guint16 flags;
- proto_tree *tt;
- proto_item *tflags;
- proto_item *tpayload;
+ if (tree == NULL)
+ return tvb_length(tvb);
/* create display subtree for the protocol */
ti = proto_tree_add_item(tree, proto_isns, tvb, 0, -1, ENC_NA);
@@ -605,7 +607,6 @@ dissect_isns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
switch (function_id)
{
case ISNS_FUNC_HEARTBEAT:
- {
proto_tree_add_item(tt,hf_isns_heartbeat_ipv6_addr, tvb, offset, 16, ENC_NA);
offset += 16;
@@ -621,7 +622,7 @@ dissect_isns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_item(tt,hf_isns_heartbeat_counter, tvb, offset, 4, ENC_BIG_ENDIAN);
/*offset += 4;*/
break;
- }
+
/* Responses */
case ISNS_FUNC_RSP_DEVATTRREG:
case ISNS_FUNC_RSP_DEVATTRQRY:
@@ -639,17 +640,18 @@ dissect_isns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case ISNS_FUNC_RSP_RQSTDOMID:
case ISNS_FUNC_RSP_RLSEDOMID:
case ISNS_FUNC_RSP_GETDOMID:
- {
+
/* Get the Error message of the response */
/* The Error field exists only at the beginning of a message (i.e., in the first PDU */
if(flags&ISNS_FLAGS_FIRST_PDU){
proto_tree_add_item(tt,hf_isns_resp_errorcode, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
}
- /* Fall Thru if there are attributes */
- if (tvb_reported_length_remaining(tvb, offset) == 0)
- return;
- }
+
+ /* Fall Thru if there are attributes */
+ if (tvb_reported_length_remaining(tvb, offset) == 0)
+ return tvb_length(tvb);
+
/* Messages */
case ISNS_FUNC_DEVATTRREG:
case ISNS_FUNC_DEVATTRQRY:
@@ -668,25 +670,20 @@ dissect_isns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case ISNS_FUNC_RLSEDOMID:
case ISNS_FUNC_GETDOMID:
default:
- {
- guint packet_len;
-
/* we can only look at the attributes for the first PDU */
if(!(flags&ISNS_FLAGS_FIRST_PDU)){
- proto_tree_add_text(tt, tvb, offset, -1, "This is not the first PDU. The attributes are not decoded");
- return;
+ proto_tree_add_text(tt, tvb, offset, -1, "This is not the first PDU. The attributes are not decoded");
+ return tvb_length(tvb);
}
- packet_len = tvb_reported_length(tvb);
+ packet_len = tvb_reported_length(tvb);
while( offset < packet_len )
{
- offset = AddAttribute(pinfo, tvb, tt, offset, function_id);
+ offset = AddAttribute(pinfo, tvb, tt, offset, function_id);
}
- }
- }
}
- return;
+ return tvb_length(tvb);
}
static guint
@@ -699,7 +696,7 @@ get_isns_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
}
static int
-dissect_isns_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_isns_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
gint length = tvb_length(tvb);
guint16 isns_protocol_version;
@@ -725,12 +722,12 @@ dissect_isns_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
}
tcp_dissect_pdus(tvb, pinfo, tree, isns_desegment, ISNS_HEADER_SIZE, get_isns_pdu_len,
- dissect_isns_pdu);
+ dissect_isns_pdu, data);
return length;
}
static int
-dissect_isns_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_isns_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
gint length = tvb_length(tvb);
guint16 isns_protocol_version;
@@ -755,7 +752,7 @@ dissect_isns_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
return 0;
}
- dissect_isns_pdu(tvb, pinfo, tree);
+ dissect_isns_pdu(tvb, pinfo, tree, data);
return length;
}
diff --git a/epan/dissectors/packet-kafka.c b/epan/dissectors/packet-kafka.c
index 744003043a..65dd1f3b22 100644
--- a/epan/dissectors/packet-kafka.c
+++ b/epan/dissectors/packet-kafka.c
@@ -777,8 +777,8 @@ dissect_kafka_produce_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
/* MAIN */
-static void
-dissect_kafka(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_kafka(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
proto_tree *kafka_tree;
@@ -882,7 +882,7 @@ dissect_kafka(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (wmem_queue_count(match_queue) == 0) {
col_set_str(pinfo->cinfo, COL_INFO, "Kafka Response (Unknown API, Missing Request)");
/* TODO: expert info, don't have request, can't dissect */
- return;
+ return tvb_length(tvb);
}
matcher = (kafka_query_response_t *) wmem_queue_pop(match_queue);
@@ -922,14 +922,15 @@ dissect_kafka(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
+ return tvb_length(tvb);
}
static int
dissect_kafka_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
- void *data _U_)
+ void *data)
{
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 4,
- get_kafka_pdu_len, dissect_kafka);
+ get_kafka_pdu_len, dissect_kafka, data);
return tvb_length(tvb);
}
diff --git a/epan/dissectors/packet-kdsp.c b/epan/dissectors/packet-kdsp.c
index a9b3dabcf1..beca2ccf4b 100644
--- a/epan/dissectors/packet-kdsp.c
+++ b/epan/dissectors/packet-kdsp.c
@@ -257,8 +257,8 @@ get_kdsp_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
}
/* This method dissects fully reassembled messages */
-static void
-dissect_kdsp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_kdsp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
guint32 offset = 0;
guint32 command, length, numChan, bitmap, cptbitmap;
@@ -538,13 +538,16 @@ dissect_kdsp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
default:
expert_add_info(pinfo, command_item, &ei_kdsp_cmdnum);
}
+
+ return tvb_length(tvb);
}
-static void
-dissect_kdsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_kdsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, FRAME_HEADER_LEN,
- get_kdsp_message_len, dissect_kdsp_message);
+ get_kdsp_message_len, dissect_kdsp_message, data);
+ return tvb_length(tvb);
}
void
@@ -1164,7 +1167,7 @@ proto_reg_handoff_kdsp(void)
if (!initialized) {
- kdsp_handle = create_dissector_handle(dissect_kdsp, proto_kdsp);
+ kdsp_handle = new_create_dissector_handle(dissect_kdsp, proto_kdsp);
dlt_handle = find_dissector("radiotap");
if (dlt_handle)
dissector_add_uint( "kdsp.cpt.dlt", DATALINK_RADIOTAP, dlt_handle);
diff --git a/epan/dissectors/packet-kerberos.c b/epan/dissectors/packet-kerberos.c
index 4e99368006..c7e581e6d3 100644
--- a/epan/dissectors/packet-kerberos.c
+++ b/epan/dissectors/packet-kerberos.c
@@ -4572,15 +4572,13 @@ dissect_krb5_ERROR(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx
-static void dissect_kerberos_tcp(tvbuff_t *tvb, packet_info *pinfo,
- proto_tree *tree);
static gint dissect_kerberos_common(tvbuff_t *tvb, packet_info *pinfo,
proto_tree *tree, gboolean do_col_info,
gboolean do_col_protocol,
gboolean have_rm,
kerberos_callbacks *cb);
-static void dissect_kerberos_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo,
- proto_tree *tree);
+static int dissect_kerberos_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, void* data _U_);
gint
@@ -4637,8 +4635,8 @@ get_krb_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return (pdulen + 4);
}
-static void
-dissect_kerberos_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_kerberos_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
pinfo->fragmented = TRUE;
if (dissect_kerberos_common(tvb, pinfo, tree, TRUE, TRUE, TRUE, NULL) < 0) {
@@ -4648,16 +4646,19 @@ dissect_kerberos_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
col_set_str(pinfo->cinfo, COL_INFO, "Continuation");
}
+
+ return tvb_length(tvb);
}
-static void
-dissect_kerberos_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_kerberos_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
col_set_str(pinfo->cinfo, COL_PROTOCOL, "KRB5");
col_clear(pinfo->cinfo, COL_INFO);
tcp_dissect_pdus(tvb, pinfo, tree, krb_desegment, 4, get_krb_pdu_len,
- dissect_kerberos_tcp_pdu);
+ dissect_kerberos_tcp_pdu, data);
+ return tvb_length(tvb);
}
/*
@@ -5484,7 +5485,7 @@ proto_reg_handoff_kerberos(void)
kerberos_handle_udp = new_create_dissector_handle(dissect_kerberos_udp,
proto_kerberos);
- kerberos_handle_tcp = create_dissector_handle(dissect_kerberos_tcp,
+ kerberos_handle_tcp = new_create_dissector_handle(dissect_kerberos_tcp,
proto_kerberos);
dissector_add_uint("udp.port", UDP_PORT_KERBEROS, kerberos_handle_udp);
dissector_add_uint("tcp.port", TCP_PORT_KERBEROS, kerberos_handle_tcp);
diff --git a/epan/dissectors/packet-knet.c b/epan/dissectors/packet-knet.c
index 24816181c6..4098220888 100644
--- a/epan/dissectors/packet-knet.c
+++ b/epan/dissectors/packet-knet.c
@@ -560,19 +560,21 @@ get_knet_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
* @param tree the parent tree where the dissected data is going to be inserted
*
*/
-static void
-dissect_knet_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_knet_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
dissect_knet(tvb, pinfo, tree, KNET_TCP_PACKET);
+ return tvb_length(tvb);
}
-static void
-dissect_knet_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_knet_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
col_clear(pinfo->cinfo, COL_INFO);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "KNET");
- tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 2, get_knet_pdu_len, dissect_knet_tcp_pdu);
+ tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 2, get_knet_pdu_len, dissect_knet_tcp_pdu, data);
+ return tvb_length(tvb);
}
/**
@@ -754,7 +756,7 @@ proto_register_knet(void)
proto_knet = proto_register_protocol ("kNet Protocol", "KNET", "knet");
knet_handle_sctp = register_dissector("knetsctp", dissect_knet_sctp, proto_knet);
- knet_handle_tcp = register_dissector("knettcp", dissect_knet_tcp, 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_module = prefs_register_protocol(proto_knet, proto_reg_handoff_knet);
diff --git a/epan/dissectors/packet-kpasswd.c b/epan/dissectors/packet-kpasswd.c
index 65f93a390f..7983dd5ff4 100644
--- a/epan/dissectors/packet-kpasswd.c
+++ b/epan/dissectors/packet-kpasswd.c
@@ -256,8 +256,8 @@ dissect_kpasswd_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dissect_kpasswd_common(tvb, pinfo, tree, FALSE);
}
-static void
-dissect_kpasswd_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_kpasswd_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
pinfo->fragmented = TRUE;
if (dissect_kpasswd_common(tvb, pinfo, tree, TRUE) < 0) {
@@ -267,16 +267,17 @@ dissect_kpasswd_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
col_set_str(pinfo->cinfo, COL_INFO, "Continuation");
}
+ return tvb_length(tvb);
}
-static void
-dissect_kpasswd_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_kpasswd_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
col_set_str(pinfo->cinfo, COL_PROTOCOL, "KPASSWD");
col_clear(pinfo->cinfo, COL_INFO);
- tcp_dissect_pdus(tvb, pinfo, tree, kpasswd_desegment, 4, get_krb_pdu_len,
- dissect_kpasswd_tcp_pdu);
+ tcp_dissect_pdus(tvb, pinfo, tree, kpasswd_desegment, 4, get_krb_pdu_len, dissect_kpasswd_tcp_pdu, data);
+ return tvb_length(tvb);
}
void
@@ -341,7 +342,7 @@ proto_reg_handoff_kpasswd(void)
dissector_handle_t kpasswd_handle_tcp;
kpasswd_handle_udp = create_dissector_handle(dissect_kpasswd_udp, proto_kpasswd);
- kpasswd_handle_tcp = create_dissector_handle(dissect_kpasswd_tcp, proto_kpasswd);
+ kpasswd_handle_tcp = new_create_dissector_handle(dissect_kpasswd_tcp, proto_kpasswd);
dissector_add_uint("udp.port", UDP_PORT_KPASSWD, kpasswd_handle_udp);
dissector_add_uint("tcp.port", TCP_PORT_KPASSWD, kpasswd_handle_tcp);
}
diff --git a/epan/dissectors/packet-laplink.c b/epan/dissectors/packet-laplink.c
index 50beae0c75..a44d589484 100644
--- a/epan/dissectors/packet-laplink.c
+++ b/epan/dissectors/packet-laplink.c
@@ -108,8 +108,8 @@ dissect_laplink_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d
}
/* Code to actually dissect the packets - TCP aspects*/
-static void
-dissect_laplink_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_laplink_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
int offset = 0;
int length = 0;
@@ -143,6 +143,7 @@ dissect_laplink_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
+ return tvb_length(tvb);
/* If this protocol has a sub-dissector call it here, see section 1.8 */
}
@@ -157,12 +158,13 @@ get_laplink_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return plen;
}
-static void
-dissect_laplink_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_laplink_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, laplink_desegment,
6, get_laplink_pdu_len,
- dissect_laplink_tcp_pdu);
+ dissect_laplink_tcp_pdu, data);
+ return tvb_length(tvb);
}
@@ -235,7 +237,7 @@ proto_reg_handoff_laplink(void)
dissector_handle_t laplink_udp_handle;
dissector_handle_t laplink_tcp_handle;
- laplink_tcp_handle = create_dissector_handle(dissect_laplink_tcp,
+ laplink_tcp_handle = new_create_dissector_handle(dissect_laplink_tcp,
proto_laplink);
dissector_add_uint("tcp.port", TCP_PORT_LAPLINK, laplink_tcp_handle);
diff --git a/epan/dissectors/packet-ldap.c b/epan/dissectors/packet-ldap.c
index 70f2b4d0e9..82b4892d6d 100644
--- a/epan/dissectors/packet-ldap.c
+++ b/epan/dissectors/packet-ldap.c
@@ -4591,11 +4591,11 @@ get_sasl_ldap_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return tvb_get_ntohl(tvb, offset)+4;
}
-static void
-dissect_sasl_ldap_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_sasl_ldap_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
dissect_ldap_pdu(tvb, pinfo, tree, FALSE);
- return;
+ return tvb_length(tvb);
}
static guint
@@ -4613,11 +4613,11 @@ get_normal_ldap_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return len+data_offset-offset;
}
-static void
-dissect_normal_ldap_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_normal_ldap_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
dissect_ldap_pdu(tvb, pinfo, tree, FALSE);
- return;
+ return tvb_length(tvb);
}
static void
@@ -4754,8 +4754,8 @@ dissect_ldap_guid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
uuid.Data4[6], uuid.Data4[7]);
}
-static void
-dissect_ldap_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ldap_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
guint32 sasl_len;
guint32 ldap_len;
@@ -4808,8 +4808,8 @@ dissect_ldap_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
goto this_was_not_sasl;
}
- tcp_dissect_pdus(tvb, pinfo, tree, ldap_desegment, 4, get_sasl_ldap_pdu_len, dissect_sasl_ldap_pdu);
- return;
+ tcp_dissect_pdus(tvb, pinfo, tree, ldap_desegment, 4, get_sasl_ldap_pdu_len, dissect_sasl_ldap_pdu, data);
+ return tvb_length(tvb);
this_was_not_sasl:
/* check if it is a normal BER encoded LDAP packet
@@ -4858,7 +4858,7 @@ this_was_not_sasl:
* the pdu, but as the smallest pdu can be 7 bytes
* we can use 7.
*/
- tcp_dissect_pdus(tvb, pinfo, tree, ldap_desegment, 7, get_normal_ldap_pdu_len, dissect_normal_ldap_pdu);
+ tcp_dissect_pdus(tvb, pinfo, tree, ldap_desegment, 7, get_normal_ldap_pdu_len, dissect_normal_ldap_pdu, data);
goto end;
@@ -4889,16 +4889,16 @@ this_was_not_normal_ldap:
dissector_add_uint("tcp.port", tcp_port, ldap_handle);
/* we are done */
- return;
+ return tvb_length(tvb);
}
/* Ok it might be a strange case of SASL still
* It has been seen with Exchange setup to MS AD
* when Exchange pretend that there is SASL but in fact data are still
* in clear*/
if ((sasl_len + 4) == (guint32)tvb_length_remaining(tvb, 0))
- tcp_dissect_pdus(tvb, pinfo, tree, ldap_desegment, 4, get_sasl_ldap_pdu_len, dissect_sasl_ldap_pdu);
+ tcp_dissect_pdus(tvb, pinfo, tree, ldap_desegment, 4, get_sasl_ldap_pdu_len, dissect_sasl_ldap_pdu, data);
end:
- return;
+ return tvb_length(tvb);
}
static void
@@ -5878,7 +5878,7 @@ void proto_register_ldap(void) {
expert_ldap = expert_register_protocol(proto_ldap);
expert_register_field_array(expert_ldap, ei, array_length(ei));
- register_dissector("ldap", dissect_ldap_tcp, proto_ldap);
+ new_register_dissector("ldap", dissect_ldap_tcp, proto_ldap);
ldap_module = prefs_register_protocol(proto_ldap, prefs_register_ldap);
prefs_register_bool_preference(ldap_module, "desegment_ldap_messages",
diff --git a/epan/dissectors/packet-llrp.c b/epan/dissectors/packet-llrp.c
index aa420e58e0..ce8d3ebd07 100644
--- a/epan/dissectors/packet-llrp.c
+++ b/epan/dissectors/packet-llrp.c
@@ -2594,8 +2594,8 @@ dissect_llrp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
/* Code to actually dissect the packets */
-static void
-dissect_llrp_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_llrp_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
proto_tree *llrp_tree;
@@ -2638,6 +2638,8 @@ dissect_llrp_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (try_val_to_str_ext(type, &message_types_ext))
dissect_llrp_message(tvb, pinfo, llrp_tree, type, offset);
+
+ return tvb_length(tvb);
}
/* Determine length of LLRP message */
@@ -2649,11 +2651,12 @@ get_llrp_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
}
/* The main dissecting routine */
-static void
-dissect_llrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_llrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, LLRP_HEADER_LENGTH,
- get_llrp_message_len, dissect_llrp_packet);
+ get_llrp_message_len, dissect_llrp_packet, data);
+ return tvb_length(tvb);
}
void
@@ -3725,7 +3728,7 @@ proto_reg_handoff_llrp(void)
{
dissector_handle_t llrp_handle;
- llrp_handle = create_dissector_handle(dissect_llrp, proto_llrp);
+ llrp_handle = new_create_dissector_handle(dissect_llrp, proto_llrp);
dissector_add_uint("tcp.port", LLRP_PORT, llrp_handle);
}
diff --git a/epan/dissectors/packet-lsc.c b/epan/dissectors/packet-lsc.c
index 4b6bf2d8d1..464ec8fe1c 100644
--- a/epan/dissectors/packet-lsc.c
+++ b/epan/dissectors/packet-lsc.c
@@ -134,8 +134,8 @@ static guint global_lsc_port = 0;
static gint ett_lsc = -1;
/* Code to actually dissect the packets */
-static void
-dissect_lsc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_lsc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
proto_tree *lsc_tree;
@@ -151,7 +151,7 @@ dissect_lsc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (tvb_length(tvb) < LSC_MIN_LEN)
{
col_set_str(pinfo->cinfo, COL_INFO, "[Too short]");
- return;
+ return 0;
}
/* Get the op code */
@@ -272,13 +272,15 @@ dissect_lsc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
}
}
+
+ return tvb_length(tvb);
}
/* Decode LSC over UDP */
-static void
-dissect_lsc_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_lsc_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
- dissect_lsc_common(tvb, pinfo, tree);
+ return dissect_lsc_common(tvb, pinfo, tree, data);
}
/* Determine length of LSC message */
@@ -330,11 +332,12 @@ get_lsc_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
}
/* Decode LSC over TCP */
-static void
-dissect_lsc_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_lsc_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, LSC_OPCODE_LEN, get_lsc_pdu_len,
- dissect_lsc_common);
+ dissect_lsc_common, data);
+ return tvb_length(tvb);
}
/* Register the protocol with Wireshark */
@@ -434,8 +437,8 @@ proto_reg_handoff_lsc(void)
static guint saved_lsc_port;
if (!initialized) {
- lsc_udp_handle = create_dissector_handle(dissect_lsc_udp, proto_lsc);
- lsc_tcp_handle = create_dissector_handle(dissect_lsc_tcp, proto_lsc);
+ lsc_udp_handle = new_create_dissector_handle(dissect_lsc_udp, proto_lsc);
+ lsc_tcp_handle = new_create_dissector_handle(dissect_lsc_tcp, proto_lsc);
dissector_add_handle("udp.port", lsc_udp_handle); /* for 'decode-as' */
dissector_add_handle("tcp.port", lsc_tcp_handle); /* ... */
initialized = TRUE;
diff --git a/epan/dissectors/packet-mbtcp.c b/epan/dissectors/packet-mbtcp.c
index 51194ec3e8..873fa834f3 100644
--- a/epan/dissectors/packet-mbtcp.c
+++ b/epan/dissectors/packet-mbtcp.c
@@ -367,8 +367,8 @@ static const enum_val_t mbus_register_addr_type[] = {
};
/* Code to dissect Modbus/TCP packets */
-static void
-dissect_mbtcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_mbtcp_pdu(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 *mi;
@@ -497,11 +497,12 @@ dissect_mbtcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
p_remove_proto_data(pinfo->fd, proto_modbus, 0);
p_add_proto_data(pinfo->fd, proto_modbus, 0, p_save_proto_data);
+ return tvb_length(tvb);
}
/* Code to dissect Modbus RTU over TCP packets */
-static void
-dissect_mbrtu_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_mbrtu_pdu(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 *mi, *crc_item;
@@ -638,6 +639,7 @@ dissect_mbrtu_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
p_remove_proto_data(pinfo->fd, proto_modbus, 0);
p_add_proto_data(pinfo->fd, proto_modbus, 0, p_save_proto_data);
+ return tvb_length(tvb);
}
@@ -671,7 +673,7 @@ get_mbrtu_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset _U_)
/* Code to dissect Modbus/TCP messages */
static int
-dissect_mbtcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_mbtcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
/* Make sure there's at least enough data to determine it's a Modbus TCP packet */
@@ -690,14 +692,14 @@ dissect_mbtcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
/* build up protocol tree and iterate over multiple packets */
tcp_dissect_pdus(tvb, pinfo, tree, mbtcp_desegment, 6,
- get_mbtcp_pdu_len, dissect_mbtcp_pdu);
+ get_mbtcp_pdu_len, dissect_mbtcp_pdu, data);
return tvb_length(tvb);
}
/* Code to dissect Modbus RTU over TCP messages */
static int
-dissect_mbrtu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_mbrtu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
/* Make sure there's at least enough data to determine it's a Modbus packet */
@@ -711,7 +713,7 @@ dissect_mbrtu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
/* build up protocol tree and iterate over multiple packets */
tcp_dissect_pdus(tvb, pinfo, tree, mbrtu_desegment, 6,
- get_mbrtu_pdu_len, dissect_mbrtu_pdu);
+ get_mbrtu_pdu_len, dissect_mbrtu_pdu, data);
return tvb_length(tvb);
}
diff --git a/epan/dissectors/packet-memcache.c b/epan/dissectors/packet-memcache.c
index d2ae8f7b3d..39aeb6e39b 100644
--- a/epan/dissectors/packet-memcache.c
+++ b/epan/dissectors/packet-memcache.c
@@ -507,8 +507,8 @@ dissect_value (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
}
-static void
-dissect_memcache (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_memcache (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *memcache_tree;
proto_item *memcache_item, *ti;
@@ -610,6 +610,8 @@ dissect_memcache (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
val_to_str (opcode, opcode_vals, "Opcode %d"),
val_to_str_const (status, status_vals, "Unknown"), status);
}
+
+ return tvb_length(tvb);
}
/* Obtain the content length by peeping into the header.
@@ -1904,8 +1906,8 @@ dissect_memcache_text (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
/* Dissect tcp packets based on the type of protocol (text/binary) */
-static void
-dissect_memcache_tcp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_memcache_tcp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
gint offset = 0;
guint8 magic;
@@ -1914,15 +1916,17 @@ dissect_memcache_tcp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (try_val_to_str (magic, magic_vals) != NULL) {
tcp_dissect_pdus (tvb, pinfo, tree, memcache_desegment_body, 12,
- get_memcache_pdu_len, dissect_memcache);
+ get_memcache_pdu_len, dissect_memcache, data);
} else {
dissect_memcache_text (tvb, pinfo, tree);
}
+
+ return tvb_length(tvb);
}
/* Dissect udp packets based on the type of protocol (text/binary) */
-static void
-dissect_memcache_udp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_memcache_udp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
gint offset = 0;
guint8 magic;
@@ -1930,10 +1934,12 @@ dissect_memcache_udp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
magic = tvb_get_guint8 (tvb, offset);
if (try_val_to_str (magic, magic_vals) != NULL) {
- dissect_memcache (tvb, pinfo, tree);
+ dissect_memcache (tvb, pinfo, tree, data);
} else {
dissect_memcache_message (tvb, 0, pinfo, tree);
}
+
+ return tvb_length(tvb);
}
/* Registration functions; register memcache protocol,
@@ -2118,8 +2124,8 @@ proto_register_memcache (void)
expert_module_t *expert_memcache;
proto_memcache = proto_register_protocol (PNAME, PSNAME, PFNAME);
- memcache_tcp_handle = register_dissector ("memcache.tcp", dissect_memcache_tcp, proto_memcache);
- memcache_udp_handle = register_dissector ("memcache.udp", dissect_memcache_udp, proto_memcache);
+ memcache_tcp_handle = new_register_dissector ("memcache.tcp", dissect_memcache_tcp, proto_memcache);
+ memcache_udp_handle = new_register_dissector ("memcache.udp", dissect_memcache_udp, proto_memcache);
proto_register_field_array (proto_memcache, hf, array_length (hf));
proto_register_subtree_array (ett, array_length (ett));
diff --git a/epan/dissectors/packet-mongo.c b/epan/dissectors/packet-mongo.c
index 68fc45c644..2ae5e19935 100644
--- a/epan/dissectors/packet-mongo.c
+++ b/epan/dissectors/packet-mongo.c
@@ -578,17 +578,14 @@ dissect_mongo_kill_cursors(tvbuff_t *tvb, guint offset, proto_tree *tree)
}
return offset;
}
-static void
-dissect_mongo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_mongo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
+ proto_item *ti;
+ proto_tree *mongo_tree;
+ guint offset = 0, opcode;
- proto_item *ti;
- proto_tree *mongo_tree;
- guint offset = 0, opcode;
-
- col_set_str(pinfo->cinfo, COL_PROTOCOL, "MONGO");
-
- if (tree) {
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "MONGO");
ti = proto_tree_add_item(tree, proto_mongo, tvb, 0, -1, ENC_NA);
@@ -652,8 +649,8 @@ dissect_mongo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ti = proto_tree_add_item(mongo_tree, hf_mongo_unknown, tvb, offset, -1, ENC_NA);
expert_add_info(pinfo, ti, &ei_mongo_unknown);
}
- }
+ return tvb_length(tvb);
}
static guint
get_mongo_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
@@ -668,10 +665,11 @@ get_mongo_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return plen;
}
-static void
-dissect_mongo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_mongo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
- tcp_dissect_pdus(tvb, pinfo, tree, 1, 4, get_mongo_pdu_len, dissect_mongo_pdu);
+ tcp_dissect_pdus(tvb, pinfo, tree, 1, 4, get_mongo_pdu_len, dissect_mongo_pdu, data);
+ return tvb_length(tvb);
}
void
@@ -1059,7 +1057,7 @@ proto_reg_handoff_mongo(void)
if (!initialized) {
- mongo_handle = create_dissector_handle(dissect_mongo, proto_mongo);
+ mongo_handle = new_create_dissector_handle(dissect_mongo, proto_mongo);
initialized = TRUE;
} else {
dissector_delete_uint("tcp.port", currentPort, mongo_handle);
diff --git a/epan/dissectors/packet-mq.c b/epan/dissectors/packet-mq.c
index 8fc793d889..db39d3d834 100644
--- a/epan/dissectors/packet-mq.c
+++ b/epan/dissectors/packet-mq.c
@@ -3574,191 +3574,192 @@ static void dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
-static void reassemble_mq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int reassemble_mq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
+ mq_parm_t mq_parm;
+
/* Reassembly of the MQ messages that span several PDU (several TSH) */
/* Typically a TCP PDU is 1460 bytes and a MQ PDU is 32766 bytes */
- if (tvb_length(tvb) >= 28)
- {
- mq_parm_t mq_parm;
+ if (tvb_length(tvb) < 28)
+ return 0;
- memset(&mq_parm,0,sizeof(mq_parm_t));
- mq_parm.mq_strucID = tvb_get_ntohl(tvb, 0);
+ memset(&mq_parm,0,sizeof(mq_parm_t));
+ mq_parm.mq_strucID = tvb_get_ntohl(tvb, 0);
- if ( (mq_parm.mq_strucID & MQ_MASK_TSHx) == MQ_STRUCTID_TSHx || (mq_parm.mq_strucID & MQ_MASK_TSHx) == MQ_STRUCTID_TSHx_EBCDIC )
+ if ( (mq_parm.mq_strucID & MQ_MASK_TSHx) == MQ_STRUCTID_TSHx || (mq_parm.mq_strucID & MQ_MASK_TSHx) == MQ_STRUCTID_TSHx_EBCDIC )
+ {
+ guint8 iCtlF = 0;
+ gint32 iSegL = 0;
+ gint32 iBegL = 0;
+ gint32 iEnco = 0;
+ gint32 iMulS = 0;
+ gint32 iHdrL = 0;
+ gint32 iNxtP = 0;
+ guint8 iOpcd = 0;
+ gboolean bSeg1st = FALSE;
+ gboolean bSegLst = FALSE;
+ gboolean bMore = FALSE;
+
+ gint32 iHdl = 0;
+ gint32 iGlbMsgIdx = 0;
+ gint32 iSegLength = 0;
+ gint16 iSegmIndex = 0;
+
+ guint32 uStrL = 0;
+ guint32 uPadL = 0;
+
+ /* TSHM structure as 8 bytes more after the length (convid/requestid) */
+ if (mq_parm.mq_strucID == MQ_STRUCTID_TSHM || mq_parm.mq_strucID == MQ_STRUCTID_TSHM_EBCDIC)
+ iMulS=8;
+
+ /* Get the Encoding scheme */
+ iEnco = (tvb_get_guint8(tvb, 8+iMulS) == MQ_LITTLE_ENDIAN ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN);
+ /* Get the Operation Code */
+ iOpcd = tvb_get_guint8(tvb, 9+iMulS);
+ /* Get the Control Flag */
+ iCtlF = tvb_get_guint8(tvb, 10+iMulS);
+ /* Get the Semgnet Length */
+ iSegL = tvb_get_ntohl (tvb, 4);
+ /* First Segment ? */
+ bSeg1st = ((iCtlF & MQ_TCF_FIRST) != 0);
+ /* Last Segment */
+ bSegLst = ((iCtlF & MQ_TCF_LAST) != 0);
+
+ mq_in_reassembly=FALSE;
+
+ if ((iOpcd > 0x80 && !(bSeg1st && bSegLst)) || iOpcd==MQ_TST_ASYNC_MESSAGE)
{
- guint8 iCtlF = 0;
- gint32 iSegL = 0;
- gint32 iBegL = 0;
- gint32 iEnco = 0;
- gint32 iMulS = 0;
- gint32 iHdrL = 0;
- gint32 iNxtP = 0;
- guint8 iOpcd = 0;
- gboolean bSeg1st = FALSE;
- gboolean bSegLst = FALSE;
- gboolean bMore = FALSE;
-
- gint32 iHdl = 0;
- gint32 iGlbMsgIdx = 0;
- gint32 iSegLength = 0;
- gint16 iSegmIndex = 0;
-
- guint32 uStrL = 0;
- guint32 uPadL = 0;
-
- /* TSHM structure as 8 bytes more after the length (convid/requestid) */
- if (mq_parm.mq_strucID == MQ_STRUCTID_TSHM || mq_parm.mq_strucID == MQ_STRUCTID_TSHM_EBCDIC)
- iMulS=8;
-
- /* Get the Encoding scheme */
- iEnco = (tvb_get_guint8(tvb, 8+iMulS) == MQ_LITTLE_ENDIAN ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN);
- /* Get the Operation Code */
- iOpcd = tvb_get_guint8(tvb, 9+iMulS);
- /* Get the Control Flag */
- iCtlF = tvb_get_guint8(tvb, 10+iMulS);
- /* Get the Semgnet Length */
- iSegL = tvb_get_ntohl (tvb, 4);
- /* First Segment ? */
- bSeg1st = ((iCtlF & MQ_TCF_FIRST) != 0);
- /* Last Segment */
- bSegLst = ((iCtlF & MQ_TCF_LAST) != 0);
-
- mq_in_reassembly=FALSE;
-
- if ((iOpcd > 0x80 && !(bSeg1st && bSegLst)) || iOpcd==MQ_TST_ASYNC_MESSAGE)
+ proto_tree* mq_tree = NULL;
+
+ /* Optimisation : only fragmented segments go through the reassembly process */
+ /*
+ It seems that after a PUT on a Queue, when doing a GET, MQ first get
+ a small part of the response (4096 bytes)
+ The response contain the number of bytes returned for this request (ActMsgLen)
+ and the total number of bytes of this reply (TotMsgLen)
+
+ this mean the flow seems to be :
+
+ PUT
+ REQUEST_MSG (MaxLen=4096)
+ ASYNC_MSG (1st/Lst Segment, ActMsgLen=4096, TotMsgLen=279420)
+ as ActMsgLen!=TotMsgLen, this mean the MSG is not complete, we only receive some of 279420 bytes
+ REQUEST_MSG (MaxLen=279420)
+ ASYNC_MSG (1st Segment, SegIndex=0 ActMsgLen=279420, TotMsgLen=279420)
+ ASYNC_MSG (Mid Segment, SegIndex=1)
+ ASYNC_MSG (Mid Segment, SegIndex=2)
+ .
+ ASYNC_MSG (Lst Segment, SegIndex=n)
+ End of reassembling (we have 279420 bytes to decode)
+ */
+
+ if (mq_reassembly)
{
- proto_tree* mq_tree = NULL;
+ fragment_head* fd_head;
+ guint32 iConnectionId = (pinfo->srcport + pinfo->destport);
+ iHdrL=28+iMulS;
+
+ /* Get the MQ Handle of the Object */
+ iHdl = tvb_get_guint32_endian(tvb, iHdrL + 4, iEnco);
+ /* Get the Global Message Index */
+ iGlbMsgIdx = tvb_get_guint32_endian(tvb, iHdrL + 12, iEnco);
+ /* Get the Segment Length */
+ iSegLength = tvb_get_guint32_endian(tvb, iHdrL + 16, iEnco);
+ /* Get the Segment Index */
+ iSegmIndex = tvb_get_guint16_endian(tvb, iHdrL +20, iEnco);
+
+ /*
+ if SegmIndex==0, it has 54 bytes + the length and padding
+ of a variable string at the end of the Header
+ */
+ if (iSegmIndex==0)
+ {
+ uStrL = tvb_get_guint8(tvb,iHdrL+54);
+ uPadL = ((((2+1+uStrL)/4)+1)*4)-(2+1+uStrL);
+ }
+ bMore=!bSegLst;
+ /*
+ First segment has a longer header
+ */
+ iNxtP = iHdrL + ((bSeg1st)?(54 + 1 + uStrL + uPadL):(24));
+ iNxtP += dissect_mq_md(tvb, NULL, iNxtP, &mq_parm, FALSE);
- /* Optimisation : only fragmented segments go through the reassembly process */
/*
- It seems that after a PUT on a Queue, when doing a GET, MQ first get
- a small part of the response (4096 bytes)
- The response contain the number of bytes returned for this request (ActMsgLen)
- and the total number of bytes of this reply (TotMsgLen)
-
- this mean the flow seems to be :
-
- PUT
- REQUEST_MSG (MaxLen=4096)
- ASYNC_MSG (1st/Lst Segment, ActMsgLen=4096, TotMsgLen=279420)
- as ActMsgLen!=TotMsgLen, this mean the MSG is not complete, we only receive some of 279420 bytes
- REQUEST_MSG (MaxLen=279420)
- ASYNC_MSG (1st Segment, SegIndex=0 ActMsgLen=279420, TotMsgLen=279420)
- ASYNC_MSG (Mid Segment, SegIndex=1)
- ASYNC_MSG (Mid Segment, SegIndex=2)
- .
- ASYNC_MSG (Lst Segment, SegIndex=n)
- End of reassembling (we have 279420 bytes to decode)
+ if it is the 1st Segment, it means we are
+ of the beginning of a reassembling. We must take the whole segment (with tSHM, and headers)
*/
+ iBegL = (bSeg1st)?0:iNxtP;
+
+ fd_head = fragment_add_seq_next(&mq_reassembly_table,
+ tvb, iBegL,
+ pinfo, iConnectionId, NULL,
+ iSegL - iBegL, bMore);
- if (mq_reassembly)
+ if (tree)
{
- fragment_head* fd_head;
- guint32 iConnectionId = (pinfo->srcport + pinfo->destport);
- iHdrL=28+iMulS;
-
- /* Get the MQ Handle of the Object */
- iHdl = tvb_get_guint32_endian(tvb, iHdrL + 4, iEnco);
- /* Get the Global Message Index */
- iGlbMsgIdx = tvb_get_guint32_endian(tvb, iHdrL + 12, iEnco);
- /* Get the Segment Length */
- iSegLength = tvb_get_guint32_endian(tvb, iHdrL + 16, iEnco);
- /* Get the Segment Index */
- iSegmIndex = tvb_get_guint16_endian(tvb, iHdrL +20, iEnco);
-
- /*
- if SegmIndex==0, it has 54 bytes + the length and padding
- of a variable string at the end of the Header
- */
- if (iSegmIndex==0)
- {
- uStrL = tvb_get_guint8(tvb,iHdrL+54);
- uPadL = ((((2+1+uStrL)/4)+1)*4)-(2+1+uStrL);
- }
- bMore=!bSegLst;
- /*
- First segment has a longer header
- */
- iNxtP = iHdrL + ((bSeg1st)?(54 + 1 + uStrL + uPadL):(24));
- iNxtP += dissect_mq_md(tvb, NULL, iNxtP, &mq_parm, FALSE);
-
- /*
- if it is the 1st Segment, it means we are
- of the beginning of a reassembling. We must take the whole segment (with tSHM, and headers)
- */
- iBegL = (bSeg1st)?0:iNxtP;
-
- fd_head = fragment_add_seq_next(&mq_reassembly_table,
- tvb, iBegL,
- pinfo, iConnectionId, NULL,
- iSegL - iBegL, bMore);
-
- if (tree)
- {
- proto_item* ti = proto_tree_add_item(tree, proto_mq, tvb, 0, -1, ENC_NA);
- if (bMore)
- proto_item_append_text(ti, " [%s of a Reassembled MQ Segment] Hdl=0x%08x GlbMsgIdx=%d, SegIdx=%d, SegLen=%d",
- val_to_str(iOpcd, mq_opcode_vals, "Unknown (0x%02x)"),
- iHdl, iGlbMsgIdx, iSegmIndex, iSegLength);
- else
- proto_item_append_text(ti, " %s Hdl=0x%08x GlbMsgIdx=%d, SegIdx=%d, SegLen=%d",
- val_to_str(iOpcd, mq_opcode_vals, "Unknown (0x%02x)"),
- iHdl, iGlbMsgIdx, iSegmIndex, iSegLength);
- mq_tree = proto_item_add_subtree(ti, ett_mq_reaasemb);
- }
+ proto_item* ti = proto_tree_add_item(tree, proto_mq, tvb, 0, -1, ENC_NA);
+ if (bMore)
+ proto_item_append_text(ti, " [%s of a Reassembled MQ Segment] Hdl=0x%08x GlbMsgIdx=%d, SegIdx=%d, SegLen=%d",
+ val_to_str(iOpcd, mq_opcode_vals, "Unknown (0x%02x)"),
+ iHdl, iGlbMsgIdx, iSegmIndex, iSegLength);
else
- {
- mq_tree=tree;
- }
+ proto_item_append_text(ti, " %s Hdl=0x%08x GlbMsgIdx=%d, SegIdx=%d, SegLen=%d",
+ val_to_str(iOpcd, mq_opcode_vals, "Unknown (0x%02x)"),
+ iHdl, iGlbMsgIdx, iSegmIndex, iSegLength);
+ mq_tree = proto_item_add_subtree(ti, ett_mq_reaasemb);
+ }
+ else
+ {
+ mq_tree=tree;
+ }
- if (fd_head != NULL && pinfo->fd->num == fd_head->reassembled_in)
- {
- tvbuff_t* next_tvb;
+ if (fd_head != NULL && pinfo->fd->num == fd_head->reassembled_in)
+ {
+ tvbuff_t* next_tvb;
- /* Reassembly finished */
- if (fd_head->next != NULL)
- {
- /* 2 or more fragments */
- next_tvb = tvb_new_chain(tvb, fd_head->tvb_data);
- add_new_data_source(pinfo, next_tvb, "Reassembled MQ");
- }
- else
- {
- /* Only 1 fragment */
- next_tvb = tvb;
- }
- dissect_mq_pdu(next_tvb, pinfo, mq_tree);
- return;
+ /* Reassembly finished */
+ if (fd_head->next != NULL)
+ {
+ /* 2 or more fragments */
+ next_tvb = tvb_new_chain(tvb, fd_head->tvb_data);
+ add_new_data_source(pinfo, next_tvb, "Reassembled MQ");
}
else
{
- mq_in_reassembly=TRUE;
- /* Reassembly in progress */
- col_set_str(pinfo->cinfo, COL_PROTOCOL, "MQ");
- col_add_fstr(pinfo->cinfo, COL_INFO, "[%s of a Reassembled MQ Segment] Hdl=0x%08x GlbMsgIdx=%d, SegIdx=%d, SegLen=%d",
- val_to_str(iOpcd, mq_opcode_vals, "Unknown (0x%02x)"),
- iHdl, iGlbMsgIdx, iSegmIndex, iSegLength);
- dissect_mq_pdu(tvb, pinfo, mq_tree);
- return;
+ /* Only 1 fragment */
+ next_tvb = tvb;
}
+ dissect_mq_pdu(next_tvb, pinfo, mq_tree);
+ return tvb_length(tvb);
}
else
{
+ mq_in_reassembly=TRUE;
+ /* Reassembly in progress */
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "MQ");
+ col_add_fstr(pinfo->cinfo, COL_INFO, "[%s of a Reassembled MQ Segment] Hdl=0x%08x GlbMsgIdx=%d, SegIdx=%d, SegLen=%d",
+ val_to_str(iOpcd, mq_opcode_vals, "Unknown (0x%02x)"),
+ iHdl, iGlbMsgIdx, iSegmIndex, iSegLength);
dissect_mq_pdu(tvb, pinfo, mq_tree);
- if (bSeg1st)
- {
- /* MQ segment is the first of a unreassembled series */
- col_append_str(pinfo->cinfo, COL_INFO, " [Unreassembled MQ]");
- }
- return;
+ return tvb_length(tvb);
}
}
- /* Reassembly not enabled or non-fragmented message */
- dissect_mq_pdu(tvb, pinfo, tree);
- return;
+ else
+ {
+ dissect_mq_pdu(tvb, pinfo, mq_tree);
+ if (bSeg1st)
+ {
+ /* MQ segment is the first of a unreassembled series */
+ col_append_str(pinfo->cinfo, COL_INFO, " [Unreassembled MQ]");
+ }
+ return tvb_length(tvb);
+ }
}
+ /* Reassembly not enabled or non-fragmented message */
+ dissect_mq_pdu(tvb, pinfo, tree);
}
+
+ return tvb_length(tvb);
}
static guint get_mq_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
@@ -3774,9 +3775,10 @@ static guint get_mq_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return 0;
}
-static void dissect_mq_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_mq_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
- tcp_dissect_pdus(tvb, pinfo, tree, mq_desegment, 28, get_mq_pdu_len, reassemble_mq);
+ tcp_dissect_pdus(tvb, pinfo, tree, mq_desegment, 28, get_mq_pdu_len, reassemble_mq, data);
+ return tvb_length(tvb);
}
static void dissect_mq_spx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
@@ -3785,7 +3787,7 @@ static void dissect_mq_spx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dissect_mq_pdu(tvb, pinfo, tree);
}
-static gboolean dissect_mq_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint iProto, void *data _U_)
+static gboolean dissect_mq_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint iProto, void *data)
{
if (tvb_length(tvb) >= 28)
{
@@ -3799,7 +3801,7 @@ static gboolean dissect_mq_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
if (iProto == MQ_XPT_TCP) conversation_set_dissector(conversation, mq_tcp_handle);
/* Dissect the packet */
- reassemble_mq(tvb, pinfo, tree);
+ reassemble_mq(tvb, pinfo, tree, data);
return TRUE;
}
}
@@ -4428,7 +4430,7 @@ void proto_reg_handoff_mq(void)
* class of applications (web browser, e-mail client, ...) and have a very well
* known port number, the MQ applications are most often specific to a business application */
- mq_tcp_handle = create_dissector_handle(dissect_mq_tcp, proto_mq);
+ mq_tcp_handle = new_create_dissector_handle(dissect_mq_tcp, proto_mq);
mq_spx_handle = create_dissector_handle(dissect_mq_spx, proto_mq);
dissector_add_handle("tcp.port", mq_tcp_handle);
diff --git a/epan/dissectors/packet-mrcpv2.c b/epan/dissectors/packet-mrcpv2.c
index 46147f2b4a..a20fff263f 100644
--- a/epan/dissectors/packet-mrcpv2.c
+++ b/epan/dissectors/packet-mrcpv2.c
@@ -957,14 +957,14 @@ get_mrcpv2_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return num_msg_len;
}
-static void
-dissect_mrcpv2_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_mrcpv2_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
- dissect_mrcpv2_common(tvb, pinfo, tree);
+ return dissect_mrcpv2_common(tvb, pinfo, tree);
}
static int
-dissect_mrcpv2_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_mrcpv2_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
gint len;
gint value_size;
@@ -1019,7 +1019,7 @@ dissect_mrcpv2_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
/* if we are here, then we have MRCP v 2.0 protocol, so proceed with the dissection */
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, MRCPV2_MIN_PDU_LEN,
get_mrcpv2_pdu_len,
- dissect_mrcpv2_tcp_pdu);
+ dissect_mrcpv2_tcp_pdu, data);
return len;
}
diff --git a/epan/dissectors/packet-mysql.c b/epan/dissectors/packet-mysql.c
index 200c089c55..7106a4bf67 100644
--- a/epan/dissectors/packet-mysql.c
+++ b/epan/dissectors/packet-mysql.c
@@ -620,13 +620,6 @@ typedef struct mysql_exec_dissector {
} mysql_exec_dissector_t;
/* function prototypes */
-static void dissect_mysql(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-static guint get_mysql_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset);
-static void dissect_mysql_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-static int mysql_dissect_login(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree, mysql_conn_data_t *conn_data);
-static int mysql_dissect_greeting(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree, mysql_conn_data_t *conn_data);
-static int mysql_dissect_request(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree, mysql_conn_data_t *conn_data);
-static int mysql_dissect_response(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree, mysql_conn_data_t *conn_data);
static int mysql_dissect_error_packet(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree);
static int mysql_dissect_ok_packet(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree, mysql_conn_data_t *conn_data);
static int mysql_dissect_server_status(tvbuff_t *tvb, int offset, proto_tree *tree);
@@ -651,6 +644,7 @@ static char mysql_dissect_exec_param(proto_item *req_tree, tvbuff_t *tvb, int *o
static void mysql_dissect_exec_primitive(tvbuff_t *tvb, int *param_offset,
proto_item *field_tree, const int hfindex, const int offset);
static void mysql_dissect_exec_time(tvbuff_t *tvb, int *param_offset, proto_item *field_tree);
+
static gint my_tvb_strsize(tvbuff_t *tvb, int offset);
static int tvb_get_fle(tvbuff_t *tvb, int offset, guint64 *res, guint8 *is_null);
@@ -673,163 +667,6 @@ static const mysql_exec_dissector_t mysql_exec_dissectors[] = {
{ 0x00, 0, NULL },
};
-/* dissector entrypoint, handles TCP-desegmentation */
-static void
-dissect_mysql(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
-{
- tcp_dissect_pdus(tvb, pinfo, tree, mysql_desegment, 3,
- get_mysql_pdu_len, dissect_mysql_pdu);
-}
-
-
-/* dissector helper: length of PDU */
-static guint
-get_mysql_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
-{
- guint plen= tvb_get_letoh24(tvb, offset);
- return plen + 4; /* add length field + packet number */
-}
-
-/* dissector main function: handle one PDU */
-static void
-dissect_mysql_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
-{
- proto_tree *mysql_tree= NULL;
- proto_item *ti;
- conversation_t *conversation;
- int offset = 0;
- guint packet_number;
- gboolean is_response;
- mysql_conn_data_t *conn_data;
-#ifdef CTDEBUG
- mysql_state_t conn_state_in, conn_state_out, frame_state;
- guint64 generation;
- proto_item *pi;
-#endif
- struct mysql_frame_data *mysql_frame_data_p;
-
- /* get conversation, create if necessary*/
- conversation= find_or_create_conversation(pinfo);
-
- /* get associated state information, create if necessary */
- conn_data= (mysql_conn_data_t *)conversation_get_proto_data(conversation, proto_mysql);
- if (!conn_data) {
- conn_data= wmem_new(wmem_file_scope(), mysql_conn_data_t);
- conn_data->srv_caps= 0;
- conn_data->clnt_caps= 0;
- conn_data->clnt_caps_ext= 0;
- conn_data->state= UNDEFINED;
- conn_data->stmts= wmem_tree_new(wmem_file_scope());
-#ifdef CTDEBUG
- conn_data->generation= 0;
-#endif
- conn_data->major_version= 0;
- conversation_add_proto_data(conversation, proto_mysql, conn_data);
- }
-
- mysql_frame_data_p = (struct mysql_frame_data *)p_get_proto_data(pinfo->fd, proto_mysql, 0);
- if (!mysql_frame_data_p) {
- /* We haven't seen this frame before. Store the state of the
- * conversation now so if/when we dissect the frame again
- * we'll start with the same state.
- */
- mysql_frame_data_p = wmem_new(wmem_file_scope(), struct mysql_frame_data);
- mysql_frame_data_p->state = conn_data->state;
- p_add_proto_data(pinfo->fd, proto_mysql, 0, mysql_frame_data_p);
-
- } else if (conn_data->state != FIELD_PACKET && conn_data->state != ROW_PACKET ) {
- /* We have seen this frame before. Set the connection state
- * to whatever state it had the first time we saw this frame
- * (e.g., based on whatever frames came before it).
- * The state may change as we dissect this packet.
- * XXX: I think the logic of the above else if test is as follows:
- * During the first (sequential) dissection pass thru the capture
- * file the conversation connection state as of the beginning of each frame
- * is saved in the connection_state for that frame.
- * Any state changes *within* a mysql "message" (ie: query/response/etc)
- * while processing mysql PDUS (aka "packets") in that message must be preserved.
- * It appears that FIELD_PACKET & ROW_PACKET are the only two
- * state changes which can occur within a mysql message which affect
- * subsequent processing within the message.
- * Question: Does this logic work OK for a reassembled message ?
- */
- conn_data->state= mysql_frame_data_p->state;
- }
-
- if (tree) {
- ti = proto_tree_add_item(tree, proto_mysql, tvb, offset, -1, ENC_NA);
- mysql_tree = proto_item_add_subtree(ti, ett_mysql);
- proto_tree_add_item(mysql_tree, hf_mysql_packet_length, tvb, offset, 3, ENC_LITTLE_ENDIAN);
- }
- offset+= 3;
-
- col_set_str(pinfo->cinfo, COL_PROTOCOL, "MySQL");
-
- if (pinfo->destport == pinfo->match_uint) {
- is_response= FALSE;
- } else {
- is_response= TRUE;
- }
-
- packet_number = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(mysql_tree, hf_mysql_packet_number, tvb, offset, 1, ENC_NA);
- offset += 1;
-
-#ifdef CTDEBUG
- conn_state_in= conn_data->state;
- frame_state = mysql_frame_data_p->state;
- generation= conn_data->generation;
- if (tree) {
- pi= proto_tree_add_text(mysql_tree, tvb, offset, 0, "conversation: %p", conversation);
- PROTO_ITEM_SET_GENERATED(pi);
- pi= proto_tree_add_text(mysql_tree, tvb, offset, 0, "generation: %" G_GINT64_MODIFIER "d", generation);
- PROTO_ITEM_SET_GENERATED(pi);
- pi= proto_tree_add_text(mysql_tree, tvb, offset, 0, "conn state: %s (%u)",
- val_to_str(conn_state_in, state_vals, "Unknown (%u)"),
- conn_state_in);
- PROTO_ITEM_SET_GENERATED(pi);
- pi= proto_tree_add_text(mysql_tree, tvb, offset, 0, "frame state: %s (%u)",
- val_to_str(frame_state, state_vals, "Unknown (%u)"),
- frame_state);
- PROTO_ITEM_SET_GENERATED(pi);
- }
-#endif
-
- if (is_response) {
- if (packet_number == 0) {
- col_set_str(pinfo->cinfo, COL_INFO, "Server Greeting");
- offset = mysql_dissect_greeting(tvb, pinfo, offset, mysql_tree, conn_data);
- } else {
- col_set_str(pinfo->cinfo, COL_INFO, "Response");
- offset = mysql_dissect_response(tvb, pinfo, offset, mysql_tree, conn_data);
- }
- } else {
- if (packet_number == 1) {
- col_set_str(pinfo->cinfo, COL_INFO, "Login Request");
- offset = mysql_dissect_login(tvb, pinfo, offset, mysql_tree, conn_data);
- } else {
- col_set_str(pinfo->cinfo, COL_INFO, "Request");
- offset = mysql_dissect_request(tvb, pinfo, offset, mysql_tree, conn_data);
- }
- }
-
-#ifdef CTDEBUG
- conn_state_out= conn_data->state;
- ++(conn_data->generation);
- pi= proto_tree_add_text(mysql_tree, tvb, offset, 0, "next proto state: %s (%u)",
- val_to_str(conn_state_out, state_vals, "Unknown (%u)"),
- conn_state_out);
- PROTO_ITEM_SET_GENERATED(pi);
-#endif
-
- /* remaining payload indicates an error */
- if (tree && tvb_reported_length_remaining(tvb, offset) > 0) {
- ti = proto_tree_add_item(mysql_tree, hf_mysql_payload, tvb, offset, -1, ENC_NA);
- expert_add_info(pinfo, ti, &ei_mysql_dissector_incomplete);
- }
-}
-
-
static int
mysql_dissect_greeting(tvbuff_t *tvb, packet_info *pinfo, int offset,
proto_tree *tree, mysql_conn_data_t *conn_data)
@@ -1954,6 +1791,164 @@ tvb_get_fle(tvbuff_t *tvb, int offset, guint64 *res, guint8 *is_null)
return 1;
}
+/* dissector helper: length of PDU */
+static guint
+get_mysql_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+{
+ guint plen= tvb_get_letoh24(tvb, offset);
+ return plen + 4; /* add length field + packet number */
+}
+
+/* dissector main function: handle one PDU */
+static int
+dissect_mysql_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
+{
+ proto_tree *mysql_tree= NULL;
+ proto_item *ti;
+ conversation_t *conversation;
+ int offset = 0;
+ guint packet_number;
+ gboolean is_response;
+ mysql_conn_data_t *conn_data;
+#ifdef CTDEBUG
+ mysql_state_t conn_state_in, conn_state_out, frame_state;
+ guint64 generation;
+ proto_item *pi;
+#endif
+ struct mysql_frame_data *mysql_frame_data_p;
+
+ /* get conversation, create if necessary*/
+ conversation= find_or_create_conversation(pinfo);
+
+ /* get associated state information, create if necessary */
+ conn_data= (mysql_conn_data_t *)conversation_get_proto_data(conversation, proto_mysql);
+ if (!conn_data) {
+ conn_data= wmem_new(wmem_file_scope(), mysql_conn_data_t);
+ conn_data->srv_caps= 0;
+ conn_data->clnt_caps= 0;
+ conn_data->clnt_caps_ext= 0;
+ conn_data->state= UNDEFINED;
+ conn_data->stmts= wmem_tree_new(wmem_file_scope());
+#ifdef CTDEBUG
+ conn_data->generation= 0;
+#endif
+ conn_data->major_version= 0;
+ conversation_add_proto_data(conversation, proto_mysql, conn_data);
+ }
+
+ mysql_frame_data_p = (struct mysql_frame_data *)p_get_proto_data(pinfo->fd, proto_mysql, 0);
+ if (!mysql_frame_data_p) {
+ /* We haven't seen this frame before. Store the state of the
+ * conversation now so if/when we dissect the frame again
+ * we'll start with the same state.
+ */
+ mysql_frame_data_p = wmem_new(wmem_file_scope(), struct mysql_frame_data);
+ mysql_frame_data_p->state = conn_data->state;
+ p_add_proto_data(pinfo->fd, proto_mysql, 0, mysql_frame_data_p);
+
+ } else if (conn_data->state != FIELD_PACKET && conn_data->state != ROW_PACKET ) {
+ /* We have seen this frame before. Set the connection state
+ * to whatever state it had the first time we saw this frame
+ * (e.g., based on whatever frames came before it).
+ * The state may change as we dissect this packet.
+ * XXX: I think the logic of the above else if test is as follows:
+ * During the first (sequential) dissection pass thru the capture
+ * file the conversation connection state as of the beginning of each frame
+ * is saved in the connection_state for that frame.
+ * Any state changes *within* a mysql "message" (ie: query/response/etc)
+ * while processing mysql PDUS (aka "packets") in that message must be preserved.
+ * It appears that FIELD_PACKET & ROW_PACKET are the only two
+ * state changes which can occur within a mysql message which affect
+ * subsequent processing within the message.
+ * Question: Does this logic work OK for a reassembled message ?
+ */
+ conn_data->state= mysql_frame_data_p->state;
+ }
+
+ if (tree) {
+ ti = proto_tree_add_item(tree, proto_mysql, tvb, offset, -1, ENC_NA);
+ mysql_tree = proto_item_add_subtree(ti, ett_mysql);
+ proto_tree_add_item(mysql_tree, hf_mysql_packet_length, tvb, offset, 3, ENC_LITTLE_ENDIAN);
+ }
+ offset+= 3;
+
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "MySQL");
+
+ if (pinfo->destport == pinfo->match_uint) {
+ is_response= FALSE;
+ } else {
+ is_response= TRUE;
+ }
+
+ packet_number = tvb_get_guint8(tvb, offset);
+ proto_tree_add_item(mysql_tree, hf_mysql_packet_number, tvb, offset, 1, ENC_NA);
+ offset += 1;
+
+#ifdef CTDEBUG
+ conn_state_in= conn_data->state;
+ frame_state = mysql_frame_data_p->state;
+ generation= conn_data->generation;
+ if (tree) {
+ pi= proto_tree_add_text(mysql_tree, tvb, offset, 0, "conversation: %p", conversation);
+ PROTO_ITEM_SET_GENERATED(pi);
+ pi= proto_tree_add_text(mysql_tree, tvb, offset, 0, "generation: %" G_GINT64_MODIFIER "d", generation);
+ PROTO_ITEM_SET_GENERATED(pi);
+ pi= proto_tree_add_text(mysql_tree, tvb, offset, 0, "conn state: %s (%u)",
+ val_to_str(conn_state_in, state_vals, "Unknown (%u)"),
+ conn_state_in);
+ PROTO_ITEM_SET_GENERATED(pi);
+ pi= proto_tree_add_text(mysql_tree, tvb, offset, 0, "frame state: %s (%u)",
+ val_to_str(frame_state, state_vals, "Unknown (%u)"),
+ frame_state);
+ PROTO_ITEM_SET_GENERATED(pi);
+ }
+#endif
+
+ if (is_response) {
+ if (packet_number == 0) {
+ col_set_str(pinfo->cinfo, COL_INFO, "Server Greeting");
+ offset = mysql_dissect_greeting(tvb, pinfo, offset, mysql_tree, conn_data);
+ } else {
+ col_set_str(pinfo->cinfo, COL_INFO, "Response");
+ offset = mysql_dissect_response(tvb, pinfo, offset, mysql_tree, conn_data);
+ }
+ } else {
+ if (packet_number == 1) {
+ col_set_str(pinfo->cinfo, COL_INFO, "Login Request");
+ offset = mysql_dissect_login(tvb, pinfo, offset, mysql_tree, conn_data);
+ } else {
+ col_set_str(pinfo->cinfo, COL_INFO, "Request");
+ offset = mysql_dissect_request(tvb, pinfo, offset, mysql_tree, conn_data);
+ }
+ }
+
+#ifdef CTDEBUG
+ conn_state_out= conn_data->state;
+ ++(conn_data->generation);
+ pi= proto_tree_add_text(mysql_tree, tvb, offset, 0, "next proto state: %s (%u)",
+ val_to_str(conn_state_out, state_vals, "Unknown (%u)"),
+ conn_state_out);
+ PROTO_ITEM_SET_GENERATED(pi);
+#endif
+
+ /* remaining payload indicates an error */
+ if (tree && tvb_reported_length_remaining(tvb, offset) > 0) {
+ ti = proto_tree_add_item(mysql_tree, hf_mysql_payload, tvb, offset, -1, ENC_NA);
+ expert_add_info(pinfo, ti, &ei_mysql_dissector_incomplete);
+ }
+
+ return tvb_length(tvb);
+}
+
+/* dissector entrypoint, handles TCP-desegmentation */
+static int
+dissect_mysql(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
+{
+ tcp_dissect_pdus(tvb, pinfo, tree, mysql_desegment, 3,
+ get_mysql_pdu_len, dissect_mysql_pdu, data);
+ return tvb_length(tvb);
+}
+
/* protocol registration */
void proto_register_mysql(void)
{
@@ -2663,14 +2658,14 @@ void proto_register_mysql(void)
"Whether the MySQL dissector should display the SQL query string in the INFO column.",
&mysql_showquery);
- register_dissector("mysql", dissect_mysql_pdu, proto_mysql);
+ new_register_dissector("mysql", dissect_mysql_pdu, proto_mysql);
}
/* dissector registration */
void proto_reg_handoff_mysql(void)
{
dissector_handle_t mysql_handle;
- mysql_handle = create_dissector_handle(dissect_mysql, proto_mysql);
+ mysql_handle = new_create_dissector_handle(dissect_mysql, proto_mysql);
dissector_add_uint("tcp.port", TCP_PORT_MySQL, mysql_handle);
}
diff --git a/epan/dissectors/packet-nbd.c b/epan/dissectors/packet-nbd.c
index 7c00ff3127..b19d8958b3 100644
--- a/epan/dissectors/packet-nbd.c
+++ b/epan/dissectors/packet-nbd.c
@@ -170,8 +170,8 @@ get_nbd_tcp_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset)
return 0;
}
-static void
-dissect_nbd_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
+static int
+dissect_nbd_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_)
{
guint32 magic, error, packet;
guint32 handle[2];
@@ -205,7 +205,7 @@ dissect_nbd_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
handle[1]=tvb_get_ntohl(tvb, offset+8);
break;
default:
- return;
+ return 4;
}
conversation = find_or_create_conversation(pinfo);
@@ -367,11 +367,11 @@ dissect_nbd_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
break;
}
- return;
+ return tvb_length(tvb);
}
static gboolean
-dissect_nbd_tcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_nbd_tcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
guint32 magic, type;
@@ -399,14 +399,14 @@ dissect_nbd_tcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *
return FALSE;
}
- tcp_dissect_pdus(tvb, pinfo, tree, nbd_desegment, 28, get_nbd_tcp_pdu_len, dissect_nbd_tcp_pdu);
+ tcp_dissect_pdus(tvb, pinfo, tree, nbd_desegment, 28, get_nbd_tcp_pdu_len, dissect_nbd_tcp_pdu, data);
return TRUE;
case NBD_RESPONSE_MAGIC:
/* responses are 16 bytes or more */
if(tvb_length(tvb)<16){
return FALSE;
}
- tcp_dissect_pdus(tvb, pinfo, tree, nbd_desegment, 16, get_nbd_tcp_pdu_len, dissect_nbd_tcp_pdu);
+ tcp_dissect_pdus(tvb, pinfo, tree, nbd_desegment, 16, get_nbd_tcp_pdu_len, dissect_nbd_tcp_pdu, data);
return TRUE;
default:
break;
diff --git a/epan/dissectors/packet-ncp.c b/epan/dissectors/packet-ncp.c
index accc248262..59177b03b5 100644
--- a/epan/dissectors/packet-ncp.c
+++ b/epan/dissectors/packet-ncp.c
@@ -858,17 +858,19 @@ get_ncp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return tvb_get_ntohl(tvb, offset + 4) & 0x7fffffff;
}
-static void
-dissect_ncp_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ncp_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
dissect_ncp_common(tvb, pinfo, tree, TRUE);
+ return tvb_length(tvb);
}
-static void
-dissect_ncp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ncp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, ncp_desegment, 8, get_ncp_pdu_len,
- dissect_ncp_tcp_pdu);
+ dissect_ncp_tcp_pdu, data);
+ return tvb_length(tvb);
}
void
@@ -1106,7 +1108,7 @@ proto_reg_handoff_ncp(void)
dissector_handle_t ncp_tcp_handle;
ncp_handle = create_dissector_handle(dissect_ncp, proto_ncp);
- ncp_tcp_handle = create_dissector_handle(dissect_ncp_tcp, proto_ncp);
+ ncp_tcp_handle = new_create_dissector_handle(dissect_ncp_tcp, proto_ncp);
dissector_add_uint("tcp.port", TCP_PORT_NCP, ncp_tcp_handle);
dissector_add_uint("udp.port", UDP_PORT_NCP, ncp_handle);
dissector_add_uint("ipx.packet_type", IPX_PACKET_TYPE_NCP, ncp_handle);
diff --git a/epan/dissectors/packet-ndmp.c b/epan/dissectors/packet-ndmp.c
index f8247d8590..24c1b68d67 100644
--- a/epan/dissectors/packet-ndmp.c
+++ b/epan/dissectors/packet-ndmp.c
@@ -3077,8 +3077,8 @@ dissect_ndmp_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree
return offset;
}
-static void
-dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
int offset = 0;
guint32 ndmp_rm;
@@ -3161,7 +3161,7 @@ dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/*
* Figure out the tcp seq and pdu length. Fragment tree is indexed based on seq;
*/
- tcpinfo = (struct tcpinfo *)p_get_proto_data(pinfo->fd, proto_ndmp, 0);
+ tcpinfo = (struct tcpinfo *)data;
seq = tcpinfo->seq;
len = (ndmp_rm & RPC_RM_FRAGLEN) + 4;
@@ -3277,7 +3277,7 @@ dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_text(ndmp_tree, tvb, 4, nbytes, "NDMP fragment data (%u byte%s)", nbytes, plurality(nbytes, "", "s"));
pinfo->fragmented = save_fragmented;
- return;
+ return tvb_length(tvb);
}
}
else
@@ -3291,7 +3291,7 @@ dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (size < 24) {
/* too short to be NDMP */
pinfo->fragmented = save_fragmented;
- return;
+ return tvb_length(tvb);
}
/*
@@ -3301,7 +3301,7 @@ dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (!check_ndmp_hdr(new_tvb))
{
pinfo->fragmented = save_fragmented;
- return;
+ return tvb_length(tvb);
}
nh.seq = tvb_get_ntohl(new_tvb, offset);
@@ -3398,7 +3398,7 @@ dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
pinfo->fragmented = save_fragmented;
col_set_writable(pinfo->cinfo, save_writable);
- return;
+ return tvb_length(tvb);
}
static guint
@@ -3493,13 +3493,8 @@ dissect_ndmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
return 0;
}
- /* XXX - tcp_dissect_pdus() doesn't have a way to pass dissector data, so store
- the tcpinfo structure from the TCP dissector as proto_data to be retrieved
- in dissect_ndmp_message() */
- p_add_proto_data(pinfo->fd, proto_ndmp, 0, data);
-
tcp_dissect_pdus(tvb, pinfo, tree, ndmp_desegment, 4,
- get_ndmp_pdu_len, dissect_ndmp_message);
+ get_ndmp_pdu_len, dissect_ndmp_message, data);
return tvb_length(tvb);
}
@@ -3517,13 +3512,8 @@ dissect_ndmp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
if (!check_if_ndmp(tvb, pinfo))
return 0;
- /* XXX - tcp_dissect_pdus() doesn't have a way to pass dissector data, so store
- the tcpinfo structure from the TCP dissector as proto_data to be retrieved
- in dissect_ndmp_message() */
- p_add_proto_data(pinfo->fd, proto_ndmp, 0, data);
-
tcp_dissect_pdus(tvb, pinfo, tree, ndmp_desegment, 28,
- get_ndmp_pdu_len, dissect_ndmp_message);
+ get_ndmp_pdu_len, dissect_ndmp_message, data);
return tvb_length(tvb);
}
diff --git a/epan/dissectors/packet-ndps.c b/epan/dissectors/packet-ndps.c
index 0c580b61a8..e2a4b5aacc 100644
--- a/epan/dissectors/packet-ndps.c
+++ b/epan/dissectors/packet-ndps.c
@@ -4295,21 +4295,21 @@ get_ndps_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return tvb_get_ntohs(tvb, offset +2) + 4;
}
-static void
-dissect_ndps_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ndps_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
- proto_tree *ndps_tree = NULL;
+ proto_tree *ndps_tree;
proto_item *ti;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "NDPS");
col_clear(pinfo->cinfo, COL_INFO);
- if (tree) {
- ti = proto_tree_add_item(tree, proto_ndps, tvb, 0, -1, ENC_NA);
- ndps_tree = proto_item_add_subtree(ti, ett_ndps);
- }
+ ti = proto_tree_add_item(tree, proto_ndps, tvb, 0, -1, ENC_NA);
+ ndps_tree = proto_item_add_subtree(ti, ett_ndps);
+
dissect_ndps(tvb, pinfo, ndps_tree);
+ return tvb_length(tvb);
}
/*
@@ -4470,10 +4470,11 @@ ndps_defrag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, spx_info *spx_i
}
}
-static void
-dissect_ndps_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ndps_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
- tcp_dissect_pdus(tvb, pinfo, tree, ndps_desegment, 4, get_ndps_pdu_len, dissect_ndps_pdu);
+ tcp_dissect_pdus(tvb, pinfo, tree, ndps_desegment, 4, get_ndps_pdu_len, dissect_ndps_pdu, data);
+ return tvb_length(tvb);
}
@@ -9801,7 +9802,7 @@ proto_reg_handoff_ndps(void)
dissector_handle_t ndps_handle, ndps_tcp_handle;
ndps_handle = new_create_dissector_handle(dissect_ndps_ipx, proto_ndps);
- ndps_tcp_handle = create_dissector_handle(dissect_ndps_tcp, proto_ndps);
+ ndps_tcp_handle = new_create_dissector_handle(dissect_ndps_tcp, proto_ndps);
dissector_add_uint("spx.socket", SPX_SOCKET_PA, ndps_handle);
dissector_add_uint("spx.socket", SPX_SOCKET_BROKER, ndps_handle);
diff --git a/epan/dissectors/packet-netsync.c b/epan/dissectors/packet-netsync.c
index f03ac4b44f..5a25745185 100644
--- a/epan/dissectors/packet-netsync.c
+++ b/epan/dissectors/packet-netsync.c
@@ -430,8 +430,8 @@ get_netsync_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return 1 + 1 + size_bytes + (guint)size + 4;
}
-static void
-dissect_netsync_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_netsync_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
gint offset = 0;
guint8 tmp;
@@ -442,9 +442,8 @@ dissect_netsync_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Set the protocol column */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "Netsync");
-
if (tree == NULL)
- return;
+ return tvb_length(tvb);
while (tvb_reported_length_remaining(tvb, offset) > 0) {
ti = proto_tree_add_item(tree, proto_netsync, tvb, offset, -1, ENC_NA);
@@ -549,13 +548,16 @@ dissect_netsync_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_item_set_len(netsync_tree, 1+1+size_bytes+size+4);
}
+
+ return tvb_length(tvb);
}
-static void
-dissect_netsync(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_netsync(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, netsync_desegment, 7, get_netsync_pdu_len,
- dissect_netsync_pdu);
+ dissect_netsync_pdu, data);
+ return tvb_length(tvb);
}
void
@@ -751,7 +753,7 @@ proto_reg_handoff_netsync(void)
static gboolean initialized = FALSE;
if (!initialized) {
- netsync_handle = create_dissector_handle(dissect_netsync, proto_netsync);
+ netsync_handle = new_create_dissector_handle(dissect_netsync, proto_netsync);
initialized = TRUE;
} else {
dissector_delete_uint("tcp.port", tcp_port_netsync, netsync_handle);
diff --git a/epan/dissectors/packet-openflow.c b/epan/dissectors/packet-openflow.c
index 410847f0b5..1ce37b0da9 100644
--- a/epan/dissectors/packet-openflow.c
+++ b/epan/dissectors/packet-openflow.c
@@ -883,8 +883,8 @@ get_openflow_pdu_length(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
}
-static void
-dissect_openflow_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_openflow_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
guint offset = 0;
guint8 version;
@@ -906,15 +906,16 @@ dissect_openflow_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_text(tree, tvb, offset, -1, "Unsuported version not dissected");
break;
}
+ return tvb_length(tvb);
}
#define OFP_HEADER_LEN 8
static int
-dissect_openflow(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_openflow(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
tcp_dissect_pdus(tvb, pinfo, tree, openflow_desegment, OFP_HEADER_LEN,
- get_openflow_pdu_length, dissect_openflow_tcp_pdu);
+ get_openflow_pdu_length, dissect_openflow_tcp_pdu, data);
return tvb_length(tvb);
}
diff --git a/epan/dissectors/packet-openvpn.c b/epan/dissectors/packet-openvpn.c
index dc0aaf412d..fa171a9f92 100644
--- a/epan/dissectors/packet-openvpn.c
+++ b/epan/dissectors/packet-openvpn.c
@@ -80,7 +80,8 @@ static gint hf_openvpn_rsessionid = -1;
static gint hf_openvpn_sessionid = -1;
static gint proto_openvpn = -1;
-static dissector_handle_t openvpn_handle;
+static dissector_handle_t openvpn_udp_handle;
+static dissector_handle_t openvpn_tcp_handle;
static dissector_handle_t ssl_handle;
@@ -180,48 +181,27 @@ check_for_valid_hmac(guint32 hmac)
}
}
-static void
-dissect_openvpn_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_openvpn_msg_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *openvpn_tree, proto_tree *parent_tree, gint offset)
{
- gint offset = 0;
- gboolean protocol_tcp;
gboolean tls_auth;
guint openvpn_keyid;
guint openvpn_opcode;
guint32 msg_mpid = -1;
guint32 msg_sessionid = -1;
guint8 openvpn_predict_tlsauth_arraylength;
- proto_item *ti = NULL;
- proto_item *ti2;
- proto_item *ti3;
- proto_tree *openvpn_tree = NULL;
- proto_tree *packetarray_tree;
- proto_tree *type_tree;
+ proto_item *ti2, *ti3;
+ proto_tree *packetarray_tree, *type_tree;
guint32 msg_length_remaining;
gboolean msg_lastframe;
fragment_head *frag_msg;
tvbuff_t *new_tvb;
gboolean save_fragmented;
- /* check whether we are dealing with tcp or udp encapsulation */
- protocol_tcp = (pinfo->ipproto == IP_PROTO_TCP ? TRUE : FALSE);
-
/* Clear out stuff in the info column */
col_set_str(pinfo->cinfo, COL_PROTOCOL, PSNAME);
col_clear(pinfo->cinfo,COL_INFO);
- /* we are being asked for details */
- if (tree) {
- ti = proto_tree_add_item(tree, proto_openvpn, tvb, 0, -1, ENC_NA);
- openvpn_tree = proto_item_add_subtree(ti, ett_openvpn);
- }
-
- /* openvpn packet length field is only present in tcp packets */
- if (protocol_tcp) {
- proto_tree_add_item(openvpn_tree, hf_openvpn_plen, tvb, offset, 2, ENC_BIG_ENDIAN);
- offset += 2;
- }
-
/* read opcode and write to info column */
openvpn_opcode = tvb_get_bits8(tvb, offset*8, 5);
col_append_fstr(pinfo->cinfo, COL_INFO, "MessageType: %s",
@@ -229,12 +209,12 @@ dissect_openvpn_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
openvpn_keyid = tvb_get_bits8(tvb, offset*8 + 5, 3);
- proto_item_append_text(ti, ", Opcode: %s, Key ID: %d",
+ proto_item_append_text(parent_tree, ", Opcode: %s, Key ID: %d",
val_to_str(openvpn_opcode, openvpn_message_types, "Unknown (0x%02x)"),
openvpn_keyid);
ti2 = proto_tree_add_item(openvpn_tree, hf_openvpn_pdu_type, tvb, offset, 1, ENC_BIG_ENDIAN);
- proto_item_append_text(ti2, " %s", "[opcode/key_id]");
+ proto_item_append_text(ti2, " [opcode/key_id]");
type_tree = proto_item_add_subtree(ti2, ett_openvpn_type);
proto_tree_add_item(type_tree, hf_openvpn_opcode, tvb, offset, 1, ENC_BIG_ENDIAN);
@@ -313,11 +293,11 @@ dissect_openvpn_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
- /* if we have more data left, determine wht to do */
+ /* if we have more data left, determine what to do */
msg_length_remaining = tvb_length_remaining(tvb, offset);
if (msg_length_remaining == 0) {
- return;
+ return tvb_length(tvb);
}
if (openvpn_opcode != P_CONTROL_V1) {
@@ -327,7 +307,7 @@ dissect_openvpn_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
data_tree = proto_item_add_subtree(ti2, ett_openvpn_data);
proto_tree_add_item(data_tree, hf_openvpn_data, tvb, offset, -1, ENC_NA);
- return;
+ return tvb_length(tvb);
}
/* Try to reassemble */
@@ -336,7 +316,7 @@ dissect_openvpn_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
fragmented message and is not the last fragment of the current transmission.
Note that the tvb contains exactly one openvpn PDU:
UDP: by definition;
- TCP: beacuse of the use of tcp_dissect_pdus().
+ TCP: because of the use of tcp_dissect_pdus().
*/
if (msg_length_remaining == 100) {
msg_lastframe = FALSE;
@@ -394,8 +374,10 @@ dissect_openvpn_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (new_tvb) {
/* call SSL/TLS dissector if we just processed the last fragment */
- call_dissector(ssl_handle, new_tvb, pinfo, tree);
+ call_dissector(ssl_handle, new_tvb, pinfo, parent_tree);
}
+
+ return tvb_length(tvb);
}
static guint
@@ -405,26 +387,42 @@ get_msg_length(packet_info *pinfo _U_, tvbuff_t *tvb, gint offset)
+2 to account for the length field itself */
}
-static void
-dissect_openvpn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_openvpn_msg_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
+ proto_item *ti;
+ proto_tree *openvpn_tree;
+
+ ti = proto_tree_add_item(tree, proto_openvpn, tvb, 0, -1, ENC_NA);
+ openvpn_tree = proto_item_add_subtree(ti, ett_openvpn);
- /* If TCP, then TCP desegmentation is needed */
- if (pinfo->ipproto == IP_PROTO_TCP) {
- tcp_dissect_pdus(
- tvb,
- pinfo,
- tree,
+ proto_tree_add_item(openvpn_tree, hf_openvpn_plen, tvb, 0, 2, ENC_BIG_ENDIAN);
+
+ return dissect_openvpn_msg_common(tvb, pinfo, openvpn_tree, tree, 2);
+}
+
+static int
+dissect_openvpn_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
+{
+ tcp_dissect_pdus( tvb, pinfo, tree,
TRUE, /* should data be reassembled? */
2, /* how much bytes do we need for get_msg_length to be successful,
since the length is the first thing in an openvpn packet we choose 2 */
get_msg_length, /* fptr for function to get the packetlength of current frame */
- dissect_openvpn_msg
- );
- } else {
- /* Must be UDP */
- dissect_openvpn_msg(tvb, pinfo, tree);
- }
+ dissect_openvpn_msg_tcp, data);
+ return tvb_length(tvb);
+}
+
+static int
+dissect_openvpn_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
+{
+ proto_item *ti;
+ proto_tree *openvpn_tree;
+
+ ti = proto_tree_add_item(tree, proto_openvpn, tvb, 0, -1, ENC_NA);
+ openvpn_tree = proto_item_add_subtree(ti, ett_openvpn);
+
+ return dissect_openvpn_msg_common(tvb, pinfo, openvpn_tree, tree, 0);
}
void
@@ -597,7 +595,8 @@ proto_register_openvpn(void)
proto_register_field_array(proto_openvpn, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
- openvpn_handle = register_dissector(PFNAME, dissect_openvpn, proto_openvpn);
+ openvpn_udp_handle = new_register_dissector(PFNAME, dissect_openvpn_udp, proto_openvpn);
+ openvpn_tcp_handle = new_register_dissector(PFNAME, dissect_openvpn_tcp, proto_openvpn);
register_init_routine(&openvpn_reassemble_init);
@@ -655,18 +654,18 @@ proto_reg_handoff_openvpn(void)
initialized = TRUE;
} else {
if (tcp_port > 0)
- dissector_delete_uint("tcp.port", tcp_port, openvpn_handle);
+ dissector_delete_uint("tcp.port", tcp_port, openvpn_tcp_handle);
if (udp_port > 0)
- dissector_delete_uint("udp.port", udp_port, openvpn_handle);
+ dissector_delete_uint("udp.port", udp_port, openvpn_udp_handle);
}
tcp_port = pref_tcp_port;
udp_port = pref_udp_port;
if (tcp_port > 0)
- dissector_add_uint("tcp.port", tcp_port, openvpn_handle);
+ dissector_add_uint("tcp.port", tcp_port, openvpn_tcp_handle);
if (udp_port > 0)
- dissector_add_uint("udp.port", udp_port, openvpn_handle);
+ dissector_add_uint("udp.port", udp_port, openvpn_udp_handle);
}
/*
diff --git a/epan/dissectors/packet-openwire.c b/epan/dissectors/packet-openwire.c
index 92c04bad67..6caa22d742 100644
--- a/epan/dissectors/packet-openwire.c
+++ b/epan/dissectors/packet-openwire.c
@@ -1309,8 +1309,8 @@ dissect_openwire_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, in
return (offset - startOffset);
}
-static void
-dissect_openwire(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_openwire(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
gint offset = 0;
@@ -1343,7 +1343,7 @@ dissect_openwire(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_tree_add_item(openwireroot_tree, hf_openwire_command, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
expert_add_info(pinfo, openwireroot_tree, &ei_openwire_tight_encoding_not_supported);
- return;
+ return tvb_length(tvb);
}
caching = retrieve_caching(pinfo);
@@ -1359,6 +1359,8 @@ dissect_openwire(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
expert_add_info_format(pinfo, tree, &ei_openwire_command_not_supported, "OpenWire command fields unknown to Wireshark: %d", iCommand);
}
}
+
+ return tvb_length(tvb);
}
static guint
@@ -1371,15 +1373,16 @@ get_openwire_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return 0;
}
-static void
-dissect_openwire_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_openwire_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
- tcp_dissect_pdus(tvb, pinfo, tree, openwire_desegment, 5, get_openwire_pdu_len, dissect_openwire);
+ tcp_dissect_pdus(tvb, pinfo, tree, openwire_desegment, 5, get_openwire_pdu_len, dissect_openwire, data);
+ return tvb_length(tvb);
}
static gboolean
-dissect_openwire_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_openwire_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
conversation_t *conversation;
gboolean detected = FALSE;
@@ -1421,7 +1424,7 @@ dissect_openwire_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
conversation_set_dissector(conversation, openwire_tcp_handle);
/* Dissect the packet */
- dissect_openwire(tvb, pinfo, tree);
+ dissect_openwire(tvb, pinfo, tree, data);
return TRUE;
}
return FALSE;
@@ -2014,6 +2017,6 @@ void
proto_reg_handoff_openwire(void)
{
heur_dissector_add("tcp", dissect_openwire_heur, proto_openwire);
- openwire_tcp_handle = create_dissector_handle(dissect_openwire_tcp, proto_openwire);
+ openwire_tcp_handle = new_create_dissector_handle(dissect_openwire_tcp, proto_openwire);
dissector_add_handle("tcp.port", openwire_tcp_handle);
}
diff --git a/epan/dissectors/packet-opsi.c b/epan/dissectors/packet-opsi.c
index d7c2e21fb7..dfe82b6a32 100644
--- a/epan/dissectors/packet-opsi.c
+++ b/epan/dissectors/packet-opsi.c
@@ -554,8 +554,8 @@ dissect_attributes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *opsi_tree, int
}
}
-static void
-dissect_opsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_opsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
proto_tree *opsi_tree;
@@ -581,15 +581,17 @@ dissect_opsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
dissect_attributes(tvb, pinfo, opsi_tree, HEADER_LENGTH, MIN(((int)tvb_reported_length(tvb)-HEADER_LENGTH), (tvb_get_ntohs(tvb, PACKET_LENGTH_OFFSET)-HEADER_LENGTH)));
+ return tvb_length(tvb);
}
-static void
-dissect_opsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_opsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
/* We should mimimally grab the header */
tcp_dissect_pdus(tvb, pinfo, tree, opsi_desegment, HEADER_LENGTH, get_opsi_pdu_len,
- dissect_opsi_pdu);
+ dissect_opsi_pdu, data);
+ return tvb_length(tvb);
}
@@ -884,6 +886,6 @@ void
proto_reg_handoff_opsi(void)
{
dissector_handle_t opsi_handle;
- opsi_handle = create_dissector_handle(dissect_opsi, proto_opsi);
+ opsi_handle = new_create_dissector_handle(dissect_opsi, proto_opsi);
dissector_add_uint("tcp.port", TCP_PORT_OPSI, opsi_handle);
}
diff --git a/epan/dissectors/packet-paltalk.c b/epan/dissectors/packet-paltalk.c
index 8a88f197aa..e784b54609 100644
--- a/epan/dissectors/packet-paltalk.c
+++ b/epan/dissectors/packet-paltalk.c
@@ -40,10 +40,6 @@
#define PALTALK_HEADER_LENGTH 6
-/* forward reference */
-static guint dissect_paltalk_get_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset);
-static void dissect_paltalk_desegmented(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-
static int proto_paltalk = -1;
static int hf_paltalk_pdu_type = -1;
@@ -53,6 +49,34 @@ static int hf_paltalk_content = -1;
static gint ett_paltalk = -1;
+static guint
+dissect_paltalk_get_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+{
+ return tvb_get_ntohs(tvb, offset + 4) + PALTALK_HEADER_LENGTH;
+}
+
+static int
+dissect_paltalk_desegmented(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
+{
+ proto_item *ti = NULL;
+ proto_tree *pt_tree = NULL;
+
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "Paltalk");
+ col_clear(pinfo->cinfo, COL_INFO);
+
+ if (tree) /* we are being asked for details */
+ {
+ ti = proto_tree_add_item(tree, proto_paltalk, tvb, 0, -1, ENC_NA);
+ pt_tree = proto_item_add_subtree(ti, ett_paltalk);
+ proto_tree_add_item(pt_tree, hf_paltalk_pdu_type, tvb, 0, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(pt_tree, hf_paltalk_version, tvb, 2, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(pt_tree, hf_paltalk_length, tvb, 4, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(pt_tree, hf_paltalk_content, tvb, 6, tvb_get_ntohs(tvb, 4), ENC_NA);
+ }
+
+ return tvb_length(tvb);
+}
+
static gboolean
dissect_paltalk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
@@ -78,37 +102,11 @@ dissect_paltalk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
return FALSE;
/* Dissect result of desegmented TCP data */
- tcp_dissect_pdus(tvb, pinfo, tree, TRUE, PALTALK_HEADER_LENGTH
- , dissect_paltalk_get_len, dissect_paltalk_desegmented);
+ tcp_dissect_pdus(tvb, pinfo, tree, TRUE, PALTALK_HEADER_LENGTH,
+ dissect_paltalk_get_len, dissect_paltalk_desegmented, data);
return TRUE;
}
-static guint
-dissect_paltalk_get_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
-{
- return tvb_get_ntohs(tvb, offset + 4) + PALTALK_HEADER_LENGTH;
-}
-
-static void
-dissect_paltalk_desegmented(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
-{
- proto_item *ti = NULL;
- proto_tree *pt_tree = NULL;
-
- col_set_str(pinfo->cinfo, COL_PROTOCOL, "Paltalk");
- col_clear(pinfo->cinfo, COL_INFO);
-
- if (tree) /* we are being asked for details */
- {
- ti = proto_tree_add_item(tree, proto_paltalk, tvb, 0, -1, ENC_NA);
- pt_tree = proto_item_add_subtree(ti, ett_paltalk);
- proto_tree_add_item(pt_tree, hf_paltalk_pdu_type, tvb, 0, 2, ENC_BIG_ENDIAN);
- proto_tree_add_item(pt_tree, hf_paltalk_version, tvb, 2, 2, ENC_BIG_ENDIAN);
- proto_tree_add_item(pt_tree, hf_paltalk_length, tvb, 4, 2, ENC_BIG_ENDIAN);
- proto_tree_add_item(pt_tree, hf_paltalk_content, tvb, 6, tvb_get_ntohs(tvb, 4), ENC_NA);
- }
-}
-
void
proto_register_paltalk(void)
{
diff --git a/epan/dissectors/packet-pcep.c b/epan/dissectors/packet-pcep.c
index fc2643c49d..fdcc797c6f 100644
--- a/epan/dissectors/packet-pcep.c
+++ b/epan/dissectors/packet-pcep.c
@@ -2468,8 +2468,8 @@ get_pcep_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return plen;
}
-static void
-dissect_pcep_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_pcep_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
/* Set up structures needed to add the protocol subtree and manage it */
@@ -2480,13 +2480,15 @@ dissect_pcep_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_clear(pinfo->cinfo, COL_INFO);
dissect_pcep_msg_tree(tvb, tree, ett_pcep, pinfo);
+ return tvb_length(tvb);
}
-static void
-dissect_pcep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_pcep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 4, get_pcep_message_len,
- dissect_pcep_pdu);
+ dissect_pcep_pdu, data);
+ return tvb_length(tvb);
}
/*Register the protocol with wireshark*/
@@ -2988,7 +2990,7 @@ proto_reg_handoff_pcep(void)
{
dissector_handle_t pcep_handle;
- pcep_handle = create_dissector_handle(dissect_pcep, proto_pcep);
+ pcep_handle = new_create_dissector_handle(dissect_pcep, proto_pcep);
dissector_add_uint("tcp.port", TCP_PORT_PCEP, pcep_handle);
}
diff --git a/epan/dissectors/packet-pcp.c b/epan/dissectors/packet-pcp.c
index 0686b6fe50..353d5970fa 100644
--- a/epan/dissectors/packet-pcp.c
+++ b/epan/dissectors/packet-pcp.c
@@ -432,8 +432,6 @@ static int dissect_pcp_message_text_req(tvbuff_t *tvb, packet_info *pinfo, proto
static int dissect_pcp_message_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset);
static int dissect_pcp_partial_pmid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset);
static int dissect_pcp_partial_when(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset);
-static void dissect_pcp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-static void dissect_pcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
/* message length for dissect_tcp */
static guint get_pcp_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
@@ -1374,7 +1372,7 @@ static int dissect_pcp_partial_when(tvbuff_t *tvb, packet_info *pinfo _U_, proto
}
/* MAIN DISSECTING ROUTINE (after passed from dissect_tcp, all packets hit function) */
-static void dissect_pcp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_pcp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *root_pcp_item;
proto_tree *pcp_tree;
@@ -1484,12 +1482,14 @@ static void dissect_pcp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
expert_add_info(pinfo, pcp_tree, &ei_pcp_unimplemented_packet_type);
break;
}
+ return tvb_length(tvb);
}
-static void dissect_pcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_pcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
/* pass all packets through TCP-reassembally */
- tcp_dissect_pdus(tvb, pinfo, tree, TRUE, PCP_HEADER_LEN, get_pcp_message_len, dissect_pcp_message);
+ tcp_dissect_pdus(tvb, pinfo, tree, TRUE, PCP_HEADER_LEN, get_pcp_message_len, dissect_pcp_message, data);
+ return tvb_length(tvb);
}
/* setup the dissecting */
@@ -2260,7 +2260,7 @@ void proto_reg_handoff_pcp(void)
{
dissector_handle_t pcp_handle;
- pcp_handle = create_dissector_handle(dissect_pcp, proto_pcp);
+ pcp_handle = new_create_dissector_handle(dissect_pcp, proto_pcp);
dissector_add_uint("tcp.port", PCP_PORT, pcp_handle);
}
diff --git a/epan/dissectors/packet-pgsql.c b/epan/dissectors/packet-pgsql.c
index b0aa55d06c..cfe3ad16bf 100644
--- a/epan/dissectors/packet-pgsql.c
+++ b/epan/dissectors/packet-pgsql.c
@@ -82,12 +82,6 @@ static guint pgsql_port = 5432;
static gboolean pgsql_desegment = TRUE;
static gboolean first_message = TRUE;
-static void dissect_pgsql_fe_msg(guchar, guint, tvbuff_t *, gint, proto_tree *);
-static void dissect_pgsql_be_msg(guchar, guint, tvbuff_t *, gint, proto_tree *);
-static void dissect_pgsql_msg(tvbuff_t *, packet_info *, proto_tree *);
-static void dissect_pgsql(tvbuff_t *, packet_info *, proto_tree *);
-static guint pgsql_length(packet_info *, tvbuff_t *, int);
-
static const value_string fe_messages[] = {
{ 'p', "Password message" },
{ 'Q', "Simple query" },
@@ -157,125 +151,6 @@ static const value_string format_vals[] = {
{ 0, NULL }
};
-/* This function is called once per TCP packet. It sets COL_PROTOCOL and
- * identifies FE/BE messages by adding a ">" or "<" to COL_INFO. Then it
- * arranges for each message to be dissected individually. */
-
-static void
-dissect_pgsql(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
-{
- /* conversation_t *cv; */
-
- first_message = TRUE;
-
- /* We don't use conversation data yet, but... */
- /* cv = find_or_create_conversation(pinfo); */
-
- col_set_str(pinfo->cinfo, COL_PROTOCOL, "PGSQL");
- col_set_str(pinfo->cinfo, COL_INFO,
- (pinfo->match_uint == pinfo->destport) ?
- ">" : "<");
-
- tcp_dissect_pdus(tvb, pinfo, tree, pgsql_desegment, 5,
- pgsql_length, dissect_pgsql_msg);
-}
-
-
-/* This function is called by tcp_dissect_pdus() to find the size of the
- message starting at tvb[offset]. */
-
-static guint
-pgsql_length(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
-{
- gint n = 0;
- guchar type;
- guint length;
-
- /* The length is either the four bytes after the type, or, if the
- type is 0, the first four bytes. */
- type = tvb_get_guint8(tvb, offset);
- if (type != '\0')
- n = 1;
- length = tvb_get_ntohl(tvb, offset+n);
- return length+n;
-}
-
-
-/* This function is responsible for dissecting a single message. */
-
-static void
-dissect_pgsql_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
-{
- proto_item *ti, *hidden_item;
- proto_tree *ptree;
-
- gint n;
- guchar type;
- const char *typestr;
- guint length;
- gboolean fe = (pinfo->match_uint == pinfo->destport);
-
- n = 0;
- type = tvb_get_guint8(tvb, 0);
- if (type != '\0')
- n += 1;
- length = tvb_get_ntohl(tvb, n);
-
- /* This is like specifying VALS(messages) for hf_type, which we can't do
- directly because of messages without type bytes, and because the type
- interpretation depends on fe. */
- if (fe) {
- /* There are a few frontend messages that have no leading type byte.
- We identify them by the fact that the first byte of their length
- must be zero, and that the next four bytes are a unique tag. */
- if (type == '\0') {
- guint tag = tvb_get_ntohl(tvb, 4);
-
- if (length == 16 && tag == 80877102)
- typestr = "Cancel request";
- else if (length == 8 && tag == 80877103)
- typestr = "SSL request";
- else if (tag == 196608)
- typestr = "Startup message";
- else
- typestr = "Unknown";
- } else
- typestr = val_to_str_const(type, fe_messages, "Unknown");
- }
- else {
- typestr = val_to_str_const(type, be_messages, "Unknown");
- }
-
- /* This is a terrible hack. It makes the "Info" column reflect
- the contents of every message in a TCP packet. Could it be
- done any better? */
- col_append_fstr(pinfo->cinfo, COL_INFO, "%s%c",
- ( first_message ? "" : "/" ), type);
- first_message = FALSE;
-
- if (tree) {
- ti = proto_tree_add_item(tree, proto_pgsql, tvb, 0, -1, ENC_NA);
- ptree = proto_item_add_subtree(ti, ett_pgsql);
-
- n = 1;
- if (type == '\0')
- n = 0;
- proto_tree_add_text(ptree, tvb, 0, n, "Type: %s", typestr);
- hidden_item = proto_tree_add_item(ptree, hf_type, tvb, 0, n, ENC_ASCII|ENC_NA);
- PROTO_ITEM_SET_HIDDEN(hidden_item);
- proto_tree_add_item(ptree, hf_length, tvb, n, 4, ENC_BIG_ENDIAN);
- hidden_item = proto_tree_add_boolean(ptree, hf_frontend, tvb, 0, 0, fe);
- PROTO_ITEM_SET_HIDDEN(hidden_item);
- n += 4;
-
- if (fe)
- dissect_pgsql_fe_msg(type, length, tvb, n, ptree);
- else
- dissect_pgsql_be_msg(type, length, tvb, n, ptree);
- }
-}
-
-
static void dissect_pgsql_fe_msg(guchar type, guint length, tvbuff_t *tvb,
gint n, proto_tree *tree)
{
@@ -657,6 +532,125 @@ static void dissect_pgsql_be_msg(guchar type, guint length, tvbuff_t *tvb,
}
}
+/* This function is called by tcp_dissect_pdus() to find the size of the
+ message starting at tvb[offset]. */
+static guint
+pgsql_length(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+{
+ gint n = 0;
+ guchar type;
+ guint length;
+
+ /* The length is either the four bytes after the type, or, if the
+ type is 0, the first four bytes. */
+ type = tvb_get_guint8(tvb, offset);
+ if (type != '\0')
+ n = 1;
+ length = tvb_get_ntohl(tvb, offset+n);
+ return length+n;
+}
+
+
+/* This function is responsible for dissecting a single message. */
+
+static int
+dissect_pgsql_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
+{
+ proto_item *ti, *hidden_item;
+ proto_tree *ptree;
+
+ gint n;
+ guchar type;
+ const char *typestr;
+ guint length;
+ gboolean fe = (pinfo->match_uint == pinfo->destport);
+
+ n = 0;
+ type = tvb_get_guint8(tvb, 0);
+ if (type != '\0')
+ n += 1;
+ length = tvb_get_ntohl(tvb, n);
+
+ /* This is like specifying VALS(messages) for hf_type, which we can't do
+ directly because of messages without type bytes, and because the type
+ interpretation depends on fe. */
+ if (fe) {
+ /* There are a few frontend messages that have no leading type byte.
+ We identify them by the fact that the first byte of their length
+ must be zero, and that the next four bytes are a unique tag. */
+ if (type == '\0') {
+ guint tag = tvb_get_ntohl(tvb, 4);
+
+ if (length == 16 && tag == 80877102)
+ typestr = "Cancel request";
+ else if (length == 8 && tag == 80877103)
+ typestr = "SSL request";
+ else if (tag == 196608)
+ typestr = "Startup message";
+ else
+ typestr = "Unknown";
+ } else
+ typestr = val_to_str_const(type, fe_messages, "Unknown");
+ }
+ else {
+ typestr = val_to_str_const(type, be_messages, "Unknown");
+ }
+
+ /* This is a terrible hack. It makes the "Info" column reflect
+ the contents of every message in a TCP packet. Could it be
+ done any better? */
+ col_append_fstr(pinfo->cinfo, COL_INFO, "%s%c",
+ ( first_message ? "" : "/" ), type);
+ first_message = FALSE;
+
+ if (tree) {
+ ti = proto_tree_add_item(tree, proto_pgsql, tvb, 0, -1, ENC_NA);
+ ptree = proto_item_add_subtree(ti, ett_pgsql);
+
+ n = 1;
+ if (type == '\0')
+ n = 0;
+ proto_tree_add_text(ptree, tvb, 0, n, "Type: %s", typestr);
+ hidden_item = proto_tree_add_item(ptree, hf_type, tvb, 0, n, ENC_ASCII|ENC_NA);
+ PROTO_ITEM_SET_HIDDEN(hidden_item);
+ proto_tree_add_item(ptree, hf_length, tvb, n, 4, ENC_BIG_ENDIAN);
+ hidden_item = proto_tree_add_boolean(ptree, hf_frontend, tvb, 0, 0, fe);
+ PROTO_ITEM_SET_HIDDEN(hidden_item);
+ n += 4;
+
+ if (fe)
+ dissect_pgsql_fe_msg(type, length, tvb, n, ptree);
+ else
+ dissect_pgsql_be_msg(type, length, tvb, n, ptree);
+ }
+
+ return tvb_length(tvb);
+}
+
+/* This function is called once per TCP packet. It sets COL_PROTOCOL and
+ * identifies FE/BE messages by adding a ">" or "<" to COL_INFO. Then it
+ * arranges for each message to be dissected individually. */
+
+static int
+dissect_pgsql(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
+{
+ /* conversation_t *cv; */
+
+ first_message = TRUE;
+
+ /* We don't use conversation data yet, but... */
+ /* cv = find_or_create_conversation(pinfo); */
+
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "PGSQL");
+ col_set_str(pinfo->cinfo, COL_INFO,
+ (pinfo->match_uint == pinfo->destport) ?
+ ">" : "<");
+
+ tcp_dissect_pdus(tvb, pinfo, tree, pgsql_desegment, 5,
+ pgsql_length, dissect_pgsql_msg, data);
+ return tvb_length(tvb);
+}
+
void
proto_reg_handoff_pgsql(void);
@@ -854,7 +848,7 @@ proto_reg_handoff_pgsql(void)
static guint saved_pgsql_port;
if (!initialized) {
- pgsql_handle = create_dissector_handle(dissect_pgsql, proto_pgsql);
+ pgsql_handle = new_create_dissector_handle(dissect_pgsql, proto_pgsql);
initialized = TRUE;
} else {
dissector_delete_uint("tcp.port", saved_pgsql_port, pgsql_handle);
diff --git a/epan/dissectors/packet-pvfs2.c b/epan/dissectors/packet-pvfs2.c
index a4314f0a8c..f37b689ce3 100644
--- a/epan/dissectors/packet-pvfs2.c
+++ b/epan/dissectors/packet-pvfs2.c
@@ -273,10 +273,10 @@ dissect_pvfs_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
gboolean dissect_other_as_continuation);
-static void dissect_pvfs_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_pvfs_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
dissect_pvfs_common(tvb, pinfo, tree, FALSE);
-
+ return tvb_reported_length(tvb);
}
static guint get_pvfs_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
@@ -292,7 +292,7 @@ static guint get_pvfs_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
}
static int
-dissect_pvfs_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_pvfs_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
guint32 magic_nr, mode;
guint64 size;
@@ -331,7 +331,7 @@ dissect_pvfs_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
}
tcp_dissect_pdus(tvb, pinfo, tree, pvfs_desegment, 24, get_pvfs_pdu_len,
- dissect_pvfs_pdu);
+ dissect_pvfs_pdu, data);
return tvb_reported_length(tvb);
}
diff --git a/epan/dissectors/packet-reload-framing.c b/epan/dissectors/packet-reload-framing.c
index 2590b480f5..975d398403 100644
--- a/epan/dissectors/packet-reload-framing.c
+++ b/epan/dissectors/packet-reload-framing.c
@@ -445,23 +445,18 @@ dissect_reload_framing_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
}
static int
-dissect_reload_framing_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_reload_framing(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
return dissect_reload_framing_message(tvb, pinfo, tree, FALSE);
}
-static void
-dissect_reload_framing_message_no_return(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
-{
- dissect_reload_framing_message(tvb, pinfo, tree, FALSE);
-}
-
-static void
-dissect_reload_framing_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_reload_framing_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
/* XXX: Check if we have a valid RELOAD Frame Type ? */
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, MIN_HDR_LENGTH,
- get_reload_framing_message_length, dissect_reload_framing_message_no_return);
+ get_reload_framing_message_length, dissect_reload_framing, data);
+ return tvb_length(tvb);
}
/* ToDo: If a TCP connection is identified heuristically as reload-framing, then
@@ -584,7 +579,7 @@ proto_register_reload_framing(void)
expert_reload_framing = expert_register_protocol(proto_reload_framing);
expert_register_field_array(expert_reload_framing, ei, array_length(ei));
- register_dissector("reload-framing", dissect_reload_framing_message_no_return, proto_reload_framing);
+ new_register_dissector("reload-framing", dissect_reload_framing, proto_reload_framing);
}
@@ -595,8 +590,8 @@ proto_reg_handoff_reload_framing(void)
dissector_handle_t reload_framing_tcp_handle;
dissector_handle_t reload_framing_udp_handle;
- reload_framing_tcp_handle = create_dissector_handle(dissect_reload_framing_tcp, proto_reload_framing);
- reload_framing_udp_handle = new_create_dissector_handle(dissect_reload_framing_udp, proto_reload_framing);
+ reload_framing_tcp_handle = new_create_dissector_handle(dissect_reload_framing_tcp, proto_reload_framing);
+ reload_framing_udp_handle = new_create_dissector_handle(dissect_reload_framing, proto_reload_framing);
reload_handle = find_dissector("reload");
diff --git a/epan/dissectors/packet-rpcap.c b/epan/dissectors/packet-rpcap.c
index 78b0c88369..98e977234c 100644
--- a/epan/dissectors/packet-rpcap.c
+++ b/epan/dissectors/packet-rpcap.c
@@ -909,8 +909,8 @@ dissect_rpcap_packet (tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree,
}
-static void
-dissect_rpcap (tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree)
+static int
+dissect_rpcap (tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree, void* data _U_)
{
proto_tree *tree;
proto_item *ti;
@@ -995,6 +995,8 @@ dissect_rpcap (tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree)
}
break;
}
+
+ return tvb_length(tvb);
}
@@ -1110,12 +1112,12 @@ get_rpcap_pdu_len (packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
static gboolean
-dissect_rpcap_heur_tcp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_rpcap_heur_tcp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
if (check_rpcap_heur (tvb, TRUE)) {
/* This is probably a rpcap tcp package */
tcp_dissect_pdus (tvb, pinfo, tree, rpcap_desegment, 8,
- get_rpcap_pdu_len, dissect_rpcap);
+ get_rpcap_pdu_len, dissect_rpcap, data);
return TRUE;
}
@@ -1125,11 +1127,11 @@ dissect_rpcap_heur_tcp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
static gboolean
-dissect_rpcap_heur_udp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_rpcap_heur_udp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
if (check_rpcap_heur (tvb, FALSE)) {
/* This is probably a rpcap udp package */
- dissect_rpcap (tvb, pinfo, tree);
+ dissect_rpcap (tvb, pinfo, tree, data);
return TRUE;
}
@@ -1442,7 +1444,7 @@ proto_register_rpcap (void)
expert_module_t* expert_rpcap;
proto_rpcap = proto_register_protocol (PNAME, PSNAME, PFNAME);
- register_dissector (PFNAME, dissect_rpcap, proto_rpcap);
+ new_register_dissector (PFNAME, dissect_rpcap, proto_rpcap);
expert_rpcap = expert_register_protocol(proto_rpcap);
expert_register_field_array(expert_rpcap, ei, array_length(ei));
diff --git a/epan/dissectors/packet-rpki-rtr.c b/epan/dissectors/packet-rpki-rtr.c
index 55153c67c7..fd57c58d16 100644
--- a/epan/dissectors/packet-rpki-rtr.c
+++ b/epan/dissectors/packet-rpki-rtr.c
@@ -119,7 +119,7 @@ get_rpkirtr_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
}
-static void dissect_rpkirtr_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_rpkirtr_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti = NULL, *ti_flags;
@@ -240,12 +240,15 @@ static void dissect_rpkirtr_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
break;
}
}
+
+ return tvb_length(tvb);
}
-static void
-dissect_rpkirtr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_rpkirtr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
- tcp_dissect_pdus(tvb, pinfo, tree, 1, 8, get_rpkirtr_pdu_len, dissect_rpkirtr_pdu);
+ tcp_dissect_pdus(tvb, pinfo, tree, 1, 8, get_rpkirtr_pdu_len, dissect_rpkirtr_pdu, data);
+ return tvb_length(tvb);
}
void
@@ -379,7 +382,7 @@ proto_reg_handoff_rpkirtr(void)
if (!initialized) {
- rpkirtr_handle = create_dissector_handle(dissect_rpkirtr,
+ rpkirtr_handle = new_create_dissector_handle(dissect_rpkirtr,
proto_rpkirtr);
ssl_handle = find_dissector("ssl");
initialized = TRUE;
diff --git a/epan/dissectors/packet-s5066sis.c b/epan/dissectors/packet-s5066sis.c
index 9bcdddf236..352f116d06 100644
--- a/epan/dissectors/packet-s5066sis.c
+++ b/epan/dissectors/packet-s5066sis.c
@@ -36,9 +36,9 @@
/* Register functions */
void proto_reg_handoff_s5066(void);
/* Main dissectors */
-static void dissect_s5066_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+static int dissect_s5066_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data);
static guint get_s5066_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset);
-static void dissect_s5066_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+static int dissect_s5066_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_);
/* Service type and address dissectors */
static guint dissect_s5066_servicetype(tvbuff_t *tvb, guint offset, proto_tree *tree);
static guint dissect_s5066_address(tvbuff_t *tvb, guint offset, proto_tree *tree, gint source);
@@ -802,7 +802,7 @@ proto_reg_handoff_s5066(void)
static guint saved_s5066_port;
if (!Initialized) {
- s5066_tcp_handle = create_dissector_handle(dissect_s5066_tcp, proto_s5066);
+ s5066_tcp_handle = new_create_dissector_handle(dissect_s5066_tcp, proto_s5066);
data_handle = find_dissector("data");
Initialized = TRUE;
} else {
@@ -1267,25 +1267,26 @@ get_s5066_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return plen + s5066_header_size;
}
-static void
-dissect_s5066_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_s5066_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
/* Make sure there are enough bytes... */
if (tvb_length(tvb) < 5)
- return;
+ return 0;
/* Check if the first two bytes are 0x90 0xEB: if not,
then this is not a S5066 PDU or an unreassembled one.
The third byte is the STANAG 5066 version: Right now only 0x00 is defined. */
if( (tvb_get_guint8(tvb, 0) != 0x90) ||
(tvb_get_guint8(tvb, 1) != 0xEB) ||
(tvb_get_guint8(tvb, 2) != 0x00) ) {
- return;
+ return 0;
}
- tcp_dissect_pdus(tvb, pinfo, tree, s5066_desegment, s5066_header_size, get_s5066_pdu_len, dissect_s5066_common);
+ tcp_dissect_pdus(tvb, pinfo, tree, s5066_desegment, s5066_header_size, get_s5066_pdu_len, dissect_s5066_common, data);
+ return tvb_length(tvb);
}
-static void
-dissect_s5066_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_s5066_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
guint offset = 0;
guint pdu_size = 0;
@@ -1357,5 +1358,5 @@ dissect_s5066_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
next_tvb = tvb_new_subset(tvb, offset, MIN(available_length, reported_length), reported_length);
call_dissector(data_handle, next_tvb, pinfo, tree);
- return;
+ return tvb_length(tvb);
}
diff --git a/epan/dissectors/packet-sabp.c b/epan/dissectors/packet-sabp.c
index 9e43d0101f..7ea0638247 100644
--- a/epan/dissectors/packet-sabp.c
+++ b/epan/dissectors/packet-sabp.c
@@ -1836,8 +1836,8 @@ get_sabp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
}
-static void
-dissect_sabp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_sabp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *sabp_item = NULL;
proto_tree *sabp_tree = NULL;
@@ -1850,14 +1850,16 @@ dissect_sabp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
sabp_tree = proto_item_add_subtree(sabp_item, ett_sabp);
dissect_SABP_PDU_PDU(tvb, pinfo, sabp_tree, NULL);
+ return tvb_length(tvb);
}
/* Note a little bit of a hack assumes length max takes two bytes and that the length starts at byte 4 */
-static void
-dissect_sabp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_sabp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, gbl_sabp_desegment, 5,
- get_sabp_pdu_len, dissect_sabp);
+ get_sabp_pdu_len, dissect_sabp, data);
+ return tvb_length(tvb);
}
/*--- proto_register_sbap -------------------------------------------*/
@@ -2204,7 +2206,7 @@ void proto_register_sabp(void) {
"UnsuccessfulOutcome_value", HFILL }},
/*--- End of included file: packet-sabp-hfarr.c ---*/
-#line 250 "../../asn1/sabp/packet-sabp-template.c"
+#line 252 "../../asn1/sabp/packet-sabp-template.c"
};
/* List of subtrees */
@@ -2261,7 +2263,7 @@ void proto_register_sabp(void) {
&ett_sabp_UnsuccessfulOutcome,
/*--- End of included file: packet-sabp-ettarr.c ---*/
-#line 263 "../../asn1/sabp/packet-sabp-template.c"
+#line 265 "../../asn1/sabp/packet-sabp-template.c"
};
@@ -2272,8 +2274,8 @@ void proto_register_sabp(void) {
proto_register_subtree_array(ett, array_length(ett));
/* Register dissector */
- register_dissector("sabp", dissect_sabp, proto_sabp);
- register_dissector("sabp.tcp", dissect_sabp_tcp, proto_sabp);
+ new_register_dissector("sabp", dissect_sabp, proto_sabp);
+ new_register_dissector("sabp.tcp", dissect_sabp_tcp, proto_sabp);
/* Register dissector tables */
sabp_ies_dissector_table = register_dissector_table("sabp.ies", "SABP-PROTOCOL-IES", FT_UINT32, BASE_DEC);
@@ -2344,7 +2346,7 @@ proto_reg_handoff_sabp(void)
/*--- End of included file: packet-sabp-dis-tab.c ---*/
-#line 300 "../../asn1/sabp/packet-sabp-template.c"
+#line 302 "../../asn1/sabp/packet-sabp-template.c"
}
diff --git a/epan/dissectors/packet-sametime.c b/epan/dissectors/packet-sametime.c
index 06a219f9d4..dba4821a0e 100644
--- a/epan/dissectors/packet-sametime.c
+++ b/epan/dissectors/packet-sametime.c
@@ -504,8 +504,8 @@ dissect_sense_service(tvbuff_t *tvb, proto_tree *tree, int offset)
/*
here we really dissect the message(s)
*/
-static void
-dissect_sametime_content(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_sametime_content(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *sametime_tree;
proto_item *ti;
@@ -622,6 +622,7 @@ dissect_sametime_content(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
tap_queue_packet(sametime_tap, pinfo, sinfo);
+ return tvb_length(tvb);
}
@@ -679,14 +680,15 @@ get_sametime_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
/*
the dissector itself
*/
-static void
-dissect_sametime(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_sametime(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
col_set_str(pinfo->cinfo, COL_PROTOCOL, "SAMETIME");
col_clear(pinfo->cinfo,COL_INFO);
tcp_dissect_pdus(tvb, pinfo, tree, global_sametime_reassemble_packets, 4,
- get_sametime_message_len, dissect_sametime_content);
+ get_sametime_message_len, dissect_sametime_content, data);
+ return tvb_length(tvb);
}
@@ -920,7 +922,7 @@ proto_reg_handoff_sametime(void)
static guint saved_sametime_tcp_port;
if (!initialized) {
- sametime_handle = create_dissector_handle(dissect_sametime, proto_sametime);
+ sametime_handle = new_create_dissector_handle(dissect_sametime, proto_sametime);
stats_tree_register("sametime", "sametime", "Sametime/Messages", 0,
sametime_stats_tree_packet,
sametime_stats_tree_init, NULL );
diff --git a/epan/dissectors/packet-sasp.c b/epan/dissectors/packet-sasp.c
index ec83ffd0b0..b5a1d5e0d9 100644
--- a/epan/dissectors/packet-sasp.c
+++ b/epan/dissectors/packet-sasp.c
@@ -33,7 +33,6 @@
#include <epan/prefs.h>
/* forward reference */
-static void dissect_sasp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
static void dissect_reg_req(tvbuff_t *tvb, proto_tree *tree, guint32 offset);
static void dissect_dereg_req(tvbuff_t *tvb, proto_tree *tree, guint32 offset);
static void dissect_reg_rep(tvbuff_t *tvb, proto_tree *tree, guint32 offset);
@@ -325,18 +324,9 @@ get_sasp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return tvb_get_ntohl(tvb, offset + 5);
}
-
-static void
-dissect_sasp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
-{
- tcp_dissect_pdus(tvb, pinfo, tree, sasp_desegment, SASP_MIN_PACKET_LEN, get_sasp_pdu_len,
- (dissector_t)dissect_sasp_pdu);
-}
-
-
/* Called from tcp_dissect_pdus with a complete SASP pdu */
-static void
-dissect_sasp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_sasp_pdu(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;
@@ -366,7 +356,7 @@ dissect_sasp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
"Invalid SASP Header Type [0x%04x]", hdr_type);
/* XXX: The folowing should actually happen automatically ? */
col_set_str(pinfo->cinfo, COL_INFO, "[Malformed: Invalid SASP Header Type]");
- return;
+ return tvb_length(tvb);
}
offset += 2;
@@ -401,67 +391,67 @@ dissect_sasp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Registration Request */
col_set_str(pinfo->cinfo, COL_INFO, "Registration Request");
dissect_reg_req(tvb, pay_load, offset);
- return;
+ break;
case 0x1015:
/* Registration Reply */
col_set_str(pinfo->cinfo, COL_INFO, "Registration Reply");
dissect_reg_rep(tvb, pay_load, offset);
- return;
+ break;
case 0x1020:
/* Deregistration Request */
col_set_str(pinfo->cinfo, COL_INFO, "Deregistration Request");
dissect_dereg_req(tvb, pay_load, offset);
- return;
+ break;
case 0x1025:
/* Deregistration Reply */
col_set_str(pinfo->cinfo, COL_INFO, "Deregistration Reply");
dissect_dereg_rep(tvb, pay_load, offset);
- return;
+ break;
case 0x1030:
/* Get Weights Request */
col_set_str(pinfo->cinfo, COL_INFO, "Get Weights Request");
dissect_wt_req(tvb, pay_load, offset);
- return;
+ break;
case 0x1035:
/* Get Weights Response */
col_set_str(pinfo->cinfo, COL_INFO, "Get Weights Response");
dissect_wt_rep(tvb, pay_load, offset);
- return;
+ break;
case 0x1040:
/* Send Weights Request */
col_set_str(pinfo->cinfo, COL_INFO, "Send Weights Request");
dissect_sendwt(tvb, pay_load, offset);
- return;
+ break;
case 0x1050:
/* Set LB State Request */
col_set_str(pinfo->cinfo, COL_INFO, "Set LB State Request");
dissect_setlbstate_req(tvb, pay_load, offset);
- return;
+ break;
case 0x1055:
/* Set LB state Reply */
col_set_str(pinfo->cinfo, COL_INFO, "Set LB State Reply");
dissect_setlbstate_rep(tvb, pay_load, offset);
- return;
+ break;
case 0x1060:
/* Set Member State Request*/
col_set_str(pinfo->cinfo, COL_INFO, "Set Member State Request");
dissect_setmemstate_req(tvb, pay_load, offset);
- return;
+ break;
case 0x1065:
/* Set Member State Reply */
col_set_str(pinfo->cinfo, COL_INFO, "Set Member State Reply");
dissect_setmemstate_rep(tvb, pay_load, offset);
- return;
+ break;
default:
/* Unknown SASP Message Type */
@@ -469,8 +459,18 @@ dissect_sasp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
"[Malformed: Unknown Message Type [0x%04x]", msg_type);
expert_add_info_format(pinfo, mti, &ei_msg_type_invalid,
"Unknown SASP Message Type: 0x%4x", msg_type);
- return;
+ break;
}
+ return tvb_length(tvb);
+}
+
+
+static int
+dissect_sasp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
+{
+ tcp_dissect_pdus(tvb, pinfo, tree, sasp_desegment, SASP_MIN_PACKET_LEN, get_sasp_pdu_len,
+ dissect_sasp_pdu, data);
+ return tvb_length(tvb);
}
@@ -1580,7 +1580,7 @@ proto_reg_handoff_sasp(void)
{
dissector_handle_t sasp_handle;
- sasp_handle = create_dissector_handle(dissect_sasp, proto_sasp);
+ sasp_handle = new_create_dissector_handle(dissect_sasp, proto_sasp);
dissector_add_uint("tcp.port", SASP_GLOBAL_PORT, sasp_handle);
}
diff --git a/epan/dissectors/packet-scop.c b/epan/dissectors/packet-scop.c
index 9554cca785..589e76c569 100644
--- a/epan/dissectors/packet-scop.c
+++ b/epan/dissectors/packet-scop.c
@@ -75,8 +75,6 @@ typedef struct {
/* Function declarations */
void proto_reg_handoff_scop(void);
-static void dissect_scop (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-static void dissect_scop_tcp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
static void dissect_scop_zip (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
static void dissect_scop_bridge (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
@@ -129,50 +127,6 @@ static dissector_handle_t ieee802154_handle;
/*FUNCTION:------------------------------------------------------
* NAME
- * get_scop_length
- * DESCRIPTION
- * Returns the length of a SCoP packet. For use with the TCP
- * transport type.
- * PARAMETERS
- * packet_info *pinfo - pointer to packet information fields
- * tvbuff_t *tvb - pointer to buffer containing the packet.
- * int offset - beginning of packet.
- * RETURNS
- * guint - Length of SCoP packet
- *---------------------------------------------------------------
- */
-static guint
-get_scop_length(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
-{
- /* Byte 0: Protocol Type.
- * Byte 1: Protocol Version.
- * Bytes 2-3: Packet Length (network order).
- */
- return tvb_get_ntohs(tvb, offset + SCOP_LENGTH_OFFSET);
-} /* get_scop_length */
-
-/*FUNCTION:------------------------------------------------------
- * NAME
- * dissect_scop_tcp
- * DESCRIPTION
- * ZigBee SCoP packet dissection routine for Wireshark.
- * for use with TCP ports.
- * PARAMETERS
- * tvbuff_t *tvb - pointer to buffer containing raw packet.
- * packet_info *pinfo - pointer to packet information fields
- * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
- * RETURNS
- * void
- *---------------------------------------------------------------
- */
-static void
-dissect_scop_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
-{
- tcp_dissect_pdus(tvb, pinfo, tree, TRUE, SCOP_HEADER_LENGTH, get_scop_length, dissect_scop);
-} /* dissect_scop_tcp */
-
-/*FUNCTION:------------------------------------------------------
- * NAME
* dissect_scop
* DESCRIPTION
* ZigBee SCoP packet dissection routine for Wireshark.
@@ -184,8 +138,8 @@ dissect_scop_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* void
*---------------------------------------------------------------
*/
-static void
-dissect_scop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_scop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
tvbuff_t *next_tvb;
proto_item *proto_root;
@@ -225,7 +179,7 @@ dissect_scop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if ( (packet.transport == SCOP_TRANSPORT_UDP_CCM)
|| (packet.transport == SCOP_TRANSPORT_TCP_CCM)) {
/* Decryption Failed. */
- return;
+ return offset;
}
next_tvb = tvb;
@@ -249,10 +203,58 @@ dissect_scop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
call_dissector(data_handle, tvb_new_subset_remaining(next_tvb, offset), pinfo, tree);
break;
}
+
+ return tvb_length(tvb);
} /* dissect_scop() */
/*FUNCTION:------------------------------------------------------
* NAME
+ * get_scop_length
+ * DESCRIPTION
+ * Returns the length of a SCoP packet. For use with the TCP
+ * transport type.
+ * PARAMETERS
+ * packet_info *pinfo - pointer to packet information fields
+ * tvbuff_t *tvb - pointer to buffer containing the packet.
+ * int offset - beginning of packet.
+ * RETURNS
+ * guint - Length of SCoP packet
+ *---------------------------------------------------------------
+ */
+static guint
+get_scop_length(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+{
+ /* Byte 0: Protocol Type.
+ * Byte 1: Protocol Version.
+ * Bytes 2-3: Packet Length (network order).
+ */
+ return tvb_get_ntohs(tvb, offset + SCOP_LENGTH_OFFSET);
+} /* get_scop_length */
+
+/*FUNCTION:------------------------------------------------------
+ * NAME
+ * dissect_scop_tcp
+ * DESCRIPTION
+ * ZigBee SCoP packet dissection routine for Wireshark.
+ * for use with TCP ports.
+ * PARAMETERS
+ * tvbuff_t *tvb - pointer to buffer containing raw packet.
+ * packet_info *pinfo - pointer to packet information fields
+ * proto_tree *tree - pointer to data tree Wireshark uses to display packet.
+ * RETURNS
+ * void
+ *---------------------------------------------------------------
+ */
+static int
+dissect_scop_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
+{
+ tcp_dissect_pdus(tvb, pinfo, tree, TRUE, SCOP_HEADER_LENGTH, get_scop_length, dissect_scop, data);
+ return tvb_length(tvb);
+} /* dissect_scop_tcp */
+
+
+/*FUNCTION:------------------------------------------------------
+ * NAME
* dissect_scop_zip
* DESCRIPTION
* Intermediate dissector for the SCoP service type.
@@ -374,8 +376,8 @@ void proto_register_scop(void)
10, &gPREF_scop_port_secured);
/* Register dissector with Wireshark. */
- register_dissector("scop.udp", dissect_scop, proto_scop);
- register_dissector("scop.tcp", dissect_scop_tcp, proto_scop);
+ new_register_dissector("scop.udp", dissect_scop, proto_scop);
+ new_register_dissector("scop.tcp", dissect_scop_tcp, proto_scop);
} /* proto_register_scop() */
/*FUNCTION:------------------------------------------------------
diff --git a/epan/dissectors/packet-selfm.c b/epan/dissectors/packet-selfm.c
index 441df61e5a..d491500714 100644
--- a/epan/dissectors/packet-selfm.c
+++ b/epan/dissectors/packet-selfm.c
@@ -2247,8 +2247,8 @@ dissect_fastser_frame(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int o
/* Code to dissect SEL Fast Message Protocol packets */
/* Will call other sub-dissectors, as needed */
/******************************************************************************************************/
-static void
-dissect_selfm(tvbuff_t *selfm_tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_selfm(tvbuff_t *selfm_tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
/* Set up structures needed to add the protocol subtree and manage it */
proto_item *selfm_item=NULL;
@@ -2441,6 +2441,7 @@ dissect_selfm(tvbuff_t *selfm_tvb, packet_info *pinfo, proto_tree *tree)
} /* remaining length > 0 */
} /* tree */
+ return tvb_length(selfm_tvb);
}
/******************************************************************************************************/
@@ -2469,7 +2470,7 @@ get_selfm_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset _U_)
/* Dissect (and possibly Re-assemble) SEL protocol payload data */
/******************************************************************************************************/
static gboolean
-dissect_selfm_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_selfm_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
tvbuff_t *selfm_tvb;
@@ -2492,7 +2493,7 @@ dissect_selfm_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
tcp_dissect_pdus(selfm_tvb, pinfo, tree, selfm_desegment, 2,
- get_selfm_len, dissect_selfm);
+ get_selfm_len, dissect_selfm, data);
return TRUE;
}
@@ -2501,7 +2502,7 @@ dissect_selfm_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
/* Dissect "simple" SEL protocol payload (no TCP re-assembly) */
/******************************************************************************************************/
static gboolean
-dissect_selfm_simple(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_selfm_simple(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
gint length = tvb_length(tvb);
@@ -2511,7 +2512,7 @@ dissect_selfm_simple(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *
return FALSE;
}
- dissect_selfm(tvb, pinfo, tree);
+ dissect_selfm(tvb, pinfo, tree, data);
return TRUE;
}
diff --git a/epan/dissectors/packet-simulcrypt.c b/epan/dissectors/packet-simulcrypt.c
index 62834a813a..c2376e7c18 100644
--- a/epan/dissectors/packet-simulcrypt.c
+++ b/epan/dissectors/packet-simulcrypt.c
@@ -64,7 +64,7 @@ static ecm_interpretation tab_ecm_inter[] = {
#define ECM_INTERPRETATION_SIZE (sizeof(tab_ecm_inter)/sizeof(ecm_interpretation))
-static void dissect_simulcrypt_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+static int dissect_simulcrypt_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_);
static guint get_simulcrypt_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset);
static void dissect_simulcrypt_data(proto_tree *simulcrypt_tree, proto_item *simulcrypt_item, packet_info *pinfo _U_,
tvbuff_t *tvb, proto_tree *tree, int offset,
@@ -682,11 +682,12 @@ static gint ett_simulcrypt_table_period_pair = -1;
#define FRAME_HEADER_LEN 8
/* The main dissecting routine */
-static void
-dissect_simulcrypt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_simulcrypt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, FRAME_HEADER_LEN,
- get_simulcrypt_message_len, dissect_simulcrypt_message);
+ get_simulcrypt_message_len, dissect_simulcrypt_message, data);
+ return tvb_length(tvb);
}
/* Informative tree structure is shown here:
@@ -1197,8 +1198,8 @@ dissect_psig_parameter_value (proto_tree *tree, tvbuff_t *tvb, packet_info *pinf
}
/* This method dissects fully reassembled messages */
-static void
-dissect_simulcrypt_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_simulcrypt_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *simulcrypt_item;
proto_tree *simulcrypt_tree;
@@ -1268,6 +1269,8 @@ dissect_simulcrypt_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dissect_simulcrypt_data(simulcrypt_message_tree, simulcrypt_item, pinfo, tvb, tree, offset, (msg_length+5), iftype, FALSE); /* offset is from beginning of the 5 byte header */
} /* end tree */
+
+ return tvb_length(tvb);
}
/* this method is used to dissect TLV parameters */
@@ -1838,7 +1841,7 @@ proto_reg_handoff_simulcrypt(void)
guint i;
if (!initialized) {
- simulcrypt_handle = create_dissector_handle(dissect_simulcrypt, proto_simulcrypt);
+ simulcrypt_handle = new_create_dissector_handle(dissect_simulcrypt, proto_simulcrypt);
for(i=0;i<ECM_INTERPRETATION_SIZE;i++)
{
tab_ecm_inter[i].protocol_handle = find_dissector(tab_ecm_inter[i].protocol_name);
diff --git a/epan/dissectors/packet-skinny.c b/epan/dissectors/packet-skinny.c
index bd37958599..5d36067a2d 100644
--- a/epan/dissectors/packet-skinny.c
+++ b/epan/dissectors/packet-skinny.c
@@ -1421,8 +1421,8 @@ dissect_skinny_xml(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, const gi
}
/* Dissect a single SCCP PDU */
-static void
-dissect_skinny_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_skinny_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
int offset = 0;
gboolean is_video = FALSE; /* FIX ME: need to indicate video or not */
@@ -3458,12 +3458,13 @@ dissect_skinny_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
tap_queue_packet(skinny_tap, pinfo, si);
+ return tvb_length(tvb);
}
/* Code to actually dissect the packets */
static gboolean
-dissect_skinny(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_skinny(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
/* The general structure of a packet: {IP-Header|TCP-Header|n*SKINNY}
* SKINNY-Packet: {Header(Size, Reserved)|Data(MessageID, Message-Data)}
@@ -3503,7 +3504,7 @@ dissect_skinny(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
col_set_str(pinfo->cinfo, COL_INFO, "Skinny Client Control Protocol");
tcp_dissect_pdus(tvb, pinfo, tree, skinny_desegment, 4,
- get_skinny_pdu_len, dissect_skinny_pdu);
+ get_skinny_pdu_len, dissect_skinny_pdu, data);
return TRUE;
}
diff --git a/epan/dissectors/packet-slsk.c b/epan/dissectors/packet-slsk.c
index 2fb7cbf887..4cc5201cae 100644
--- a/epan/dissectors/packet-slsk.c
+++ b/epan/dissectors/packet-slsk.c
@@ -301,7 +301,7 @@ static guint get_slsk_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
/* Code to actually dissect the packets */
-static void dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
/* Set up structures needed to add the protocol subtree and manage it */
@@ -2381,14 +2381,14 @@ static void dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
expert_add_info(pinfo, ti_len, &ei_slsk_unknown_data);
}
-
+ return tvb_length(tvb);
}
-static void dissect_slsk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_slsk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
- tcp_dissect_pdus(tvb, pinfo, tree, slsk_desegment, 4, get_slsk_pdu_len, dissect_slsk_pdu);
-
+ tcp_dissect_pdus(tvb, pinfo, tree, slsk_desegment, 4, get_slsk_pdu_len, dissect_slsk_pdu, data);
+ return tvb_length(tvb);
}
@@ -2630,7 +2630,7 @@ proto_reg_handoff_slsk(void)
{
dissector_handle_t slsk_handle;
- slsk_handle = create_dissector_handle(dissect_slsk, proto_slsk);
+ slsk_handle = new_create_dissector_handle(dissect_slsk, proto_slsk);
dissector_add_uint("tcp.port", TCP_PORT_SLSK_1, slsk_handle);
dissector_add_uint("tcp.port", TCP_PORT_SLSK_2, slsk_handle);
dissector_add_uint("tcp.port", TCP_PORT_SLSK_3, slsk_handle);
diff --git a/epan/dissectors/packet-smpp.c b/epan/dissectors/packet-smpp.c
index 193e1b4bfb..0fb5ae9068 100644
--- a/epan/dissectors/packet-smpp.c
+++ b/epan/dissectors/packet-smpp.c
@@ -83,9 +83,9 @@
#define SMPP_MIN_LENGTH 16
/* Forward declarations */
-static void dissect_smpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+static int dissect_smpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data);
static guint get_smpp_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset);
-static void dissect_smpp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+static int dissect_smpp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_);
/*
* Initialize the protocol and registered fields
@@ -2358,7 +2358,7 @@ huawei_sm_result_notify_resp(proto_tree *tree, tvbuff_t *tvb)
* has a 'well-known' or 'reserved' status
*/
static gboolean
-dissect_smpp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_smpp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
guint command_id; /* SMPP command */
guint command_status; /* Status code */
@@ -2376,7 +2376,7 @@ dissect_smpp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
if (try_val_to_str(command_status, vals_command_status) == NULL &&
try_rval_to_str(command_status, reserved_command_status) == NULL)
return FALSE;
- dissect_smpp(tvb, pinfo, tree);
+ dissect_smpp(tvb, pinfo, tree, data);
return TRUE;
}
@@ -2396,8 +2396,8 @@ get_smpp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
*/
static gboolean first = TRUE;
-static void
-dissect_smpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_smpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
first = TRUE;
if (pinfo->ptype == PT_TCP) { /* are we running on top of TCP */
@@ -2405,7 +2405,7 @@ dissect_smpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
reassemble_over_tcp, /* Do we try to reassemble */
16, /* Length of fixed header */
get_smpp_pdu_len, /* Function returning PDU len */
- dissect_smpp_pdu); /* PDU dissector */
+ dissect_smpp_pdu, data); /* PDU dissector */
} else { /* no? probably X.25 */
guint32 offset = 0;
while (tvb_reported_length_remaining(tvb, offset) > 0) {
@@ -2417,21 +2417,23 @@ dissect_smpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
THROW(ReportedBoundsError);
if (pdu_real_len <= 0)
- return;
+ return offset;
if (pdu_real_len > pdu_len)
pdu_real_len = pdu_len;
pdu_tvb = tvb_new_subset(tvb, offset, pdu_real_len, pdu_len);
- dissect_smpp_pdu(pdu_tvb, pinfo, tree);
+ dissect_smpp_pdu(pdu_tvb, pinfo, tree, data);
offset += pdu_len;
first = FALSE;
}
}
+
+ return tvb_length(tvb);
}
/* Dissect a single SMPP PDU contained within "tvb". */
-static void
-dissect_smpp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_smpp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
int offset = 0; /* Offset within tvbuff */
guint command_length; /* length of PDU */
@@ -2450,7 +2452,7 @@ dissect_smpp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* when the mandatory header isn't present.
*/
if (tvb_reported_length(tvb) < SMPP_MIN_LENGTH)
- return;
+ return 0;
command_length = tvb_get_ntohl(tvb, offset);
offset += 4;
command_id = tvb_get_ntohl(tvb, offset);
@@ -2726,7 +2728,7 @@ dissect_smpp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
first = FALSE;
}
- return;
+ return tvb_length(tvb);
}
@@ -3766,7 +3768,7 @@ proto_register_smpp(void)
proto_register_subtree_array(ett, array_length(ett));
/* Allow other dissectors to find this one by name. */
- register_dissector("smpp", dissect_smpp, proto_smpp);
+ new_register_dissector("smpp", dissect_smpp, proto_smpp);
/* Register for tapping */
smpp_tap = register_tap("smpp");
diff --git a/epan/dissectors/packet-soupbintcp.c b/epan/dissectors/packet-soupbintcp.c
index fbfce61173..d5f7af625b 100644
--- a/epan/dissectors/packet-soupbintcp.c
+++ b/epan/dissectors/packet-soupbintcp.c
@@ -453,28 +453,30 @@ get_soupbintcp_pdu_len(
/** Dissect a possibly-reassembled TCP PDU */
-static void
+static int
dissect_soupbintcp_tcp_pdu(
tvbuff_t *tvb,
packet_info *pinfo,
- proto_tree *tree)
+ proto_tree *tree, void* data _U_)
{
col_set_str(pinfo->cinfo, COL_PROTOCOL, "SoupBinTCP");
dissect_soupbintcp_common(tvb, pinfo, tree);
+ return tvb_length(tvb);
}
/** Dissect a TCP segment containing SoupBinTCP data */
-static void
+static int
dissect_soupbintcp_tcp(
tvbuff_t *tvb,
packet_info *pinfo,
- proto_tree *tree)
+ proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree,
soupbintcp_desegment, 2,
get_soupbintcp_pdu_len,
- dissect_soupbintcp_tcp_pdu);
+ dissect_soupbintcp_tcp_pdu, data);
+ return tvb_length(tvb);
}
static void
@@ -613,7 +615,7 @@ proto_register_soupbintcp(void)
void
proto_reg_handoff_soupbintcp(void)
{
- soupbintcp_handle = create_dissector_handle(dissect_soupbintcp_tcp,
+ soupbintcp_handle = new_create_dissector_handle(dissect_soupbintcp_tcp,
proto_soupbintcp);
/* For "decode-as" */
diff --git a/epan/dissectors/packet-srvloc.c b/epan/dissectors/packet-srvloc.c
index 624a046922..f8addd577b 100644
--- a/epan/dissectors/packet-srvloc.c
+++ b/epan/dissectors/packet-srvloc.c
@@ -1412,8 +1412,8 @@ get_srvloc_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return tvb_get_ntohs(tvb, offset + 2);
}
-static void
-dissect_srvloc_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_srvloc_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *srvloc_tree = NULL;
proto_item *ti;
@@ -1427,10 +1427,11 @@ dissect_srvloc_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
srvloc_tree = proto_item_add_subtree(ti, ett_srvloc);
}
dissect_srvloc(tvb, pinfo, srvloc_tree, NULL);
+ return tvb_length(tvb);
}
-static void
-dissect_srvloc_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_srvloc_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
/*
* XXX - in SLPv1, the fixed length need only be 4, as the length
@@ -1441,7 +1442,8 @@ dissect_srvloc_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* and we can't handle a length < 4 anyway.
*/
tcp_dissect_pdus(tvb, pinfo, tree, srvloc_desegment, 5, get_srvloc_pdu_len,
- dissect_srvloc_pdu);
+ dissect_srvloc_pdu, data);
+ return tvb_length(tvb);
}
/* Register protocol with Wireshark. */
@@ -1915,7 +1917,7 @@ proto_reg_handoff_srvloc(void)
dissector_handle_t srvloc_handle, srvloc_tcp_handle;
srvloc_handle = new_create_dissector_handle(dissect_srvloc, proto_srvloc);
dissector_add_uint("udp.port", UDP_PORT_SRVLOC, srvloc_handle);
- srvloc_tcp_handle = create_dissector_handle(dissect_srvloc_tcp,
+ srvloc_tcp_handle = new_create_dissector_handle(dissect_srvloc_tcp,
proto_srvloc);
dissector_add_uint("tcp.port", TCP_PORT_SRVLOC, srvloc_tcp_handle);
}
diff --git a/epan/dissectors/packet-starteam.c b/epan/dissectors/packet-starteam.c
index c23e8ea1cc..a6251bb083 100644
--- a/epan/dissectors/packet-starteam.c
+++ b/epan/dissectors/packet-starteam.c
@@ -483,8 +483,8 @@ starteam_init(void)
iPreviousFrameNumber = -1;
}
-static void
-dissect_starteam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_starteam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
gint offset = 0;
@@ -573,6 +573,8 @@ dissect_starteam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
}
+
+ return tvb_length(tvb);
}
static guint
@@ -589,15 +591,16 @@ get_starteam_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return iPDULength;
}
-static void
-dissect_starteam_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_starteam_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
- tcp_dissect_pdus(tvb, pinfo, tree, starteam_desegment, 8, get_starteam_pdu_len, dissect_starteam);
+ tcp_dissect_pdus(tvb, pinfo, tree, starteam_desegment, 8, get_starteam_pdu_len, dissect_starteam, data);
+ return tvb_length(tvb);
}
static gboolean
-dissect_starteam_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_starteam_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
if(tvb_length(tvb) >= 32){
gint iOffsetLengths = -1;
@@ -619,7 +622,7 @@ dissect_starteam_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
conversation_set_dissector(conversation, starteam_tcp_handle);
/* Dissect the packet */
- dissect_starteam(tvb, pinfo, tree);
+ dissect_starteam(tvb, pinfo, tree, data);
return TRUE;
}
}
@@ -709,5 +712,5 @@ void
proto_reg_handoff_starteam(void)
{
heur_dissector_add("tcp", dissect_starteam_heur, proto_starteam);
- starteam_tcp_handle = create_dissector_handle(dissect_starteam_tcp, proto_starteam);
+ starteam_tcp_handle = new_create_dissector_handle(dissect_starteam_tcp, proto_starteam);
}
diff --git a/epan/dissectors/packet-stun.c b/epan/dissectors/packet-stun.c
index a813aa0874..2341bd4c25 100644
--- a/epan/dissectors/packet-stun.c
+++ b/epan/dissectors/packet-stun.c
@@ -1065,22 +1065,17 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboole
}
static int
-dissect_stun_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_stun(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
return dissect_stun_message(tvb, pinfo, tree, FALSE);
}
-static void
-dissect_stun_message_no_return(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
-{
- dissect_stun_message(tvb, pinfo, tree, FALSE);
-}
-
-static void
-dissect_stun_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_stun_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, MIN_HDR_LEN,
- get_stun_message_len, dissect_stun_message_no_return);
+ get_stun_message_len, dissect_stun, data);
+ return tvb_length(tvb);
}
static gboolean
@@ -1333,7 +1328,7 @@ proto_register_stun(void)
/* heuristic subdissectors (used for the DATA field) */
register_heur_dissector_list("stun", &heur_subdissector_list);
- new_register_dissector("stun-udp", dissect_stun_udp, proto_stun);
+ new_register_dissector("stun-udp", dissect_stun, proto_stun);
new_register_dissector("stun-heur", dissect_stun_heur, proto_stun);
}
@@ -1343,8 +1338,8 @@ proto_reg_handoff_stun(void)
dissector_handle_t stun_tcp_handle;
dissector_handle_t stun_udp_handle;
- stun_tcp_handle = create_dissector_handle(dissect_stun_tcp, proto_stun);
- stun_udp_handle = new_create_dissector_handle(dissect_stun_udp, proto_stun);
+ stun_tcp_handle = new_create_dissector_handle(dissect_stun_tcp, proto_stun);
+ stun_udp_handle = new_create_dissector_handle(dissect_stun, proto_stun);
dissector_add_uint("tcp.port", TCP_PORT_STUN, stun_tcp_handle);
dissector_add_uint("udp.port", UDP_PORT_STUN, stun_udp_handle);
diff --git a/epan/dissectors/packet-synphasor.c b/epan/dissectors/packet-synphasor.c
index 6fcee1a495..a7b58c8592 100644
--- a/epan/dissectors/packet-synphasor.c
+++ b/epan/dissectors/packet-synphasor.c
@@ -448,30 +448,6 @@ static void synphasor_init(void)
}
-/* the main dissection routine */
-static void dissect_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-
-/* called for synchrophasors over UDP */
-static int dissect_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
-{
- dissect_common(tvb, pinfo, tree);
-
- return tvb_length(tvb);
-}
-
-/* callback for 'tcp_dissect_pdus()' to give it the length of the frame */
-static guint get_pdu_length(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
-{
- return tvb_get_ntohs(tvb, offset + 2);
-}
-
-static int dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
-{
- tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 4, get_pdu_length, dissect_common);
-
- return tvb_length(tvb);
-}
-
/* Checks the CRC of a synchrophasor frame, 'tvb' has to include the whole
* frame, including CRC, the calculated CRC is returned in '*computedcrc'.
*/
@@ -501,7 +477,7 @@ static gint dissect_header(tvbuff_t *, proto_tree *);
/* Dissects the header (common to all types of frames) and then calls
* one of the subdissectors (declared above) for the rest of the frame.
*/
-static void dissect_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
guint8 frame_type;
guint16 crc;
@@ -511,7 +487,7 @@ static void dissect_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (tvbsize < 17 /* 17 bytes = header frame with only a
NULL character, useless but valid */
|| tvb_get_guint8(tvb, 0) != 0xAA) /* every synchrophasor frame starts with 0xAA */
- return;
+ return 0;
/* write the protocol name to the info column */
col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTOCOL_SHORT_NAME);
@@ -617,8 +593,30 @@ static void dissect_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/*offset += 2;*/ /* CRC */
} /* if (tree) */
+
+ return tvb_length(tvb);
} /* dissect_synphasor() */
+/* called for synchrophasors over UDP */
+static int dissect_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
+{
+ return dissect_common(tvb, pinfo, tree, data);
+}
+
+/* callback for 'tcp_dissect_pdus()' to give it the length of the frame */
+static guint get_pdu_length(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+{
+ return tvb_get_ntohs(tvb, offset + 2);
+}
+
+static int dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
+{
+ tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 4, get_pdu_length, dissect_common, data);
+
+ return tvb_length(tvb);
+}
+
+
/* Dissects the common header of frames.
*
* Returns the framesize, in contrast to most
diff --git a/epan/dissectors/packet-tali.c b/epan/dissectors/packet-tali.c
index a18b2971b3..0eb02eba6a 100644
--- a/epan/dissectors/packet-tali.c
+++ b/epan/dissectors/packet-tali.c
@@ -97,8 +97,8 @@ get_tali_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return length+TALI_HEADER_LENGTH;
}
-static void
-dissect_tali_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_tali_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
char opcode[TALI_OPCODE_LENGTH+1]; /* TALI opcode */
guint16 length; /* TALI length */
@@ -133,13 +133,16 @@ dissect_tali_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
call_dissector(data_handle, payload_tvb, pinfo, tree);
}
}
+
+ return tvb_length(tvb);
}
-static void
-dissect_tali(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_tali(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, tali_desegment, TALI_HEADER_LENGTH,
- get_tali_pdu_len, dissect_tali_pdu);
+ get_tali_pdu_len, dissect_tali_pdu, data);
+ return tvb_length(tvb);
}
/*
@@ -150,7 +153,7 @@ dissect_tali(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* it is a 'well-known' operation
*/
static gboolean
-dissect_tali_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_tali_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
char opcode[TALI_OPCODE_LENGTH]; /* TALI opcode */
@@ -173,7 +176,7 @@ dissect_tali_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
strncmp(opcode, TALI_SAAL, TALI_OPCODE_LENGTH) != 0)
return FALSE;
- dissect_tali(tvb, pinfo, tree);
+ dissect_tali(tvb, pinfo, tree, data);
return TRUE;
}
@@ -203,7 +206,7 @@ proto_register_tali(void)
proto_tali = proto_register_protocol("Transport Adapter Layer Interface v1.0, RFC 3094", "TALI", "tali");
hfi_tali = proto_registrar_get_nth(proto_tali);
- register_dissector("tali", dissect_tali, proto_tali);
+ new_register_dissector("tali", dissect_tali, proto_tali);
/* Required function calls to register the header fields and subtrees used */
proto_register_fields(proto_tali, hfi, array_length(hfi));
diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c
index 3464005607..0a69279948 100644
--- a/epan/dissectors/packet-tcp.c
+++ b/epan/dissectors/packet-tcp.c
@@ -2082,7 +2082,7 @@ void
tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
gboolean proto_desegment, guint fixed_len,
guint (*get_pdu_len)(packet_info *, tvbuff_t *, int),
- dissector_t dissect_pdu)
+ new_dissector_t dissect_pdu, void* dissector_data)
{
volatile int offset = 0;
int offset_before;
@@ -2235,7 +2235,7 @@ tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
*/
pd_save = pinfo->private_data;
TRY {
- (*dissect_pdu)(next_tvb, pinfo, tree);
+ (*dissect_pdu)(next_tvb, pinfo, tree, dissector_data);
}
CATCH_NONFATAL_ERRORS {
/* Restore the private_data structure in case one of the
diff --git a/epan/dissectors/packet-tcp.h b/epan/dissectors/packet-tcp.h
index b1a5fc807e..4e2864c5de 100644
--- a/epan/dissectors/packet-tcp.h
+++ b/epan/dissectors/packet-tcp.h
@@ -113,7 +113,7 @@ WS_DLL_PUBLIC void
tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
gboolean proto_desegment, guint fixed_len,
guint (*get_pdu_len)(packet_info *, tvbuff_t *, int),
- dissector_t dissect_pdu);
+ new_dissector_t dissect_pdu, void* dissector_data);
extern struct tcp_multisegment_pdu *
pdu_store_sequencenumber_of_next_pdu(packet_info *pinfo, guint32 seq, guint32 nxtpdu, wmem_tree_t *multisegment_pdus);
diff --git a/epan/dissectors/packet-tipc.c b/epan/dissectors/packet-tipc.c
index 4ca6ce6460..7287f3f4c2 100644
--- a/epan/dissectors/packet-tipc.c
+++ b/epan/dissectors/packet-tipc.c
@@ -560,7 +560,7 @@ static const value_string tipcv2_networkplane_strings[] = {
};
/* functions forward declarations */
-static void dissect_tipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+static int dissect_tipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_);
void proto_reg_handoff_tipc(void);
static reassembly_table tipc_msg_reassembly_table;
@@ -966,7 +966,7 @@ dissect_tipc_v2_internal_msg(tvbuff_t *tipc_tvb, proto_tree *tipc_tree, packet_i
col_append_str(pinfo->cinfo, COL_INFO, " | ");
col_set_fence(pinfo->cinfo, COL_INFO);
- dissect_tipc(data_tvb, pinfo, top_tree);
+ dissect_tipc(data_tvb, pinfo, top_tree, NULL);
/* the modulo is used to align the messages to 4 Bytes */
offset += msg_in_bundle_size + ((msg_in_bundle_size%4)?(4-(msg_in_bundle_size%4)):0);
@@ -1422,7 +1422,7 @@ dissect_tipc_v2_internal_msg(tvbuff_t *tipc_tvb, proto_tree *tipc_tree, packet_i
* encapsulated messages */
col_append_str(pinfo->cinfo, COL_INFO, " | ");
col_set_fence(pinfo->cinfo, COL_INFO);
- dissect_tipc(new_tvb, pinfo, top_tree);
+ dissect_tipc(new_tvb, pinfo, top_tree, NULL);
} else { /* make a new subset */
data_tvb = tvb_new_subset(tipc_tvb, offset, len, reported_len);
call_dissector(data_handle, data_tvb, pinfo, top_tree);
@@ -1915,7 +1915,7 @@ dissect_tipc_int_prot_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tipc_tr
val_to_str_const(msg_type, tipc_cng_prot_msg_type_values, "unknown"), msg_type);
data_tvb = tvb_new_subset_remaining(tvb, offset);
col_set_fence(pinfo->cinfo, COL_INFO);
- dissect_tipc(data_tvb, pinfo, tipc_tree);
+ dissect_tipc(data_tvb, pinfo, tipc_tree, NULL);
break;
default:
/* INFO_MSG: Even when there are no packets in the send queue of a removed link, the other
@@ -1977,7 +1977,7 @@ dissect_tipc_int_prot_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tipc_tr
pinfo->fragmented = save_fragmented;
if (new_tvb) {
col_set_fence(pinfo->cinfo, COL_INFO);
- dissect_tipc(next_tvb, pinfo, tipc_tree);
+ dissect_tipc(next_tvb, pinfo, tipc_tree, NULL);
return;
}
@@ -1991,7 +1991,7 @@ dissect_tipc_int_prot_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tipc_tr
proto_tree_add_text(tipc_tree, tvb, offset, msg_in_bundle_size, "%u Message in Bundle", msg_no);
data_tvb = tvb_new_subset(tvb, offset, msg_in_bundle_size, msg_in_bundle_size);
col_set_fence(pinfo->cinfo, COL_INFO);
- dissect_tipc(data_tvb, pinfo, tipc_tree);
+ dissect_tipc(data_tvb, pinfo, tipc_tree, NULL);
offset = offset + msg_in_bundle_size;
}
break;
@@ -2012,15 +2012,15 @@ get_tipc_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
/* triggers the dissection of TIPC-over-TCP */
static int
-dissect_tipc_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *data _U_)
+dissect_tipc_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *data)
{
tcp_dissect_pdus(tvb, pinfo, parent_tree, tipc_tcp_desegment, 4, get_tipc_pdu_len,
- dissect_tipc);
+ dissect_tipc, data);
return tvb_length(tvb);
}
-static void
-dissect_tipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_tipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti, *tipc_data_item, *item;
proto_tree *tipc_tree, *tipc_data_tree;
@@ -2147,7 +2147,7 @@ dissect_tipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tipc_tree = proto_item_add_subtree(ti, ett_tipc);
if (version == TIPCv2) {
dissect_tipc_v2(tipc_tvb, tipc_tree, pinfo, offset, user, msg_size, hdr_size, datatype_hdr);
- return;
+ return tvb_length(tvb);
}
/* Word 0-2 common for all messages */
@@ -2184,7 +2184,7 @@ dissect_tipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TIPC_SEGMENTATION_MANAGER:
case TIPC_MSG_BUNDLER:
dissect_tipc_int_prot_msg(tipc_tvb, pinfo, tipc_tree, offset, user, msg_size);
- return;
+ return tvb_length(tvb);
default:
break;
}
@@ -2262,7 +2262,7 @@ dissect_tipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tipc_data_tree = proto_item_add_subtree(tipc_data_item , ett_tipc_data);
data_tvb = tvb_new_subset_remaining(tipc_tvb, offset);
dissect_tipc_name_dist_data(data_tvb, tipc_data_tree, 0);
- return;
+ return tvb_length(tvb);
} else {
/* Port name type / Connection level sequence number */
proto_tree_add_text(tipc_tree, tipc_tvb, offset, 4, "Port name type / Connection level sequence number");
@@ -2298,6 +2298,8 @@ dissect_tipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
call_tipc_v2_data_subdissectors(next_tvb, pinfo, name_type_p, user);
}
} /*if (hdr_size <= 5) */
+
+ return tvb_length(tvb);
}
/* Register TIPC with Wireshark */
@@ -2921,7 +2923,7 @@ proto_register_tipc(void)
register_heur_dissector_list("tipc", &tipc_heur_subdissector_list);
/* Register by name */
- register_dissector("tipc", dissect_tipc, proto_tipc);
+ new_register_dissector("tipc", dissect_tipc, proto_tipc);
register_init_routine(tipc_defragment_init);
@@ -2979,7 +2981,7 @@ proto_reg_handoff_tipc(void)
static range_t *tipc_udp_port_range;
if (!inited) {
- tipc_handle = create_dissector_handle(dissect_tipc, proto_tipc);
+ tipc_handle = new_create_dissector_handle(dissect_tipc, proto_tipc);
tipc_tcp_handle = new_create_dissector_handle(dissect_tipc_tcp, proto_tipc);
ip_handle = find_dissector("ip");
data_handle = find_dissector("data");
diff --git a/epan/dissectors/packet-tns.c b/epan/dissectors/packet-tns.c
index fb006d8bcf..ba2958c54a 100644
--- a/epan/dissectors/packet-tns.c
+++ b/epan/dissectors/packet-tns.c
@@ -192,7 +192,7 @@ static const value_string tns_control_cmds[] = {
void proto_reg_handoff_tns(void);
static guint get_tns_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset);
-static void dissect_tns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+static int dissect_tns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_);
static void dissect_tns_service_options(tvbuff_t *tvb, int offset,
proto_tree *sopt_tree)
@@ -841,7 +841,7 @@ get_tns_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
}
static int
-dissect_tns(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_tns(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
guint8 type;
@@ -860,12 +860,12 @@ dissect_tns(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
}
tcp_dissect_pdus(tvb, pinfo, tree, tns_desegment, 2,
- get_tns_pdu_len, dissect_tns_pdu);
+ get_tns_pdu_len, dissect_tns_pdu, data);
return tvb_length(tvb);
}
-static void
-dissect_tns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_tns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *tns_tree = NULL, *ti;
proto_item *hidden_item;
@@ -971,6 +971,8 @@ dissect_tns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tns_tree);
break;
}
+
+ return tvb_length(tvb);
}
void proto_register_tns(void)
diff --git a/epan/dissectors/packet-tpncp.c b/epan/dissectors/packet-tpncp.c
index 9620169af2..cbbf0ed170 100644
--- a/epan/dissectors/packet-tpncp.c
+++ b/epan/dissectors/packet-tpncp.c
@@ -249,7 +249,7 @@ static void dissect_tpncp_command(gint command_id, tvbuff_t *tvb,
/*-------------------------------------------------------------------------------------------------------------------------------------------*/
-static void dissect_tpncp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
+static int dissect_tpncp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) {
proto_item *item = NULL, *tpncp_item = NULL;
proto_tree *tpncp_tree = NULL;
gint offset = 0;
@@ -315,6 +315,8 @@ static void dissect_tpncp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
}
}
}
+
+ return tvb_length(tvb);
}
/*-------------------------------------------------------------------------------------------------------------------------------------------*/
@@ -332,13 +334,15 @@ static guint get_tpncp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, gint offse
/*-------------------------------------------------------------------------------------------------------------------------------------------*/
-static void dissect_tpncp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
+static int dissect_tpncp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) {
if (pinfo->can_desegment)
/* If desegmentation is enabled (TCP preferences) use the desegmentation API. */
- tcp_dissect_pdus(tvb, pinfo, tree, tpncp_desegment, 4, get_tpncp_pdu_len, dissect_tpncp);
+ tcp_dissect_pdus(tvb, pinfo, tree, tpncp_desegment, 4, get_tpncp_pdu_len, dissect_tpncp, data);
else
/* Otherwise use the regular dissector (might not give correct dissection). */
- dissect_tpncp(tvb, pinfo, tree);
+ dissect_tpncp(tvb, pinfo, tree, data);
+
+ return tvb_length(tvb);
}
/*-------------------------------------------------------------------------------------------------------------------------------------------*/
@@ -767,7 +771,7 @@ void proto_reg_handoff_tpncp(void) {
return;
if (!tpncp_prefs_initialized) {
- tpncp_tcp_handle = create_dissector_handle(dissect_tpncp_tcp, proto_tpncp);
+ tpncp_tcp_handle = new_create_dissector_handle(dissect_tpncp_tcp, proto_tpncp);
tpncp_prefs_initialized = TRUE;
}
@@ -829,7 +833,7 @@ void proto_register_tpncp(void) {
proto_register_subtree_array(ett, array_length(ett));
- tpncp_handle = register_dissector("tpncp", dissect_tpncp, proto_tpncp);
+ tpncp_handle = new_register_dissector("tpncp", dissect_tpncp, proto_tpncp);
tpncp_module = prefs_register_protocol(proto_tpncp, proto_reg_handoff_tpncp);
diff --git a/epan/dissectors/packet-turnchannel.c b/epan/dissectors/packet-turnchannel.c
index 187151b6c2..2fa4c0f19c 100644
--- a/epan/dissectors/packet-turnchannel.c
+++ b/epan/dissectors/packet-turnchannel.c
@@ -119,25 +119,18 @@ dissect_turnchannel_message(tvbuff_t *tvb, packet_info *pinfo,
return tvb_length(tvb);
}
-
-static void
-dissect_turnchannel_message_no_return(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
-{
- dissect_turnchannel_message(tvb, pinfo, tree, NULL);
-}
-
-
static guint
get_turnchannel_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
{
return (guint)tvb_get_ntohs(tvb, offset+2) + TURNCHANNEL_HDR_LEN;
}
-static void
-dissect_turnchannel_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_turnchannel_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, TURNCHANNEL_HDR_LEN,
- get_turnchannel_message_len, dissect_turnchannel_message_no_return);
+ get_turnchannel_message_len, dissect_turnchannel_message, data);
+ return tvb_length(tvb);
}
@@ -210,7 +203,7 @@ proto_reg_handoff_turnchannel(void)
dissector_handle_t turnchannel_tcp_handle;
dissector_handle_t turnchannel_udp_handle;
- turnchannel_tcp_handle = create_dissector_handle(dissect_turnchannel_tcp, proto_turnchannel);
+ turnchannel_tcp_handle = new_create_dissector_handle(dissect_turnchannel_tcp, proto_turnchannel);
turnchannel_udp_handle = find_dissector("turnchannel");
/* Used for "Decode As" in case STUN negotiation isn't captured */
diff --git a/epan/dissectors/packet-ucp.c b/epan/dissectors/packet-ucp.c
index 178418e356..464b0473a1 100644
--- a/epan/dissectors/packet-ucp.c
+++ b/epan/dissectors/packet-ucp.c
@@ -47,10 +47,6 @@
#include "packet-tcp.h"
-/* Prototypes */
-static void dissect_ucp_tcp(tvbuff_t *, packet_info *, proto_tree *);
-static void dissect_ucp_common(tvbuff_t *, packet_info *, proto_tree *);
-
/* Tap Record */
typedef struct _ucp_tap_rec_t {
guint message_type; /* 0 = Operation; 1 = Result */
@@ -1713,46 +1709,6 @@ add_6xO(proto_tree *tree, tvbuff_t *tvb, guint8 OT)
#undef UcpHandleTime
#undef UcpHandleData
-/*
- * The heuristic dissector
- */
-
-static gboolean
-dissect_ucp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
-{
- conversation_t *conversation;
-
- /* Heuristic */
-
- if (tvb_length(tvb) < UCP_HEADER_SIZE)
- return FALSE;
-
- if ((tvb_get_guint8(tvb, 0) != UCP_STX) ||
- (tvb_get_guint8(tvb, UCP_TRN_OFFSET + UCP_TRN_LEN) != '/') ||
- (tvb_get_guint8(tvb, UCP_LEN_OFFSET + UCP_LEN_LEN) != '/') ||
- (tvb_get_guint8(tvb, UCP_O_R_OFFSET + UCP_O_R_LEN) != '/') ||
- (tvb_get_guint8(tvb, UCP_OT_OFFSET + UCP_OT_LEN) != '/'))
- return FALSE;
-
- if (try_val_to_str(tvb_get_guint8(tvb, UCP_O_R_OFFSET), vals_hdr_O_R) == NULL)
- return FALSE;
-
- /*
- * Ok, looks like a valid packet
- */
-
- /* Set up a conversation with attached dissector so dissect_ucp_heur
- * won't be called any more for this TCP connection.
- */
-
- conversation = find_or_create_conversation(pinfo);
- conversation_set_dissector(conversation, ucp_handle);
-
- dissect_ucp_tcp(tvb, pinfo, tree);
-
- return TRUE;
-}
-
static guint
get_ucp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
{
@@ -1769,21 +1725,14 @@ get_ucp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return intval + 2;
}
-
-static void
-dissect_ucp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
-{
- tcp_dissect_pdus(tvb, pinfo, tree, ucp_desegment, UCP_HEADER_SIZE,
- get_ucp_pdu_len, dissect_ucp_common);
-}
/*
* The actual dissector
*/
/* We get here only with at least LEN+2 bytes in the buffer */
-static void
-dissect_ucp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ucp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
int offset = 0; /* Offset in packet within tvbuff */
guint8 O_R; /* Request or response */
@@ -1806,9 +1755,9 @@ dissect_ucp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_clear(pinfo->cinfo, COL_INFO);
if (tvb_get_guint8(tvb, 0) != UCP_STX){
- proto_tree_add_text(tree, tvb, 0, -1,"UCP_STX missing, this is not a new packet");
- return;
- }
+ proto_tree_add_text(tree, tvb, 0, -1,"UCP_STX missing, this is not a new packet");
+ return tvb_length(tvb);
+ }
/* Get data needed for dissect_ucp_common */
result = check_ucp(tvb, &endpkt);
@@ -1975,7 +1924,55 @@ dissect_ucp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Queue packet for Tap */
tap_queue_packet(ucp_tap, pinfo, tap_rec);
- return;
+ return tvb_length(tvb);
+}
+
+static int
+dissect_ucp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
+{
+ tcp_dissect_pdus(tvb, pinfo, tree, ucp_desegment, UCP_HEADER_SIZE,
+ get_ucp_pdu_len, dissect_ucp_common, data);
+ return tvb_length(tvb);
+}
+
+/*
+ * The heuristic dissector
+ */
+
+static gboolean
+dissect_ucp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
+{
+ conversation_t *conversation;
+
+ /* Heuristic */
+
+ if (tvb_length(tvb) < UCP_HEADER_SIZE)
+ return FALSE;
+
+ if ((tvb_get_guint8(tvb, 0) != UCP_STX) ||
+ (tvb_get_guint8(tvb, UCP_TRN_OFFSET + UCP_TRN_LEN) != '/') ||
+ (tvb_get_guint8(tvb, UCP_LEN_OFFSET + UCP_LEN_LEN) != '/') ||
+ (tvb_get_guint8(tvb, UCP_O_R_OFFSET + UCP_O_R_LEN) != '/') ||
+ (tvb_get_guint8(tvb, UCP_OT_OFFSET + UCP_OT_LEN) != '/'))
+ return FALSE;
+
+ if (try_val_to_str(tvb_get_guint8(tvb, UCP_O_R_OFFSET), vals_hdr_O_R) == NULL)
+ return FALSE;
+
+ /*
+ * Ok, looks like a valid packet
+ */
+
+ /* Set up a conversation with attached dissector so dissect_ucp_heur
+ * won't be called any more for this TCP connection.
+ */
+
+ conversation = find_or_create_conversation(pinfo);
+ conversation_set_dissector(conversation, ucp_handle);
+
+ dissect_ucp_tcp(tvb, pinfo, tree, data);
+
+ return TRUE;
}
/* Register the protocol with Wireshark */
@@ -2772,7 +2769,7 @@ proto_reg_handoff_ucp(void)
/*
* Also register as a dissector that can be selected by a TCP port number via "decode as".
*/
- ucp_handle = create_dissector_handle(dissect_ucp_tcp, proto_ucp);
+ ucp_handle = new_create_dissector_handle(dissect_ucp_tcp, proto_ucp);
dissector_add_handle("tcp.port", ucp_handle);
/* Tapping setup */
diff --git a/epan/dissectors/packet-ulp.c b/epan/dissectors/packet-ulp.c
index cb8da7b32d..9effaa9cba 100644
--- a/epan/dissectors/packet-ulp.c
+++ b/epan/dissectors/packet-ulp.c
@@ -6268,10 +6268,13 @@ dissect_ulp_ULP_PDU(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, pro
/*--- PDUs ---*/
-static void dissect_ULP_PDU_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
+static int dissect_ULP_PDU_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
+ int offset = 0;
asn1_ctx_t asn1_ctx;
asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, FALSE, pinfo);
- dissect_ulp_ULP_PDU(tvb, 0, &asn1_ctx, tree, hf_ulp_ULP_PDU_PDU);
+ offset = dissect_ulp_ULP_PDU(tvb, offset, &asn1_ctx, tree, hf_ulp_ULP_PDU_PDU);
+ offset += 7; offset >>= 3;
+ return offset;
}
@@ -6286,11 +6289,12 @@ get_ulp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return tvb_get_ntohs(tvb,offset);
}
-static void
-dissect_ulp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ulp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, ulp_desegment, ULP_HEADER_SIZE,
- get_ulp_pdu_len, dissect_ULP_PDU_PDU);
+ get_ulp_pdu_len, dissect_ULP_PDU_PDU, data);
+ return tvb_length(tvb);
}
void proto_reg_handoff_ulp(void);
@@ -8690,7 +8694,7 @@ void proto_register_ulp(void) {
NULL, HFILL }},
/*--- End of included file: packet-ulp-hfarr.c ---*/
-#line 99 "../../asn1/ulp/packet-ulp-template.c"
+#line 100 "../../asn1/ulp/packet-ulp-template.c"
};
/* List of subtrees */
@@ -8909,7 +8913,7 @@ void proto_register_ulp(void) {
&ett_ulp_PolygonDescription,
/*--- End of included file: packet-ulp-ettarr.c ---*/
-#line 105 "../../asn1/ulp/packet-ulp-template.c"
+#line 106 "../../asn1/ulp/packet-ulp-template.c"
};
module_t *ulp_module;
@@ -8917,7 +8921,7 @@ void proto_register_ulp(void) {
/* Register protocol */
proto_ulp = proto_register_protocol(PNAME, PSNAME, PFNAME);
- register_dissector("ulp", dissect_ulp_tcp, proto_ulp);
+ new_register_dissector("ulp", dissect_ulp_tcp, proto_ulp);
/* Register fields and subtrees */
proto_register_field_array(proto_ulp, hf, array_length(hf));
diff --git a/epan/dissectors/packet-uma.c b/epan/dissectors/packet-uma.c
index 0163a1995a..a8006be187 100644
--- a/epan/dissectors/packet-uma.c
+++ b/epan/dissectors/packet-uma.c
@@ -1614,8 +1614,8 @@ dissect_uma_IE(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
-static void
-dissect_uma(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_uma(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
int offset = 0;
guint8 octet, pd;
@@ -1641,7 +1641,7 @@ dissect_uma(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_item(uma_tree, hf_uma_skip_ind, tvb, offset, 1, ENC_BIG_ENDIAN);
if ((octet & 0xf0) != 0 ){
proto_tree_add_text(uma_tree, tvb,offset,-1,"Skip this message");
- return;
+ return tvb_length(tvb);
}
proto_tree_add_item(uma_tree, hf_uma_pd, tvb, offset, 1, ENC_BIG_ENDIAN);
@@ -1675,6 +1675,8 @@ dissect_uma(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_text(uma_tree, tvb,offset,-1,"Unknown protocol %u",pd);
break;
}
+
+ return tvb_length(tvb);
}
static guint
@@ -1684,11 +1686,12 @@ get_uma_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return tvb_get_ntohs(tvb,offset)+2;
}
-static void
-dissect_uma_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_uma_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, uma_desegment, UMA_HEADER_SIZE,
- get_uma_pdu_len, dissect_uma);
+ get_uma_pdu_len, dissect_uma, data);
+ return tvb_length(tvb);
}
static int
@@ -2280,7 +2283,7 @@ proto_register_uma(void)
/* Register the protocol name and description */
proto_uma = proto_register_protocol("Unlicensed Mobile Access","UMA", "uma");
/* subdissector code */
- register_dissector("umatcp", dissect_uma_tcp, proto_uma);
+ new_register_dissector("umatcp", dissect_uma_tcp, proto_uma);
new_register_dissector("umaudp", dissect_uma_urlc_udp, proto_uma);
/* Required function calls to register the header fields and subtrees used */
diff --git a/epan/dissectors/packet-winsrepl.c b/epan/dissectors/packet-winsrepl.c
index c1337b7f5d..dd0dc82e91 100644
--- a/epan/dissectors/packet-winsrepl.c
+++ b/epan/dissectors/packet-winsrepl.c
@@ -631,21 +631,19 @@ dissect_winsrepl_replication(tvbuff_t *winsrepl_tvb, packet_info *pinfo,
return winsrepl_offset;
}
-static void
-dissect_winsrepl_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
+static int
+dissect_winsrepl_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_)
{
int offset = 0;
- proto_item *winsrepl_item = NULL;
- proto_tree *winsrepl_tree = NULL;
+ proto_item *winsrepl_item;
+ proto_tree *winsrepl_tree;
enum wrepl_mess_type mess_type;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "WINS-Replication");
col_clear(pinfo->cinfo, COL_INFO);
- if (parent_tree) {
- winsrepl_item = proto_tree_add_item(parent_tree, proto_winsrepl, tvb, offset, -1, ENC_NA);
- winsrepl_tree = proto_item_add_subtree(winsrepl_item, ett_winsrepl);
- }
+ winsrepl_item = proto_tree_add_item(parent_tree, proto_winsrepl, tvb, offset, -1, ENC_NA);
+ winsrepl_tree = proto_item_add_subtree(winsrepl_item, ett_winsrepl);
/* SIZE */
proto_tree_add_item(winsrepl_tree, hf_winsrepl_size, tvb, offset, 4, ENC_BIG_ENDIAN);
@@ -689,7 +687,7 @@ dissect_winsrepl_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
break;
}
- return;
+ return tvb_length(tvb);
}
static guint
@@ -701,10 +699,11 @@ get_winsrepl_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return pdu_len+4;
}
-static void
-dissect_winsrepl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
+static int
+dissect_winsrepl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data)
{
- tcp_dissect_pdus(tvb, pinfo, parent_tree, winsrepl_reassemble, 4, get_winsrepl_pdu_len, dissect_winsrepl_pdu);
+ tcp_dissect_pdus(tvb, pinfo, parent_tree, winsrepl_reassemble, 4, get_winsrepl_pdu_len, dissect_winsrepl_pdu, data);
+ return tvb_length(tvb);
}
void
@@ -886,6 +885,6 @@ proto_reg_handoff_winsrepl(void)
{
dissector_handle_t winsrepl_handle;
- winsrepl_handle = create_dissector_handle(dissect_winsrepl, proto_winsrepl);
+ winsrepl_handle = new_create_dissector_handle(dissect_winsrepl, proto_winsrepl);
dissector_add_uint("tcp.port", glb_winsrepl_tcp_port, winsrepl_handle);
}
diff --git a/epan/dissectors/packet-wow.c b/epan/dissectors/packet-wow.c
index e21e81cba4..daeb225ec9 100644
--- a/epan/dissectors/packet-wow.c
+++ b/epan/dissectors/packet-wow.c
@@ -138,37 +138,6 @@ static gboolean wow_preference_desegment = TRUE;
static gint ett_wow = -1;
static gint ett_wow_realms = -1;
-static void dissect_wow_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-static guint get_wow_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset);
-
-
-static gboolean
-dissect_wow(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
-{
- gint8 size_field_offset = -1;
- guint8 cmd;
-
- cmd = tvb_get_guint8(tvb, 0);
-
- if(WOW_SERVER_TO_CLIENT && cmd == REALM_LIST)
- size_field_offset = 1;
- if(WOW_CLIENT_TO_SERVER && cmd == AUTH_LOGON_CHALLENGE)
- size_field_offset = 2;
-
- if(size_field_offset > -1) {
- tcp_dissect_pdus(tvb, pinfo, tree, wow_preference_desegment,
- size_field_offset+2, get_wow_pdu_len,
- dissect_wow_pdu);
-
- } else {
- /* Doesn't have a size field, so it cannot span multiple
- segments. Therefore, dissect this packet normally. */
- dissect_wow_pdu(tvb, pinfo, tree);
- }
-
- return TRUE;
-}
-
static guint
get_wow_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset)
{
@@ -189,8 +158,8 @@ get_wow_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset)
}
-static void
-dissect_wow_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_wow_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
proto_tree *wow_tree, *wow_realms_tree;
@@ -427,6 +396,35 @@ dissect_wow_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
}
+
+ return tvb_length(tvb);
+}
+
+static gboolean
+dissect_wow(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
+{
+ gint8 size_field_offset = -1;
+ guint8 cmd;
+
+ cmd = tvb_get_guint8(tvb, 0);
+
+ if(WOW_SERVER_TO_CLIENT && cmd == REALM_LIST)
+ size_field_offset = 1;
+ if(WOW_CLIENT_TO_SERVER && cmd == AUTH_LOGON_CHALLENGE)
+ size_field_offset = 2;
+
+ if(size_field_offset > -1) {
+ tcp_dissect_pdus(tvb, pinfo, tree, wow_preference_desegment,
+ size_field_offset+2, get_wow_pdu_len,
+ dissect_wow_pdu, data);
+
+ } else {
+ /* Doesn't have a size field, so it cannot span multiple
+ segments. Therefore, dissect this packet normally. */
+ dissect_wow_pdu(tvb, pinfo, tree, data);
+ }
+
+ return TRUE;
}
diff --git a/epan/dissectors/packet-xmcp.c b/epan/dissectors/packet-xmcp.c
index 06b518eeb5..42af4c73a3 100644
--- a/epan/dissectors/packet-xmcp.c
+++ b/epan/dissectors/packet-xmcp.c
@@ -826,8 +826,8 @@ decode_xmcp_attr_value (proto_tree *attr_tree, guint16 attr_type,
}
}
-static void
-dissect_xmcp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_xmcp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
guint16 msg_type, msg_length;
proto_item *ti = NULL;
@@ -842,16 +842,16 @@ dissect_xmcp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
xmcp_transaction_t *xmcp_trans;
if (tvb_reported_length(tvb) < XMCP_HDR_LEN) {
- return;
+ return 0;
}
/* Check for valid message type field */
msg_type = tvb_get_ntohs(tvb, 0);
if (msg_type & XMCP_TYPE_RESERVED) { /* First 2 bits must be 0 */
- return;
+ return 0;
}
/* Check for valid "magic cookie" field */
if (tvb_get_ntohl(tvb, 4) != XMCP_MAGIC_COOKIE) {
- return;
+ return 0;
}
col_set_str(pinfo->cinfo, COL_PROTOCOL, "XMCP");
@@ -944,7 +944,7 @@ dissect_xmcp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
msg_length = tvb_get_ntohs(tvb, 2);
if ((guint)(msg_length + XMCP_HDR_LEN) > tvb_reported_length(tvb)) {
expert_add_info_format(pinfo, ti, &ei_xmcp_length_bad, "XMCP message length (%u-byte header + %u) exceeds packet length (%u)", XMCP_HDR_LEN, msg_length, tvb_reported_length(tvb));
- return;
+ return tvb_length(tvb);
}
/* ...a 4 byte magic cookie... */
@@ -1050,17 +1050,20 @@ dissect_xmcp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
expert_add_info_format(pinfo, xmcp_tree, &ei_xmcp_session_termination, "Session termination - %s %s", val_to_str_const(xmcp_msg_type_method, methods, ""), val_to_str_const(xmcp_msg_type_class, classes, ""));
}
}
+
+ return tvb_length(tvb);
}
-static void
-dissect_xmcp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_xmcp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, XMCP_HDR_LEN,
- get_xmcp_message_len, dissect_xmcp_message);
+ get_xmcp_message_len, dissect_xmcp_message, data);
+ return tvb_length(tvb);
}
static gboolean
-dissect_xmcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_xmcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
/* See if this looks like a real XMCP packet */
if (tvb_length(tvb) < XMCP_HDR_LEN) {
@@ -1077,7 +1080,7 @@ dissect_xmcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
/* Good enough to consider a match! */
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, XMCP_HDR_LEN,
- get_xmcp_message_len, dissect_xmcp_message);
+ get_xmcp_message_len, dissect_xmcp_message, data);
return TRUE;
}
@@ -1373,7 +1376,7 @@ proto_reg_handoff_xmcp(void)
static guint xmcp_tcp_port;
if (!xmcp_prefs_initialized) {
- xmcp_tcp_handle = create_dissector_handle(dissect_xmcp_tcp, proto_xmcp);
+ xmcp_tcp_handle = new_create_dissector_handle(dissect_xmcp_tcp, proto_xmcp);
heur_dissector_add("tcp", dissect_xmcp_heur, proto_xmcp);
media_type_dissector_table = find_dissector_table("media_type");
xmcp_prefs_initialized = TRUE;
diff --git a/epan/dissectors/packet-xot.c b/epan/dissectors/packet-xot.c
index 78ecb741be..7603f3a79d 100644
--- a/epan/dissectors/packet-xot.c
+++ b/epan/dissectors/packet-xot.c
@@ -184,7 +184,7 @@ static guint get_xot_pdu_len_mult(packet_info *pinfo _U_, tvbuff_t *tvb, int off
return offset_next - offset_before;
}
-static void dissect_xot_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_xot_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
int offset = 0;
guint16 version;
@@ -271,9 +271,11 @@ static void dissect_xot_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
call_dissector(x25_handle, next_tvb, pinfo, tree);
}
}
+
+ return tvb_length(tvb);
}
-static void dissect_xot_mult(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_xot_mult(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
int offset = 0;
int len = get_xot_pdu_len_mult(pinfo, tvb, offset);
@@ -295,11 +297,12 @@ static void dissect_xot_mult(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
next_tvb = tvb_new_subset(tvb, offset,plen, plen);
/*MIN(plen,tvb_length_remaining(tvb, offset)),plen*/
- dissect_xot_pdu(next_tvb, pinfo, tree);
+ dissect_xot_pdu(next_tvb, pinfo, tree, data);
offset += plen;
}
+ return tvb_length(tvb);
}
-static int dissect_xot_tcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+static int dissect_xot_tcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
int tvb_len = tvb_length(tvb);
int len = 0;
@@ -312,14 +315,14 @@ static int dissect_xot_tcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
tcp_dissect_pdus(tvb, pinfo, tree, xot_desegment,
XOT_HEADER_LENGTH,
get_xot_pdu_len,
- dissect_xot_pdu);
+ dissect_xot_pdu, data);
len=get_xot_pdu_len(pinfo, tvb, 0);
} else {
/* Use length version that "peeks" into X25, possibly several XOT packets */
tcp_dissect_pdus(tvb, pinfo, tree, xot_desegment,
XOT_HEADER_LENGTH,
get_xot_pdu_len_mult,
- dissect_xot_mult);
+ dissect_xot_mult, data);
len=get_xot_pdu_len_mult(pinfo, tvb, 0);
}
/*As tcp_dissect_pdus will not report the success/failure, we have to compute
diff --git a/epan/dissectors/packet-yami.c b/epan/dissectors/packet-yami.c
index 1e5576ac51..e0e9dd979d 100644
--- a/epan/dissectors/packet-yami.c
+++ b/epan/dissectors/packet-yami.c
@@ -468,10 +468,10 @@ dissect_yami_data(tvbuff_t *tvb, gboolean data, proto_tree *tree, int offset)
return offset;
}
-static void
-dissect_yami_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_yami_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
- proto_tree *yami_tree = NULL;
+ proto_tree *yami_tree;
proto_item *ti;
gint frame_number;
@@ -483,10 +483,8 @@ dissect_yami_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_set_str(pinfo->cinfo, COL_PROTOCOL, "YAMI");
col_clear(pinfo->cinfo, COL_INFO);
- if (tree) {
- ti = proto_tree_add_item(tree, hfi_yami, tvb, 0, -1, ENC_NA);
- yami_tree = proto_item_add_subtree(ti, ett_yami);
- }
+ ti = proto_tree_add_item(tree, hfi_yami, tvb, 0, -1, ENC_NA);
+ yami_tree = proto_item_add_subtree(ti, ett_yami);
offset = 0;
@@ -525,6 +523,8 @@ dissect_yami_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dissect_yami_data(tvb, TRUE, yami_tree, offset);
}
}
+
+ return tvb_length(tvb);
}
#define FRAME_HEADER_LEN 16
@@ -538,9 +538,9 @@ get_yami_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
}
static int
-dissect_yami(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_yami(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
- tcp_dissect_pdus(tvb, pinfo, tree, yami_desegment, FRAME_HEADER_LEN, get_yami_message_len, dissect_yami_pdu);
+ tcp_dissect_pdus(tvb, pinfo, tree, yami_desegment, FRAME_HEADER_LEN, get_yami_message_len, dissect_yami_pdu, data);
return tvb_length(tvb);
}
diff --git a/epan/dissectors/packet-ymsg.c b/epan/dissectors/packet-ymsg.c
index 3ea845b194..fbc071bc58 100644
--- a/epan/dissectors/packet-ymsg.c
+++ b/epan/dissectors/packet-ymsg.c
@@ -324,9 +324,6 @@ static const value_string ymsg_status_vals[] = {
{0, NULL}
};
-static guint get_ymsg_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset);
-static void dissect_ymsg_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-
/* Find the end of the current content line and return its length */
static int get_content_item_length(tvbuff_t *tvb, int offset)
{
@@ -342,23 +339,6 @@ static int get_content_item_length(tvbuff_t *tvb, int offset)
return offset - origoffset;
}
-
-static gboolean
-dissect_ymsg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
-{
- if (tvb_length(tvb) < 4) {
- return FALSE;
- }
- if (tvb_memeql(tvb, 0, "YMSG", 4) == -1) {
- /* Not a Yahoo Messenger packet. */
- return FALSE;
- }
-
- tcp_dissect_pdus(tvb, pinfo, tree, ymsg_desegment, 10, get_ymsg_pdu_len,
- dissect_ymsg_pdu);
- return TRUE;
-}
-
static guint
get_ymsg_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
{
@@ -375,8 +355,8 @@ get_ymsg_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return plen + YAHOO_HEADER_SIZE;
}
-static void
-dissect_ymsg_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ymsg_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *ymsg_tree, *ti;
proto_item *content_item;
@@ -488,7 +468,24 @@ dissect_ymsg_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_set_fence(pinfo->cinfo, COL_INFO);
- return;
+ return tvb_length(tvb);
+}
+
+
+static gboolean
+dissect_ymsg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
+{
+ if (tvb_length(tvb) < 4) {
+ return FALSE;
+ }
+ if (tvb_memeql(tvb, 0, "YMSG", 4) == -1) {
+ /* Not a Yahoo Messenger packet. */
+ return FALSE;
+ }
+
+ tcp_dissect_pdus(tvb, pinfo, tree, ymsg_desegment, 10, get_ymsg_pdu_len,
+ dissect_ymsg_pdu, data);
+ return TRUE;
}
void
diff --git a/epan/dissectors/packet-ziop.c b/epan/dissectors/packet-ziop.c
index 4a2f90155d..a3895d7de0 100644
--- a/epan/dissectors/packet-ziop.c
+++ b/epan/dissectors/packet-ziop.c
@@ -104,99 +104,10 @@ static const value_string giop_message_types[] = {
static gboolean ziop_desegment = TRUE;
-static void dissect_ziop (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree);
-
-static guint
-get_ziop_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
-{
- guint8 flags;
- guint message_size;
- gboolean stream_is_big_endian;
-
- if ( tvb_memeql(tvb, 0, ZIOP_MAGIC, 4) != 0)
- return 0;
-
- flags = tvb_get_guint8(tvb, offset + 6);
-
- stream_is_big_endian = ((flags & 0x1) == 0);
-
- if (stream_is_big_endian)
- message_size = tvb_get_ntohl(tvb, offset + 8);
- else
- message_size = tvb_get_letohl(tvb, offset + 8);
-
- return message_size + ZIOP_HEADER_SIZE;
-}
-
-
-static void
-dissect_ziop_tcp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) {
-
- if ( tvb_memeql(tvb, 0, ZIOP_MAGIC ,4) != 0) {
-
- if (tvb_get_ntohl(tvb, 0) == GIOP_MAGIC_NUMBER)
- dissect_giop(tvb, pinfo, tree);
-
- return;
- }
-
- tcp_dissect_pdus(tvb, pinfo, tree, ziop_desegment, ZIOP_HEADER_SIZE,
- get_ziop_pdu_len, dissect_ziop);
-}
-
-
-gboolean
-dissect_ziop_heur (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * data _U_) {
-
- guint tot_len;
-
- conversation_t *conversation;
- /* check magic number and version */
-
-
- tot_len = tvb_length(tvb);
-
-
- if (tot_len < ZIOP_HEADER_SIZE) /* tot_len < 12 */
- {
- /* Not enough data captured to hold the ZIOP header; don't try
- to interpret it as GIOP. */
- return FALSE;
- }
- if ( tvb_memeql(tvb, 0, ZIOP_MAGIC, 4) != 0) {
- return FALSE;
- }
-
- if ( pinfo->ptype == PT_TCP )
- {
- /*
- * Make the ZIOP dissector the dissector for this conversation.
- *
- * If this isn't the first time this packet has been processed,
- * we've already done this work, so we don't need to do it
- * again.
- */
- if (!pinfo->fd->flags.visited)
- {
- conversation = find_or_create_conversation(pinfo);
-
- /* Set dissector */
- conversation_set_dissector(conversation, ziop_tcp_handle);
- }
- dissect_ziop_tcp (tvb, pinfo, tree);
- }
- else
- {
- dissect_ziop (tvb, pinfo, tree);
- }
- return TRUE;
-
-}
-
/* Main entry point */
-static void
-dissect_ziop (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) {
+static int
+dissect_ziop (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_) {
guint offset = 0;
guint8 giop_version_major, giop_version_minor, message_type;
@@ -227,7 +138,7 @@ dissect_ziop (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) {
giop_version_minor);
}
call_dissector(data_handle, tvb, pinfo, tree);
- return;
+ return tvb_length(tvb);
}
col_add_fstr (pinfo->cinfo, COL_INFO, "ZIOP %u.%u %s",
@@ -272,9 +183,98 @@ dissect_ziop (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) {
offset += 4;
proto_tree_add_item(ziop_tree, hf_ziop_original_length, tvb, offset, 4, byte_order);
}
+
+ return tvb_length(tvb);
+}
+
+static guint
+get_ziop_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+{
+ guint8 flags;
+ guint message_size;
+ gboolean stream_is_big_endian;
+
+ if ( tvb_memeql(tvb, 0, ZIOP_MAGIC, 4) != 0)
+ return 0;
+
+ flags = tvb_get_guint8(tvb, offset + 6);
+
+ stream_is_big_endian = ((flags & 0x1) == 0);
+
+ if (stream_is_big_endian)
+ message_size = tvb_get_ntohl(tvb, offset + 8);
+ else
+ message_size = tvb_get_letohl(tvb, offset + 8);
+
+ return message_size + ZIOP_HEADER_SIZE;
+}
+
+static int
+dissect_ziop_tcp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data) {
+
+ if ( tvb_memeql(tvb, 0, ZIOP_MAGIC ,4) != 0) {
+
+ if (tvb_get_ntohl(tvb, 0) == GIOP_MAGIC_NUMBER) {
+ dissect_giop(tvb, pinfo, tree);
+ return tvb_length(tvb);
+ }
+ return 0;
+ }
+
+ tcp_dissect_pdus(tvb, pinfo, tree, ziop_desegment, ZIOP_HEADER_SIZE,
+ get_ziop_pdu_len, dissect_ziop, data);
+ return tvb_length(tvb);
}
+gboolean
+dissect_ziop_heur (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * data) {
+
+ guint tot_len;
+
+ conversation_t *conversation;
+ /* check magic number and version */
+
+
+ tot_len = tvb_length(tvb);
+
+
+ if (tot_len < ZIOP_HEADER_SIZE) /* tot_len < 12 */
+ {
+ /* Not enough data captured to hold the ZIOP header; don't try
+ to interpret it as GIOP. */
+ return FALSE;
+ }
+ if ( tvb_memeql(tvb, 0, ZIOP_MAGIC, 4) != 0) {
+ return FALSE;
+ }
+
+ if ( pinfo->ptype == PT_TCP )
+ {
+ /*
+ * Make the ZIOP dissector the dissector for this conversation.
+ *
+ * If this isn't the first time this packet has been processed,
+ * we've already done this work, so we don't need to do it
+ * again.
+ */
+ if (!pinfo->fd->flags.visited)
+ {
+ conversation = find_or_create_conversation(pinfo);
+
+ /* Set dissector */
+ conversation_set_dissector(conversation, ziop_tcp_handle);
+ }
+ dissect_ziop_tcp (tvb, pinfo, tree, data);
+ }
+ else
+ {
+ dissect_ziop (tvb, pinfo, tree, data);
+ }
+ return TRUE;
+
+}
+
void proto_register_ziop (void) {
@@ -321,14 +321,14 @@ void proto_register_ziop (void) {
proto_register_field_array (proto_ziop, hf, array_length (hf));
proto_register_subtree_array (ett, array_length (ett));
- register_dissector("ziop", dissect_ziop, proto_ziop);
+ new_register_dissector("ziop", dissect_ziop, proto_ziop);
}
void proto_reg_handoff_ziop (void) {
- ziop_tcp_handle = create_dissector_handle(dissect_ziop_tcp, proto_ziop);
+ ziop_tcp_handle = new_create_dissector_handle(dissect_ziop_tcp, proto_ziop);
dissector_add_handle("udp.port", ziop_tcp_handle); /* For 'Decode As' */
heur_dissector_add("tcp", dissect_ziop_heur, proto_ziop);