aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--asn1/c1222/packet-c1222-template.c2
-rw-r--r--asn1/cmp/packet-cmp-template.c3
-rw-r--r--asn1/idmp/packet-idmp-template.c3
-rw-r--r--asn1/ilp/packet-ilp-template.c2
-rw-r--r--asn1/kerberos/packet-kerberos-template.c2
-rw-r--r--asn1/ldap/packet-ldap-template.c6
-rw-r--r--asn1/sabp/packet-sabp-template.c2
-rw-r--r--asn1/ulp/packet-ulp-template.c2
-rw-r--r--doc/README.dissector15
-rw-r--r--doc/README.heuristic2
-rw-r--r--epan/dissectors/packet-9p.c5
-rw-r--r--epan/dissectors/packet-adwin-config.c3
-rw-r--r--epan/dissectors/packet-agentx.c2
-rw-r--r--epan/dissectors/packet-aim.c2
-rw-r--r--epan/dissectors/packet-ajp13.c2
-rw-r--r--epan/dissectors/packet-amqp.c17
-rw-r--r--epan/dissectors/packet-ancp.c2
-rw-r--r--epan/dissectors/packet-aol.c4
-rw-r--r--epan/dissectors/packet-assa_r3.c2
-rw-r--r--epan/dissectors/packet-bitcoin.c3
-rw-r--r--epan/dissectors/packet-bittorrent.c3
-rw-r--r--epan/dissectors/packet-c1222.c2
-rw-r--r--epan/dissectors/packet-cast.c2
-rw-r--r--epan/dissectors/packet-cmp.c3
-rw-r--r--epan/dissectors/packet-cmpp.c2
-rw-r--r--epan/dissectors/packet-cops.c2
-rw-r--r--epan/dissectors/packet-couchbase.c3
-rw-r--r--epan/dissectors/packet-db-lsp.c3
-rw-r--r--epan/dissectors/packet-dbus.c3
-rw-r--r--epan/dissectors/packet-dcerpc.c4
-rw-r--r--epan/dissectors/packet-dhcp-failover.c2
-rw-r--r--epan/dissectors/packet-dhcpv6.c3
-rw-r--r--epan/dissectors/packet-diameter.c3
-rw-r--r--epan/dissectors/packet-dji-uav.c2
-rw-r--r--epan/dissectors/packet-dlsw.c2
-rw-r--r--epan/dissectors/packet-dnp.c3
-rw-r--r--epan/dissectors/packet-dns.c2
-rw-r--r--epan/dissectors/packet-drda.c2
-rw-r--r--epan/dissectors/packet-dsi.c2
-rw-r--r--epan/dissectors/packet-dtn.c5
-rw-r--r--epan/dissectors/packet-edonkey.c3
-rw-r--r--epan/dissectors/packet-elasticsearch.c3
-rw-r--r--epan/dissectors/packet-enip.c2
-rw-r--r--epan/dissectors/packet-erldp.c4
-rw-r--r--epan/dissectors/packet-etch.c3
-rw-r--r--epan/dissectors/packet-fcgi.c2
-rw-r--r--epan/dissectors/packet-ff.c2
-rw-r--r--epan/dissectors/packet-fix.c2
-rw-r--r--epan/dissectors/packet-fmtp.c2
-rw-r--r--epan/dissectors/packet-gadu-gadu.c3
-rw-r--r--epan/dissectors/packet-gearman.c2
-rw-r--r--epan/dissectors/packet-ged125.c4
-rw-r--r--epan/dissectors/packet-giop.c2
-rw-r--r--epan/dissectors/packet-git.c2
-rw-r--r--epan/dissectors/packet-gnutella.c4
-rw-r--r--epan/dissectors/packet-hartip.c3
-rw-r--r--epan/dissectors/packet-hazelcast.c4
-rw-r--r--epan/dissectors/packet-hdfs.c3
-rw-r--r--epan/dissectors/packet-hdfsdata.c2
-rw-r--r--epan/dissectors/packet-hiqnet.c4
-rw-r--r--epan/dissectors/packet-hislip.c3
-rw-r--r--epan/dissectors/packet-hpfeeds.c2
-rw-r--r--epan/dissectors/packet-http2.c3
-rw-r--r--epan/dissectors/packet-icep.c3
-rw-r--r--epan/dissectors/packet-idmp.c2
-rw-r--r--epan/dissectors/packet-iec104.c3
-rw-r--r--epan/dissectors/packet-ifcp.c2
-rw-r--r--epan/dissectors/packet-ilp.c2
-rw-r--r--epan/dissectors/packet-ipdc.c4
-rw-r--r--epan/dissectors/packet-isns.c2
-rw-r--r--epan/dissectors/packet-kafka.c2
-rw-r--r--epan/dissectors/packet-kdsp.c3
-rw-r--r--epan/dissectors/packet-kerberos.c2
-rw-r--r--epan/dissectors/packet-kerberos.h2
-rw-r--r--epan/dissectors/packet-knet.c2
-rw-r--r--epan/dissectors/packet-laplink.c2
-rw-r--r--epan/dissectors/packet-lbmpdmtcp.c3
-rw-r--r--epan/dissectors/packet-lbttcp.c3
-rw-r--r--epan/dissectors/packet-ldap.c4
-rw-r--r--epan/dissectors/packet-lg8979.c2
-rw-r--r--epan/dissectors/packet-lisp-tcp.c3
-rw-r--r--epan/dissectors/packet-llrp.c2
-rw-r--r--epan/dissectors/packet-lsc.c2
-rw-r--r--epan/dissectors/packet-mausb.c5
-rw-r--r--epan/dissectors/packet-mbtcp.c5
-rw-r--r--epan/dissectors/packet-memcache.c3
-rw-r--r--epan/dissectors/packet-mongo.c2
-rw-r--r--epan/dissectors/packet-mq.c3
-rw-r--r--epan/dissectors/packet-mqtt.c3
-rw-r--r--epan/dissectors/packet-mrcpv2.c2
-rw-r--r--epan/dissectors/packet-mysql.c2
-rw-r--r--epan/dissectors/packet-nbd.c2
-rw-r--r--epan/dissectors/packet-ncp.c2
-rw-r--r--epan/dissectors/packet-ndmp.c2
-rw-r--r--epan/dissectors/packet-ndps.c2
-rw-r--r--epan/dissectors/packet-netsync.c2
-rw-r--r--epan/dissectors/packet-openflow.c3
-rw-r--r--epan/dissectors/packet-openvpn.c2
-rw-r--r--epan/dissectors/packet-openwire.c2
-rw-r--r--epan/dissectors/packet-opsi.c2
-rw-r--r--epan/dissectors/packet-optommp.c4
-rw-r--r--epan/dissectors/packet-osc.c2
-rw-r--r--epan/dissectors/packet-paltalk.c3
-rw-r--r--epan/dissectors/packet-pcep.c2
-rw-r--r--epan/dissectors/packet-pcp.c5
-rw-r--r--epan/dissectors/packet-pdc.c3
-rw-r--r--epan/dissectors/packet-pgsql.c2
-rw-r--r--epan/dissectors/packet-pvfs2.c3
-rw-r--r--epan/dissectors/packet-reload-framing.c3
-rw-r--r--epan/dissectors/packet-riemann.c3
-rw-r--r--epan/dissectors/packet-rpcap.c2
-rw-r--r--epan/dissectors/packet-rpki-rtr.c2
-rw-r--r--epan/dissectors/packet-s5066dts.c6
-rw-r--r--epan/dissectors/packet-s5066sis.c4
-rw-r--r--epan/dissectors/packet-sabp.c2
-rw-r--r--epan/dissectors/packet-sametime.c3
-rw-r--r--epan/dissectors/packet-sasp.c2
-rw-r--r--epan/dissectors/packet-scop.c4
-rw-r--r--epan/dissectors/packet-selfm.c3
-rw-r--r--epan/dissectors/packet-simulcrypt.c5
-rw-r--r--epan/dissectors/packet-skinny.c2
-rw-r--r--epan/dissectors/packet-slsk.c3
-rw-r--r--epan/dissectors/packet-smcr.c2
-rw-r--r--epan/dissectors/packet-smpp.c4
-rw-r--r--epan/dissectors/packet-soupbintcp.c3
-rw-r--r--epan/dissectors/packet-spdy.c2
-rw-r--r--epan/dissectors/packet-srvloc.c2
-rw-r--r--epan/dissectors/packet-starteam.c3
-rw-r--r--epan/dissectors/packet-stun.c3
-rw-r--r--epan/dissectors/packet-synphasor.c3
-rw-r--r--epan/dissectors/packet-tali.c2
-rw-r--r--epan/dissectors/packet-tcp.c4
-rw-r--r--epan/dissectors/packet-tcp.h2
-rw-r--r--epan/dissectors/packet-tipc.c2
-rw-r--r--epan/dissectors/packet-tns.c4
-rw-r--r--epan/dissectors/packet-tpncp.c4
-rw-r--r--epan/dissectors/packet-turnchannel.c3
-rw-r--r--epan/dissectors/packet-ucp.c2
-rw-r--r--epan/dissectors/packet-ulp.c2
-rw-r--r--epan/dissectors/packet-uma.c2
-rw-r--r--epan/dissectors/packet-winsrepl.c3
-rw-r--r--epan/dissectors/packet-wow.c2
-rw-r--r--epan/dissectors/packet-xmcp.c3
-rw-r--r--epan/dissectors/packet-xot.c16
-rw-r--r--epan/dissectors/packet-yami.c3
-rw-r--r--epan/dissectors/packet-ymsg.c2
-rw-r--r--epan/dissectors/packet-ziop.c2
-rw-r--r--epan/wslua/init_wslua.c11
-rw-r--r--epan/wslua/wslua.h4
-rw-r--r--epan/wslua/wslua_listener.c5
-rw-r--r--epan/wslua/wslua_proto.c172
-rw-r--r--epan/wslua/wslua_tree.c20
-rw-r--r--plugins/gryphon/packet-gryphon.c2
-rw-r--r--plugins/opcua/opcua.c3
-rw-r--r--test/captures/segmented_fpm.pcapbin0 -> 33144 bytes
-rw-r--r--test/lua/dissectFPM.lua452
-rwxr-xr-xtest/suite-wslua.sh40
157 files changed, 940 insertions, 209 deletions
diff --git a/asn1/c1222/packet-c1222-template.c b/asn1/c1222/packet-c1222-template.c
index 47c69aca6b..45f5d51c6b 100644
--- a/asn1/c1222/packet-c1222-template.c
+++ b/asn1/c1222/packet-c1222-template.c
@@ -1073,7 +1073,7 @@ dissect_c1222_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
* \returns length of entire C12.22 message
*/
static guint
-get_c1222_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset)
+get_c1222_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset, void *data _U_)
{
int orig_offset;
guint length;
diff --git a/asn1/cmp/packet-cmp-template.c b/asn1/cmp/packet-cmp-template.c
index b7d94a942e..c9506d21ad 100644
--- a/asn1/cmp/packet-cmp-template.c
+++ b/asn1/cmp/packet-cmp-template.c
@@ -190,7 +190,8 @@ static int dissect_cmp_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *pa
return offset;
}
-static guint get_cmp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+static guint get_cmp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
guint32 plen;
diff --git a/asn1/idmp/packet-idmp-template.c b/asn1/idmp/packet-idmp-template.c
index 425e400b91..f0cce14c56 100644
--- a/asn1/idmp/packet-idmp-template.c
+++ b/asn1/idmp/packet-idmp-template.c
@@ -229,7 +229,8 @@ static int dissect_idmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr
return tvb_captured_length(tvb);
}
-static guint get_idmp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+static guint get_idmp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
guint32 len;
diff --git a/asn1/ilp/packet-ilp-template.c b/asn1/ilp/packet-ilp-template.c
index c0398a6996..6251662ce7 100644
--- a/asn1/ilp/packet-ilp-template.c
+++ b/asn1/ilp/packet-ilp-template.c
@@ -70,7 +70,7 @@ static gint ett_ilp = -1;
static guint
-get_ilp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_ilp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
/* PDU length = Message length */
return tvb_get_ntohs(tvb,offset);
diff --git a/asn1/kerberos/packet-kerberos-template.c b/asn1/kerberos/packet-kerberos-template.c
index 8bbd90fbc9..ed3137dc40 100644
--- a/asn1/kerberos/packet-kerberos-template.c
+++ b/asn1/kerberos/packet-kerberos-template.c
@@ -2170,7 +2170,7 @@ kerberos_rm_to_reclen(guint krb_rm)
}
guint
-get_krb_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_krb_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint krb_rm;
gint pdulen;
diff --git a/asn1/ldap/packet-ldap-template.c b/asn1/ldap/packet-ldap-template.c
index d5dccc94c7..87b427194f 100644
--- a/asn1/ldap/packet-ldap-template.c
+++ b/asn1/ldap/packet-ldap-template.c
@@ -1619,7 +1619,8 @@ static void dissect_NetLogon_PDU(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr
static guint
-get_sasl_ldap_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_sasl_ldap_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
/* sasl encapsulated ldap is 4 bytes plus the length in size */
return tvb_get_ntohl(tvb, offset)+4;
@@ -1633,7 +1634,8 @@ dissect_sasl_ldap_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
}
static guint
-get_normal_ldap_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_normal_ldap_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
guint32 len;
gboolean ind;
diff --git a/asn1/sabp/packet-sabp-template.c b/asn1/sabp/packet-sabp-template.c
index 23d4fb79c7..6261b27a9c 100644
--- a/asn1/sabp/packet-sabp-template.c
+++ b/asn1/sabp/packet-sabp-template.c
@@ -167,7 +167,7 @@ dissect_sabp_cb_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
static guint
-get_sabp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_sabp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint32 type_length;
int bit_offset;
diff --git a/asn1/ulp/packet-ulp-template.c b/asn1/ulp/packet-ulp-template.c
index 27a6b411bf..ab3db01eaf 100644
--- a/asn1/ulp/packet-ulp-template.c
+++ b/asn1/ulp/packet-ulp-template.c
@@ -72,7 +72,7 @@ static gint ett_ulp = -1;
static guint
-get_ulp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_ulp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
/* PDU length = Message length */
return tvb_get_ntohs(tvb,offset);
diff --git a/doc/README.dissector b/doc/README.dissector
index fabf5b96e5..3fdc91af17 100644
--- a/doc/README.dissector
+++ b/doc/README.dissector
@@ -2922,19 +2922,20 @@ The arguments to tcp_dissect_pdus are:
a routine that takes as arguments a packet_info pointer, a tvbuff
pointer and an offset value representing the offset into the tvbuff
- at which a PDU begins and should return - *without* throwing an
- exception (it is guaranteed that the number of bytes specified by the
- previous argument to tcp_dissect_pdus is available, but more data
- might not be available, so don't refer to any data past that) - the
- total length of the PDU, in bytes;
+ at which a PDU begins, and a void pointer for user data, and should
+ return - *without* throwing an exception (it is guaranteed that the
+ number of bytes specified by the previous argument to
+ tcp_dissect_pdus is available, but more data might not be available,
+ so don't refer to any data past that) - the total length of the PDU,
+ in bytes;
a new_dissector_t routine to dissect the pdu that's passed a tvbuff
pointer, packet_info pointer, proto_tree pointer and a void pointer for
user data, with the tvbuff containing a possibly-reassembled PDU. (The
"reported_length" of the tvbuff will be the length of the PDU).
- a void pointer to user data that is passed to the dissector routine
- referenced in the previous parameter.
+ a void pointer to user data that is passed to the length-determining
+ routine, and the dissector routine referenced in the previous parameter.
2.7.2 Modifying the pinfo struct.
diff --git a/doc/README.heuristic b/doc/README.heuristic
index 02e8449efc..9a1a712b27 100644
--- a/doc/README.heuristic
+++ b/doc/README.heuristic
@@ -156,7 +156,7 @@ dissect_PROTOABBREV_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
/* For tcp_dissect_pdus() */
static guint
-get_PROTOABBREV_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_PROTOABBREV_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
return (guint) tvb_get_ntohs(tvb, offset+3);
}
diff --git a/epan/dissectors/packet-9p.c b/epan/dissectors/packet-9p.c
index 361c7b90ed..878100443d 100644
--- a/epan/dissectors/packet-9p.c
+++ b/epan/dissectors/packet-9p.c
@@ -2153,12 +2153,13 @@ static int dissect_9P_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
return tvb_captured_length(tvb);
}
-static guint get_9P_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+static guint get_9P_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
return (guint) tvb_get_letohl(tvb, offset);
}
-static int dissect_9P(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+static int dissect_9P(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 4,
get_9P_message_len, dissect_9P_message, data);
diff --git a/epan/dissectors/packet-adwin-config.c b/epan/dissectors/packet-adwin-config.c
index b83cb2f7b7..931b830bd6 100644
--- a/epan/dissectors/packet-adwin-config.c
+++ b/epan/dissectors/packet-adwin-config.c
@@ -309,7 +309,8 @@ dissect_UDPOut(tvbuff_t *tvb, proto_tree *adwin_tree)
}
static guint
-get_adwin_TCPUpdate_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_adwin_TCPUpdate_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
/*
* Return the length of the packet. (Doesn't include the length field itself)
diff --git a/epan/dissectors/packet-agentx.c b/epan/dissectors/packet-agentx.c
index f525f7c961..c6e654efb8 100644
--- a/epan/dissectors/packet-agentx.c
+++ b/epan/dissectors/packet-agentx.c
@@ -761,7 +761,7 @@ dissect_rem_caps_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, guint
static guint
-get_agentx_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_agentx_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint8 flags;
guint32 plen;
diff --git a/epan/dissectors/packet-aim.c b/epan/dissectors/packet-aim.c
index 2435254085..b6d99cb4d6 100644
--- a/epan/dissectors/packet-aim.c
+++ b/epan/dissectors/packet-aim.c
@@ -1368,7 +1368,7 @@ dissect_aim_tlv_list(tvbuff_t *tvb, packet_info *pinfo, int offset,
}
static guint
-get_aim_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_aim_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint16 plen;
diff --git a/epan/dissectors/packet-ajp13.c b/epan/dissectors/packet-ajp13.c
index 90bd989c2c..7bbb616246 100644
--- a/epan/dissectors/packet-ajp13.c
+++ b/epan/dissectors/packet-ajp13.c
@@ -833,7 +833,7 @@ dissect_ajp13_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
* packet length. see comments in packet-tcp.c:tcp_dissect_pdus().
*/
static guint
-get_ajp13_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_ajp13_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
/*guint16 magic;*/
guint16 plen;
diff --git a/epan/dissectors/packet-amqp.c b/epan/dissectors/packet-amqp.c
index 625b511986..7ec4298d70 100644
--- a/epan/dissectors/packet-amqp.c
+++ b/epan/dissectors/packet-amqp.c
@@ -397,7 +397,7 @@ static void
check_amqp_version(tvbuff_t *tvb, amqp_conv *conn);
static guint
-get_amqp_1_0_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset);
+get_amqp_1_0_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset, void* data);
static guint
dissect_amqp_1_0_list(tvbuff_t *tvb,
@@ -431,10 +431,10 @@ dissect_amqp_1_0_array(tvbuff_t *tvb,
const char *name);
static guint
-get_amqp_0_10_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset);
+get_amqp_0_10_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset, void* data);
static guint
-get_amqp_0_9_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset);
+get_amqp_0_9_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset, void* data);
static void
dissect_amqp_0_9_field_table(tvbuff_t *tvb, packet_info *pinfo, int offset, guint length, proto_item *item);
@@ -2758,7 +2758,7 @@ dissect_amqp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
conversation_t *conv;
amqp_conv *conn;
guint fixed_length;
- guint (*length_getter)(packet_info *, tvbuff_t *, int);
+ guint (*length_getter)(packet_info *, tvbuff_t *, int, void*);
new_dissector_t dissector;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "AMQP");
@@ -2859,7 +2859,8 @@ check_amqp_version(tvbuff_t *tvb, amqp_conv *conn)
}
static guint
-get_amqp_1_0_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_amqp_1_0_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
/* Heuristic - protocol initialisation frame starts with 'AMQP' */
if (tvb_memeql(tvb, offset, "AMQP", 4) == 0)
@@ -2868,7 +2869,8 @@ get_amqp_1_0_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
}
static guint
-get_amqp_0_10_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_amqp_0_10_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
/* Heuristic - protocol initialisation frame starts with 'AMQP' */
if (tvb_memeql(tvb, offset, "AMQP", 4) == 0)
@@ -2878,7 +2880,8 @@ get_amqp_0_10_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
}
static guint
-get_amqp_0_9_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_amqp_0_9_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
guint32 length;
diff --git a/epan/dissectors/packet-ancp.c b/epan/dissectors/packet-ancp.c
index a36b276e7c..f741869b19 100644
--- a/epan/dissectors/packet-ancp.c
+++ b/epan/dissectors/packet-ancp.c
@@ -636,7 +636,7 @@ dissect_ancp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
}
static guint
-get_ancp_msg_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_ancp_msg_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
return (guint)tvb_get_ntohs(tvb, offset + 2) + 4; /* 2B len + 4B hdr */
}
diff --git a/epan/dissectors/packet-aol.c b/epan/dissectors/packet-aol.c
index ce6085e66f..c7fba9716a 100644
--- a/epan/dissectors/packet-aol.c
+++ b/epan/dissectors/packet-aol.c
@@ -195,7 +195,9 @@ static guint dissect_aol_init(tvbuff_t *tvb, packet_info *pinfo _U_, guint offse
/**
* Get the length of a particular PDU (+6 bytes for the frame)
*/
-static guint get_aol_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset) {
+static guint get_aol_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
+{
guint16 plen;
/* Get the PDU length */
diff --git a/epan/dissectors/packet-assa_r3.c b/epan/dissectors/packet-assa_r3.c
index 57acad3e72..762a82ac23 100644
--- a/epan/dissectors/packet-assa_r3.c
+++ b/epan/dissectors/packet-assa_r3.c
@@ -6770,7 +6770,7 @@ dissect_r3_message (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d
}
static guint
-get_r3_message_len (packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_r3_message_len (packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
return (guint) tvb_get_guint8 (tvb, offset + 3) + 1;
}
diff --git a/epan/dissectors/packet-bitcoin.c b/epan/dissectors/packet-bitcoin.c
index 773f558394..34fbe51cb3 100644
--- a/epan/dissectors/packet-bitcoin.c
+++ b/epan/dissectors/packet-bitcoin.c
@@ -385,7 +385,8 @@ static expert_field ei_bitcoin_command_unknown = EI_INIT;
static gboolean bitcoin_desegment = TRUE;
static guint
-get_bitcoin_pdu_length(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_bitcoin_pdu_length(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
guint32 length;
length = BITCOIN_HEADER_LENGTH;
diff --git a/epan/dissectors/packet-bittorrent.c b/epan/dissectors/packet-bittorrent.c
index a141e6cda6..0cdb7688cc 100644
--- a/epan/dissectors/packet-bittorrent.c
+++ b/epan/dissectors/packet-bittorrent.c
@@ -257,7 +257,8 @@ static struct client_information peer_id[] = {
};
static guint
-get_bittorrent_pdu_length(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_bittorrent_pdu_length(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
guint8 type;
guint32 length;
diff --git a/epan/dissectors/packet-c1222.c b/epan/dissectors/packet-c1222.c
index dc0b4480ef..818867dd38 100644
--- a/epan/dissectors/packet-c1222.c
+++ b/epan/dissectors/packet-c1222.c
@@ -1595,7 +1595,7 @@ dissect_c1222_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
* \returns length of entire C12.22 message
*/
static guint
-get_c1222_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset)
+get_c1222_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset, void *data _U_)
{
int orig_offset;
guint length;
diff --git a/epan/dissectors/packet-cast.c b/epan/dissectors/packet-cast.c
index 044176e635..72065047ac 100644
--- a/epan/dissectors/packet-cast.c
+++ b/epan/dissectors/packet-cast.c
@@ -1001,7 +1001,7 @@ dissect_cast_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
/* Get the length of a single CAST PDU */
static guint
-get_cast_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_cast_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint32 hdr_data_length;
diff --git a/epan/dissectors/packet-cmp.c b/epan/dissectors/packet-cmp.c
index 8e66a8e7a8..b88ee5616e 100644
--- a/epan/dissectors/packet-cmp.c
+++ b/epan/dissectors/packet-cmp.c
@@ -1604,7 +1604,8 @@ static int dissect_cmp_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *pa
return offset;
}
-static guint get_cmp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+static guint get_cmp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
guint32 plen;
diff --git a/epan/dissectors/packet-cmpp.c b/epan/dissectors/packet-cmpp.c
index 2e57e34f8d..7a1f73d374 100644
--- a/epan/dissectors/packet-cmpp.c
+++ b/epan/dissectors/packet-cmpp.c
@@ -623,7 +623,7 @@ dissect_cmpp_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *
/* Get the CMPP PDU Length */
static guint
-get_cmpp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, gint offset)
+get_cmpp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
return tvb_get_ntohl(tvb, offset);
}
diff --git a/epan/dissectors/packet-cops.c b/epan/dissectors/packet-cops.c
index 2d619c678e..bb04e0fd15 100644
--- a/epan/dissectors/packet-cops.c
+++ b/epan/dissectors/packet-cops.c
@@ -906,7 +906,7 @@ static int cops_tag_cls2syntax ( guint tag, guint cls ) {
}
static guint
-get_cops_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_cops_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
/*
* Get the length of the COPS message.
diff --git a/epan/dissectors/packet-couchbase.c b/epan/dissectors/packet-couchbase.c
index d9e4ee6ab4..82b3a31d1e 100644
--- a/epan/dissectors/packet-couchbase.c
+++ b/epan/dissectors/packet-couchbase.c
@@ -522,7 +522,8 @@ static gboolean couchbase_desegment_body = TRUE;
static guint
-get_couchbase_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_couchbase_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
guint32 bodylen;
diff --git a/epan/dissectors/packet-db-lsp.c b/epan/dissectors/packet-db-lsp.c
index d6329b15ab..80e725c8fe 100644
--- a/epan/dissectors/packet-db-lsp.c
+++ b/epan/dissectors/packet-db-lsp.c
@@ -138,7 +138,8 @@ dissect_db_lsp_pdu (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d
}
static guint
-get_db_lsp_pdu_len (packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_db_lsp_pdu_len (packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
if (tvb_get_ntohs (tvb, offset + 1) != 0x0301) {
/* Unknown data, eat remaining data for this frame */
diff --git a/epan/dissectors/packet-dbus.c b/epan/dissectors/packet-dbus.c
index 9201b46f48..756c95e75e 100644
--- a/epan/dissectors/packet-dbus.c
+++ b/epan/dissectors/packet-dbus.c
@@ -588,7 +588,8 @@ dissect_dbus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
#define DBUS_HEADER_LEN 16
static guint
-get_dbus_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_dbus_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
guint32 (*get_guint32)(tvbuff_t *, const gint);
diff --git a/epan/dissectors/packet-dcerpc.c b/epan/dissectors/packet-dcerpc.c
index bafc8ee616..154cac76f4 100644
--- a/epan/dissectors/packet-dcerpc.c
+++ b/epan/dissectors/packet-dcerpc.c
@@ -5094,11 +5094,13 @@ dissect_dcerpc_cn_bs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *
}
static guint
-get_dcerpc_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset _U_)
+get_dcerpc_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset _U_, void *data _U_)
{
guint8 drep[4];
guint16 frag_len;
+ /* XXX: why does htis not take offset into account? */
tvb_memcpy(tvb, (guint8 *)drep, 4, sizeof(drep));
frag_len = dcerpc_tvb_get_ntohs(tvb, 8, drep);
diff --git a/epan/dissectors/packet-dhcp-failover.c b/epan/dissectors/packet-dhcp-failover.c
index f9b60b5f25..d8d89a26e0 100644
--- a/epan/dissectors/packet-dhcp-failover.c
+++ b/epan/dissectors/packet-dhcp-failover.c
@@ -351,7 +351,7 @@ static const value_string serverflag_vals[] =
/* Code to actually dissect the packets */
static guint
-get_dhcpfo_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_dhcpfo_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
/*
* Return the length of the DHCP failover packet.
diff --git a/epan/dissectors/packet-dhcpv6.c b/epan/dissectors/packet-dhcpv6.c
index 623704bed2..8942ac3f22 100644
--- a/epan/dissectors/packet-dhcpv6.c
+++ b/epan/dissectors/packet-dhcpv6.c
@@ -1997,7 +1997,8 @@ dissect_dhcpv6_upstream(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
static guint
-get_dhcpv6_bulk_leasequery_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_dhcpv6_bulk_leasequery_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
return (tvb_get_ntohs(tvb, offset)+2);
}
diff --git a/epan/dissectors/packet-diameter.c b/epan/dissectors/packet-diameter.c
index 8e39a3559f..34c9d90c0d 100644
--- a/epan/dissectors/packet-diameter.c
+++ b/epan/dissectors/packet-diameter.c
@@ -1302,7 +1302,8 @@ dissect_diameter_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
}
static guint
-get_diameter_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_diameter_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
/* Get the length of the Diameter packet. */
return tvb_get_ntoh24(tvb, offset + 1);
diff --git a/epan/dissectors/packet-dji-uav.c b/epan/dissectors/packet-dji-uav.c
index 40fb34f336..7f57dd46cb 100644
--- a/epan/dissectors/packet-dji-uav.c
+++ b/epan/dissectors/packet-dji-uav.c
@@ -267,7 +267,7 @@ test_djiuav(tvbuff_t *tvb)
/* Get the length of the full pdu */
static guint
-get_djiuav_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_djiuav_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
return tvb_get_guint8(tvb, offset + 2);
}
diff --git a/epan/dissectors/packet-dlsw.c b/epan/dissectors/packet-dlsw.c
index 5416904443..2159fb0d6b 100644
--- a/epan/dissectors/packet-dlsw.c
+++ b/epan/dissectors/packet-dlsw.c
@@ -511,7 +511,7 @@ dissect_dlsw_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
}
static guint
-get_dlsw_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_dlsw_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint hlen, mlen;
diff --git a/epan/dissectors/packet-dnp.c b/epan/dissectors/packet-dnp.c
index cd886c344c..ae0a5a1441 100644
--- a/epan/dissectors/packet-dnp.c
+++ b/epan/dissectors/packet-dnp.c
@@ -3469,7 +3469,8 @@ check_dnp3_header(tvbuff_t *tvb)
}
static guint
-get_dnp3_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_dnp3_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
guint16 message_len; /* need 16 bits as total can exceed 255 */
guint16 data_crc; /* No. of user data CRC bytes */
diff --git a/epan/dissectors/packet-dns.c b/epan/dissectors/packet-dns.c
index 915eae74dc..0ffb70ef60 100644
--- a/epan/dissectors/packet-dns.c
+++ b/epan/dissectors/packet-dns.c
@@ -3973,7 +3973,7 @@ dissect_llmnr_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
static guint
-get_dns_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_dns_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint16 plen;
diff --git a/epan/dissectors/packet-drda.c b/epan/dissectors/packet-drda.c
index 864d9cc6b6..453ef248f0 100644
--- a/epan/dissectors/packet-drda.c
+++ b/epan/dissectors/packet-drda.c
@@ -780,7 +780,7 @@ dissect_drda(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
}
static guint
-get_drda_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_drda_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
if (tvb_length_remaining(tvb, offset) >= 10)
{
diff --git a/epan/dissectors/packet-dsi.c b/epan/dissectors/packet-dsi.c
index 35eea4e16f..00ac454cec 100644
--- a/epan/dissectors/packet-dsi.c
+++ b/epan/dissectors/packet-dsi.c
@@ -325,7 +325,7 @@ dissect_dsi_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da
}
static guint
-get_dsi_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_dsi_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint32 plen;
guint8 dsi_flags,dsi_command;
diff --git a/epan/dissectors/packet-dtn.c b/epan/dissectors/packet-dtn.c
index 941abe0baf..9358bf6760 100644
--- a/epan/dissectors/packet-dtn.c
+++ b/epan/dissectors/packet-dtn.c
@@ -1704,7 +1704,8 @@ evaluate_sdnv_64(tvbuff_t *tvb, int offset, int *bytecount)
}
static guint
-get_dtn_contact_header_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_dtn_contact_header_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
int len, bytecount;
@@ -1763,7 +1764,7 @@ dissect_dtn_contact_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
static guint
-get_tcpcl_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_tcpcl_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
int len, bytecount;
guint8 conv_hdr = tvb_get_guint8(tvb, offset);
diff --git a/epan/dissectors/packet-edonkey.c b/epan/dissectors/packet-edonkey.c
index 4d6d4c526d..eec5cf0131 100644
--- a/epan/dissectors/packet-edonkey.c
+++ b/epan/dissectors/packet-edonkey.c
@@ -2912,7 +2912,8 @@ static int dissect_kademlia_udp_compressed_message(guint8 msg_type,
}
-static guint get_edonkey_tcp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+static guint get_edonkey_tcp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
guint32 msg_len;
diff --git a/epan/dissectors/packet-elasticsearch.c b/epan/dissectors/packet-elasticsearch.c
index 4722f10f40..89c0cf2852 100644
--- a/epan/dissectors/packet-elasticsearch.c
+++ b/epan/dissectors/packet-elasticsearch.c
@@ -471,7 +471,8 @@ static int elasticsearch_dissect_valid_binary_packet(tvbuff_t *tvb, packet_info
return tvb_captured_length(tvb);
}
-static guint elasticsearch_get_binary_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+static guint elasticsearch_get_binary_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
/* length is two bytes into the packet, also the length doesn't include the starting 6 bytes */
return (guint)tvb_get_ntohl(tvb, offset+ELASTICSEARCH_MESSAGE_LENGTH_OFFSET) + ELASTICSEARCH_HEADER_LENGTH;
diff --git a/epan/dissectors/packet-enip.c b/epan/dissectors/packet-enip.c
index 82a2617427..405ce8cc24 100644
--- a/epan/dissectors/packet-enip.c
+++ b/epan/dissectors/packet-enip.c
@@ -2159,7 +2159,7 @@ classify_packet(packet_info *pinfo)
}
static guint
-get_enip_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_enip_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint16 plen;
diff --git a/epan/dissectors/packet-erldp.c b/epan/dissectors/packet-erldp.c
index ea82d25caf..403ebc0a5b 100644
--- a/epan/dissectors/packet-erldp.c
+++ b/epan/dissectors/packet-erldp.c
@@ -523,7 +523,9 @@ static int dissect_erldp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
}
/*--- get_erldp_pdu_len -------------------------------------------------*/
-static guint get_erldp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset) {
+static guint get_erldp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
+{
if (is_handshake(tvb, offset))
return(2 + tvb_get_ntohs(tvb, offset));
diff --git a/epan/dissectors/packet-etch.c b/epan/dissectors/packet-etch.c
index 82c0c43cf2..9261c3feef 100644
--- a/epan/dissectors/packet-etch.c
+++ b/epan/dissectors/packet-etch.c
@@ -760,7 +760,8 @@ dissect_etch_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
* determine PDU length of protocol etch
*/
static guint
-get_etch_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_etch_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
/* length is at offset 4. we add magic bytes length + length size */
return tvb_get_ntohl(tvb, offset + 4) + 8;
diff --git a/epan/dissectors/packet-fcgi.c b/epan/dissectors/packet-fcgi.c
index c89934c1ce..ab99b2074b 100644
--- a/epan/dissectors/packet-fcgi.c
+++ b/epan/dissectors/packet-fcgi.c
@@ -319,7 +319,7 @@ dissect_fcgi_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d
}
static guint
-get_fcgi_record_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_fcgi_record_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
return 8 + tvb_get_ntohs(tvb, offset + 4) + tvb_get_guint8(tvb, offset + 6);
}
diff --git a/epan/dissectors/packet-ff.c b/epan/dissectors/packet-ff.c
index bc7bb7519f..9825b1ce07 100644
--- a/epan/dissectors/packet-ff.c
+++ b/epan/dissectors/packet-ff.c
@@ -11058,7 +11058,7 @@ dissect_ff(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
static guint
-get_ff_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_ff_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
return (tvb_get_ntohl(tvb, offset + 8));
}
diff --git a/epan/dissectors/packet-fix.c b/epan/dissectors/packet-fix.c
index 797747a828..149f507475 100644
--- a/epan/dissectors/packet-fix.c
+++ b/epan/dissectors/packet-fix.c
@@ -385,7 +385,7 @@ dissect_fix_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da
}
static guint
-get_fix_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_fix_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
int fix_len;
diff --git a/epan/dissectors/packet-fmtp.c b/epan/dissectors/packet-fmtp.c
index f633011a70..fa0f2115fb 100644
--- a/epan/dissectors/packet-fmtp.c
+++ b/epan/dissectors/packet-fmtp.c
@@ -129,7 +129,7 @@ dissect_fmtp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
}
static guint
-get_fmtp_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_fmtp_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
return (guint)tvb_get_ntohs(tvb, offset+2);
}
diff --git a/epan/dissectors/packet-gadu-gadu.c b/epan/dissectors/packet-gadu-gadu.c
index 1f0c4e8650..ba079d0f15 100644
--- a/epan/dissectors/packet-gadu-gadu.c
+++ b/epan/dissectors/packet-gadu-gadu.c
@@ -1975,7 +1975,8 @@ dissect_gadu_gadu_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
}
static guint
-get_gadu_gadu_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_gadu_gadu_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
guint32 len = tvb_get_letohl(tvb, offset + 4);
diff --git a/epan/dissectors/packet-gearman.c b/epan/dissectors/packet-gearman.c
index 93d1dfe5ac..0ca13d440f 100644
--- a/epan/dissectors/packet-gearman.c
+++ b/epan/dissectors/packet-gearman.c
@@ -173,7 +173,7 @@ static const value_string gearman_command_names[] = {
};
static guint
-get_gearman_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_gearman_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
return tvb_get_ntohl(tvb, offset+8)+GEARMAN_COMMAND_HEADER_SIZE;
}
diff --git a/epan/dissectors/packet-ged125.c b/epan/dissectors/packet-ged125.c
index 6bf0ea64bd..4966576a4b 100644
--- a/epan/dissectors/packet-ged125.c
+++ b/epan/dissectors/packet-ged125.c
@@ -980,8 +980,10 @@ service_control_dissect(tvbuff_t* tvb,proto_tree* msg_tree, proto_tree* ged125_t
}
static guint
-get_ged125_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, gint offset _U_)
+get_ged125_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset _U_, void *data _U_)
{
+ /* XXX: why does this not use the offset to get the value? */
return tvb_get_ntohl(tvb, 0) + 8;
}
diff --git a/epan/dissectors/packet-giop.c b/epan/dissectors/packet-giop.c
index c5866052c4..b470a73174 100644
--- a/epan/dissectors/packet-giop.c
+++ b/epan/dissectors/packet-giop.c
@@ -4815,7 +4815,7 @@ static int dissect_giop_common (tvbuff_t * tvb, packet_info * pinfo, proto_tree
}
static guint
-get_giop_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_giop_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
MessageHeader header;
diff --git a/epan/dissectors/packet-git.c b/epan/dissectors/packet-git.c
index 377c942f25..a48654714b 100644
--- a/epan/dissectors/packet-git.c
+++ b/epan/dissectors/packet-git.c
@@ -60,7 +60,7 @@ static gboolean get_packet_length(tvbuff_t *tvb, int offset,
}
static guint
-get_git_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_git_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint16 plen;
diff --git a/epan/dissectors/packet-gnutella.c b/epan/dissectors/packet-gnutella.c
index c9896968af..35334d30f0 100644
--- a/epan/dissectors/packet-gnutella.c
+++ b/epan/dissectors/packet-gnutella.c
@@ -315,7 +315,9 @@ static void dissect_gnutella_push(tvbuff_t *tvb, guint offset, proto_tree *tree)
}
static guint
-get_gnutella_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset) {
+get_gnutella_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
+{
guint32 size;
size = tvb_get_letohl(
diff --git a/epan/dissectors/packet-hartip.c b/epan/dissectors/packet-hartip.c
index c1930072c5..72e768849f 100644
--- a/epan/dissectors/packet-hartip.c
+++ b/epan/dissectors/packet-hartip.c
@@ -925,7 +925,8 @@ dissect_hartip_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
static guint
-get_dissect_hartip_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_dissect_hartip_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
return tvb_get_ntohs(tvb, offset+6);
}
diff --git a/epan/dissectors/packet-hazelcast.c b/epan/dissectors/packet-hazelcast.c
index ae182a4ce5..e54cd143b0 100644
--- a/epan/dissectors/packet-hazelcast.c
+++ b/epan/dissectors/packet-hazelcast.c
@@ -236,7 +236,9 @@ static value_string_ext responseTypes_ext = VALUE_STRING_EXT_INIT(responseTypes)
/* Get the length of a single HAZELCAST message */
-static guint get_hazelcast_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset) {
+static guint get_hazelcast_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
+{
guint messageLength;
guint headerKeyLength;
diff --git a/epan/dissectors/packet-hdfs.c b/epan/dissectors/packet-hdfs.c
index 557df7ff20..e5b330473f 100644
--- a/epan/dissectors/packet-hdfs.c
+++ b/epan/dissectors/packet-hdfs.c
@@ -654,7 +654,8 @@ dissect_hdfs_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
}
/* determine PDU length of protocol */
-static guint get_hdfs_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset _U_)
+static guint get_hdfs_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset _U_, void *data _U_)
{
int len = tvb_reported_length(tvb);
diff --git a/epan/dissectors/packet-hdfsdata.c b/epan/dissectors/packet-hdfsdata.c
index 5b133b301f..e1a3e9f142 100644
--- a/epan/dissectors/packet-hdfsdata.c
+++ b/epan/dissectors/packet-hdfsdata.c
@@ -381,7 +381,7 @@ dissect_write_response(tvbuff_t *tvb, proto_tree *hdfsdata_tree, int offset)
/* determine PDU length of protocol */
static guint
-get_hdfsdata_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_hdfsdata_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
/* get data packet len, add FIRST_READ_FRAGMENT_LEN for first fragment (before len),
SECOND_READ_FRAGMENT_LEN for second fragment (incl len), subtract 4 for length itself. */
diff --git a/epan/dissectors/packet-hiqnet.c b/epan/dissectors/packet-hiqnet.c
index 1a5f9fb929..8810b088ac 100644
--- a/epan/dissectors/packet-hiqnet.c
+++ b/epan/dissectors/packet-hiqnet.c
@@ -993,7 +993,7 @@ dissect_hiqnet_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
static guint
-get_hiqnet_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_hiqnet_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
/* length is at offset + 2 */
return tvb_get_ntohl(tvb, offset + 2);
@@ -1021,7 +1021,7 @@ dissect_hiqnet_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
/* loop on (possibly multiple) hiqnet PDUs in UDP payload */
while (tvb_reported_length_remaining(tvb, offset) > 0) {
- plen = get_hiqnet_pdu_len(pinfo, tvb, offset);
+ plen = get_hiqnet_pdu_len(pinfo, tvb, offset, NULL);
captured_length = tvb_captured_length_remaining(tvb, offset);
if (captured_length > plen)
diff --git a/epan/dissectors/packet-hislip.c b/epan/dissectors/packet-hislip.c
index c6409528c8..25f40007d9 100644
--- a/epan/dissectors/packet-hislip.c
+++ b/epan/dissectors/packet-hislip.c
@@ -852,7 +852,8 @@ dissect_hislip_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
}
static guint
-get_hislip_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, gint offset)
+get_hislip_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
guint64 length;
diff --git a/epan/dissectors/packet-hpfeeds.c b/epan/dissectors/packet-hpfeeds.c
index 7a08be509d..cb23d5e83d 100644
--- a/epan/dissectors/packet-hpfeeds.c
+++ b/epan/dissectors/packet-hpfeeds.c
@@ -275,7 +275,7 @@ dissect_hpfeeds_subscribe_pdu(tvbuff_t *tvb, proto_tree *tree, guint offset)
* by the routine to re-assemble the protocol spread on multiple TCP packets
*/
static guint
-get_hpfeeds_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_hpfeeds_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
return tvb_get_ntohl(tvb, offset + 0);
}
diff --git a/epan/dissectors/packet-http2.c b/epan/dissectors/packet-http2.c
index bb97f4d4f6..0a89d47003 100644
--- a/epan/dissectors/packet-http2.c
+++ b/epan/dissectors/packet-http2.c
@@ -1361,7 +1361,8 @@ dissect_http2_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dat
return tvb_captured_length(tvb);
}
-static guint get_http2_message_len( packet_info *pinfo _U_, tvbuff_t *tvb, int offset )
+static guint get_http2_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
if ( tvb_memeql( tvb, offset, kMagicHello, MAGIC_FRAME_LENGTH ) == 0 ) {
return MAGIC_FRAME_LENGTH;
diff --git a/epan/dissectors/packet-icep.c b/epan/dissectors/packet-icep.c
index ba0dca1b8b..34fe838b85 100644
--- a/epan/dissectors/packet-icep.c
+++ b/epan/dissectors/packet-icep.c
@@ -913,7 +913,8 @@ static void dissect_icep_reply(tvbuff_t *tvb, guint32 offset,
DBG1("consumed --> %d\n", reported_reply_data);
}
-static guint get_icep_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+static guint get_icep_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
return tvb_get_letohl(tvb, offset + 10);
}
diff --git a/epan/dissectors/packet-idmp.c b/epan/dissectors/packet-idmp.c
index f2f45598d7..140af96878 100644
--- a/epan/dissectors/packet-idmp.c
+++ b/epan/dissectors/packet-idmp.c
@@ -715,7 +715,7 @@ static int dissect_idmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr
return tvb_captured_length(tvb);
}
-static guint get_idmp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+static guint get_idmp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint32 len;
diff --git a/epan/dissectors/packet-iec104.c b/epan/dissectors/packet-iec104.c
index 5b937ec30a..32f2c3c62d 100644
--- a/epan/dissectors/packet-iec104.c
+++ b/epan/dissectors/packet-iec104.c
@@ -1036,7 +1036,8 @@ static void get_QOI(tvbuff_t *tvb, guint8 *offset, proto_tree *iec104_header_tre
/* Find the APDU 104 (APDU=APCI+ASDU) length.
Includes possible tvb_length-1 bytes that don't form an APDU */
-static guint get_iec104apdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+static guint get_iec104apdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
guint8 Val;
guint32 Off;
diff --git a/epan/dissectors/packet-ifcp.c b/epan/dissectors/packet-ifcp.c
index dfc456fa4d..b61d92d126 100644
--- a/epan/dissectors/packet-ifcp.c
+++ b/epan/dissectors/packet-ifcp.c
@@ -484,7 +484,7 @@ dissect_ifcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, voi
}
static guint
-get_ifcp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_ifcp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint pdu_len;
diff --git a/epan/dissectors/packet-ilp.c b/epan/dissectors/packet-ilp.c
index d510b21ca3..b1c5e8b250 100644
--- a/epan/dissectors/packet-ilp.c
+++ b/epan/dissectors/packet-ilp.c
@@ -4093,7 +4093,7 @@ static int dissect_ILP_PDU_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_
static guint
-get_ilp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_ilp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
/* PDU length = Message length */
return tvb_get_ntohs(tvb,offset);
diff --git a/epan/dissectors/packet-ipdc.c b/epan/dissectors/packet-ipdc.c
index 3a911e587c..5a8a66b2ea 100644
--- a/epan/dissectors/packet-ipdc.c
+++ b/epan/dissectors/packet-ipdc.c
@@ -707,7 +707,7 @@ static dissector_handle_t q931_handle;
static guint
-get_ipdc_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_ipdc_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
/* lower 10 bits only */
guint raw_len = (tvb_get_ntohs(tvb,offset+2) & 0x03FF);
@@ -737,7 +737,7 @@ dissect_ipdc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d
gshort nr = tvb_get_guint8(tvb,0);
gshort ns = tvb_get_guint8(tvb,1);
- guint payload_len = get_ipdc_pdu_len(pinfo,tvb,0);
+ guint payload_len = get_ipdc_pdu_len(pinfo,tvb,0,NULL);
gshort trans_id_size;
guint32 trans_id;
diff --git a/epan/dissectors/packet-isns.c b/epan/dissectors/packet-isns.c
index 7a223ee5c7..5a0b9b7dc5 100644
--- a/epan/dissectors/packet-isns.c
+++ b/epan/dissectors/packet-isns.c
@@ -682,7 +682,7 @@ dissect_isns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
}
static guint
-get_isns_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_isns_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint16 isns_len;
diff --git a/epan/dissectors/packet-kafka.c b/epan/dissectors/packet-kafka.c
index 4e32db7ca6..4704b630e2 100644
--- a/epan/dissectors/packet-kafka.c
+++ b/epan/dissectors/packet-kafka.c
@@ -153,7 +153,7 @@ dissect_kafka_message_set(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i
/* HELPERS */
static guint
-get_kafka_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_kafka_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
return 4 + tvb_get_ntohl(tvb, offset);
}
diff --git a/epan/dissectors/packet-kdsp.c b/epan/dissectors/packet-kdsp.c
index cb6562afc4..5c256b6d27 100644
--- a/epan/dissectors/packet-kdsp.c
+++ b/epan/dissectors/packet-kdsp.c
@@ -249,7 +249,8 @@ static expert_field ei_kdsp_cmdnum = EI_INIT;
/* determine PDU length of protocol */
static guint
-get_kdsp_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_kdsp_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
return tvb_get_ntohl(tvb, offset+8) + FRAME_HEADER_LEN; /* length is at offset 8 */
}
diff --git a/epan/dissectors/packet-kerberos.c b/epan/dissectors/packet-kerberos.c
index 83906c0f41..4d06d5f421 100644
--- a/epan/dissectors/packet-kerberos.c
+++ b/epan/dissectors/packet-kerberos.c
@@ -4434,7 +4434,7 @@ kerberos_rm_to_reclen(guint krb_rm)
}
guint
-get_krb_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_krb_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint krb_rm;
gint pdulen;
diff --git a/epan/dissectors/packet-kerberos.h b/epan/dissectors/packet-kerberos.h
index f86e77ac41..2d08e0a7b0 100644
--- a/epan/dissectors/packet-kerberos.h
+++ b/epan/dissectors/packet-kerberos.h
@@ -68,7 +68,7 @@ int dissect_krb5_cname(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *
int dissect_krb5_realm(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_);
guint32 kerberos_output_keytype(void);
-guint get_krb_pdu_len(packet_info *, tvbuff_t *tvb, int offset);
+guint get_krb_pdu_len(packet_info *, tvbuff_t *tvb, int offset, void *data);
gint kerberos_rm_to_reclen(guint krb_rm);
diff --git a/epan/dissectors/packet-knet.c b/epan/dissectors/packet-knet.c
index 4a0655181e..e343b6f623 100644
--- a/epan/dissectors/packet-knet.c
+++ b/epan/dissectors/packet-knet.c
@@ -544,7 +544,7 @@ dissect_knet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int current_pr
*
*/
static guint
-get_knet_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_knet_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
return count_vle_bytes(tvb, offset) + dissect_content_length_vle(tvb, &offset, NULL);
}
diff --git a/epan/dissectors/packet-laplink.c b/epan/dissectors/packet-laplink.c
index cf12cae673..54adbdeb43 100644
--- a/epan/dissectors/packet-laplink.c
+++ b/epan/dissectors/packet-laplink.c
@@ -146,7 +146,7 @@ dissect_laplink_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
}
static guint
-get_laplink_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_laplink_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint plen;
/*
diff --git a/epan/dissectors/packet-lbmpdmtcp.c b/epan/dissectors/packet-lbmpdmtcp.c
index feab47f124..ae93f69499 100644
--- a/epan/dissectors/packet-lbmpdmtcp.c
+++ b/epan/dissectors/packet-lbmpdmtcp.c
@@ -243,7 +243,8 @@ static int ett_lbmpdm_tcp = -1;
static int hf_lbmpdm_tcp_tag = -1;
static int hf_lbmpdm_tcp_channel = -1;
-static guint get_lbmpdm_tcp_pdu_length(packet_info * pinfo _U_, tvbuff_t * tvb, int offset)
+static guint get_lbmpdm_tcp_pdu_length(packet_info * pinfo _U_, tvbuff_t * tvb,
+ int offset, void *data _U_)
{
int encoding;
int packet_len = 0;
diff --git a/epan/dissectors/packet-lbttcp.c b/epan/dissectors/packet-lbttcp.c
index 2193d0dfc1..c118942711 100644
--- a/epan/dissectors/packet-lbttcp.c
+++ b/epan/dissectors/packet-lbttcp.c
@@ -469,7 +469,8 @@ static gboolean lbttcp_packet_is_transport_client(packet_info * pinfo, const lbt
return (is_transport_client_packet);
}
-static guint get_lbttcp_pdu_length(packet_info * pinfo _U_, tvbuff_t * tvb, int offset)
+static guint get_lbttcp_pdu_length(packet_info * pinfo _U_, tvbuff_t * tvb,
+ int offset, void *data _U_)
{
return lbmc_get_message_length(tvb, offset);
}
diff --git a/epan/dissectors/packet-ldap.c b/epan/dissectors/packet-ldap.c
index 74ed9075e1..247ef73ec4 100644
--- a/epan/dissectors/packet-ldap.c
+++ b/epan/dissectors/packet-ldap.c
@@ -4557,7 +4557,7 @@ static void dissect_NetLogon_PDU(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr
static guint
-get_sasl_ldap_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_sasl_ldap_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void* data _U_)
{
/* sasl encapsulated ldap is 4 bytes plus the length in size */
return tvb_get_ntohl(tvb, offset)+4;
@@ -4571,7 +4571,7 @@ dissect_sasl_ldap_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
}
static guint
-get_normal_ldap_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_normal_ldap_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint32 len;
gboolean ind;
diff --git a/epan/dissectors/packet-lg8979.c b/epan/dissectors/packet-lg8979.c
index d23b989462..cd077145da 100644
--- a/epan/dissectors/packet-lg8979.c
+++ b/epan/dissectors/packet-lg8979.c
@@ -1205,7 +1205,7 @@ dissect_lg8979(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _
/* Return length of L&G 8979 Protocol over TCP message (used for re-assembly) */
/******************************************************************************************************/
static guint
-get_lg8979_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset _U_)
+get_lg8979_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset _U_, void *data _U_)
{
guint len;
diff --git a/epan/dissectors/packet-lisp-tcp.c b/epan/dissectors/packet-lisp-tcp.c
index 5e912b8658..220c06ecc7 100644
--- a/epan/dissectors/packet-lisp-tcp.c
+++ b/epan/dissectors/packet-lisp-tcp.c
@@ -275,7 +275,8 @@ dissect_lisp_tcp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, vo
*/
static guint
-get_lisp_tcp_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_lisp_tcp_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
guint16 mlen;
diff --git a/epan/dissectors/packet-llrp.c b/epan/dissectors/packet-llrp.c
index 8b82b0eea3..86c8a53da3 100644
--- a/epan/dissectors/packet-llrp.c
+++ b/epan/dissectors/packet-llrp.c
@@ -2702,7 +2702,7 @@ dissect_llrp_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d
/* Determine length of LLRP message */
static guint
-get_llrp_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_llrp_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
/* Peek into the header to determine the total message length */
return (guint)tvb_get_ntohl(tvb, offset+2);
diff --git a/epan/dissectors/packet-lsc.c b/epan/dissectors/packet-lsc.c
index 58fa892020..db9a7dd020 100644
--- a/epan/dissectors/packet-lsc.c
+++ b/epan/dissectors/packet-lsc.c
@@ -281,7 +281,7 @@ dissect_lsc_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
/* Determine length of LSC message */
static guint
-get_lsc_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_lsc_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint8 op_code;
guint pdu_len;
diff --git a/epan/dissectors/packet-mausb.c b/epan/dissectors/packet-mausb.c
index d0f72b9c82..1e9e6018a3 100644
--- a/epan/dissectors/packet-mausb.c
+++ b/epan/dissectors/packet-mausb.c
@@ -621,7 +621,8 @@ static guint8 mausb_ep_handle_bus_num(guint16 handle) {
}
/* returns the length field of the MAUSB packet */
-static guint mausb_get_pkt_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+static guint mausb_get_pkt_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
return tvb_get_letohs(tvb, offset + 2);
}
@@ -1176,7 +1177,7 @@ dissect_mausb_pkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* create display subtree for the protocol */
ti = proto_tree_add_item(tree, proto_mausb, tvb, 0,
- mausb_get_pkt_len(pinfo, tvb, offset), ENC_NA);
+ mausb_get_pkt_len(pinfo, tvb, offset, NULL), ENC_NA);
mausb_tree = proto_item_add_subtree(ti, ett_mausb);
diff --git a/epan/dissectors/packet-mbtcp.c b/epan/dissectors/packet-mbtcp.c
index 05ef28258e..8607166697 100644
--- a/epan/dissectors/packet-mbtcp.c
+++ b/epan/dissectors/packet-mbtcp.c
@@ -651,7 +651,7 @@ dissect_mbrtu_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dat
/* Return length of Modbus/TCP message */
static guint
-get_mbtcp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_mbtcp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint16 plen;
@@ -669,7 +669,8 @@ get_mbtcp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
/* Return length of Modbus RTU over TCP message */
static guint
-get_mbrtu_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset _U_)
+get_mbrtu_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset _U_, void *data _U_)
{
/* Modbus/TCP frames include a "length" word in each message; Modbus RTU over TCP does not, so don't attempt to get one */
diff --git a/epan/dissectors/packet-memcache.c b/epan/dissectors/packet-memcache.c
index 9deac771e1..38fe389ea6 100644
--- a/epan/dissectors/packet-memcache.c
+++ b/epan/dissectors/packet-memcache.c
@@ -240,7 +240,8 @@ is_memcache_request_or_reply(const gchar *data, int linelen, guint8 *opcode,
ReqRespDissector *reqresp_dissector);
static guint
-get_memcache_pdu_len (packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_memcache_pdu_len (packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
guint32 body_len;
diff --git a/epan/dissectors/packet-mongo.c b/epan/dissectors/packet-mongo.c
index a880db5dc0..c46a81ccbf 100644
--- a/epan/dissectors/packet-mongo.c
+++ b/epan/dissectors/packet-mongo.c
@@ -647,7 +647,7 @@ dissect_mongo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dat
return tvb_length(tvb);
}
static guint
-get_mongo_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_mongo_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint32 plen;
diff --git a/epan/dissectors/packet-mq.c b/epan/dissectors/packet-mq.c
index 40520b7ce2..df6c31e1c2 100644
--- a/epan/dissectors/packet-mq.c
+++ b/epan/dissectors/packet-mq.c
@@ -4021,7 +4021,8 @@ static int reassemble_mq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, vo
return tvb_reported_length(tvb);
}
-static guint get_mq_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+static guint get_mq_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
if (tvb_reported_length_remaining(tvb, offset) >= 8)
{
diff --git a/epan/dissectors/packet-mqtt.c b/epan/dissectors/packet-mqtt.c
index 3a420389ab..0f30478b64 100644
--- a/epan/dissectors/packet-mqtt.c
+++ b/epan/dissectors/packet-mqtt.c
@@ -167,7 +167,8 @@ static gboolean reassemble_mqtt_over_tcp = TRUE;
#define GET_MQTT_PDU_LEN(msg_len, len_offset) (msg_len + len_offset + MQTT_HDR_SIZE_BEFORE_LEN)
-static guint get_mqtt_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+static guint get_mqtt_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
guint64 msg_len;
guint len_offset;
diff --git a/epan/dissectors/packet-mrcpv2.c b/epan/dissectors/packet-mrcpv2.c
index 1a7fc19022..4709455ca9 100644
--- a/epan/dissectors/packet-mrcpv2.c
+++ b/epan/dissectors/packet-mrcpv2.c
@@ -956,7 +956,7 @@ dissect_mrcpv2_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* get the length of the MRCP message */
static guint
-get_mrcpv2_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_mrcpv2_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
gint len_start;
gint len_end;
diff --git a/epan/dissectors/packet-mysql.c b/epan/dissectors/packet-mysql.c
index 56277a31be..7bc3faa0e4 100644
--- a/epan/dissectors/packet-mysql.c
+++ b/epan/dissectors/packet-mysql.c
@@ -2107,7 +2107,7 @@ tvb_get_fle(tvbuff_t *tvb, int offset, guint64 *res, guint8 *is_null)
/* dissector helper: length of PDU */
static guint
-get_mysql_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_mysql_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint plen= tvb_get_letoh24(tvb, offset);
return plen + 4; /* add length field + packet number */
diff --git a/epan/dissectors/packet-nbd.c b/epan/dissectors/packet-nbd.c
index 64e7ec2346..caac7cd8ce 100644
--- a/epan/dissectors/packet-nbd.c
+++ b/epan/dissectors/packet-nbd.c
@@ -79,7 +79,7 @@ static const value_string nbd_type_vals[] = {
* based on the information in the header.
*/
static guint
-get_nbd_tcp_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset)
+get_nbd_tcp_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset, void *data _U_)
{
guint32 magic, type, packet;
conversation_t *conversation;
diff --git a/epan/dissectors/packet-ncp.c b/epan/dissectors/packet-ncp.c
index f0d1d5f2e5..85ebe0b3a8 100644
--- a/epan/dissectors/packet-ncp.c
+++ b/epan/dissectors/packet-ncp.c
@@ -872,7 +872,7 @@ dissect_ncp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
static guint
-get_ncp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_ncp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint32 signature;
diff --git a/epan/dissectors/packet-ndmp.c b/epan/dissectors/packet-ndmp.c
index 485186aad6..d947c2068f 100644
--- a/epan/dissectors/packet-ndmp.c
+++ b/epan/dissectors/packet-ndmp.c
@@ -3297,7 +3297,7 @@ dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
}
static guint
-get_ndmp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_ndmp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint len;
diff --git a/epan/dissectors/packet-ndps.c b/epan/dissectors/packet-ndps.c
index 44294606d6..a6fa418e7f 100644
--- a/epan/dissectors/packet-ndps.c
+++ b/epan/dissectors/packet-ndps.c
@@ -4260,7 +4260,7 @@ dissect_ndps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree)
}
static guint
-get_ndps_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_ndps_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
return tvb_get_ntohs(tvb, offset +2) + 4;
}
diff --git a/epan/dissectors/packet-netsync.c b/epan/dissectors/packet-netsync.c
index 6f5c78f9a5..42786f10c0 100644
--- a/epan/dissectors/packet-netsync.c
+++ b/epan/dissectors/packet-netsync.c
@@ -409,7 +409,7 @@ static gint dissect_netsync_cmd_nonexistent(tvbuff_t *tvb, gint offset, proto_t
}
static guint
-get_netsync_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_netsync_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint64 size = 0;
guint size_bytes;
diff --git a/epan/dissectors/packet-openflow.c b/epan/dissectors/packet-openflow.c
index 1ee0ca4bda..ab0ddf92ee 100644
--- a/epan/dissectors/packet-openflow.c
+++ b/epan/dissectors/packet-openflow.c
@@ -70,7 +70,8 @@ static const value_string openflow_version_values[] = {
};
static guint
-get_openflow_pdu_length(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_openflow_pdu_length(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
return tvb_get_ntohs(tvb, offset + 2);
}
diff --git a/epan/dissectors/packet-openvpn.c b/epan/dissectors/packet-openvpn.c
index 0b62a989d4..470b294131 100644
--- a/epan/dissectors/packet-openvpn.c
+++ b/epan/dissectors/packet-openvpn.c
@@ -377,7 +377,7 @@ dissect_openvpn_msg_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *openvp
}
static guint
-get_msg_length(packet_info *pinfo _U_, tvbuff_t *tvb, gint offset)
+get_msg_length(packet_info *pinfo _U_, tvbuff_t *tvb, gint offset, void *data _U_)
{
return (guint)tvb_get_ntohs(tvb, offset) + 2; /* length field is at offset 0,
+2 to account for the length field itself */
diff --git a/epan/dissectors/packet-openwire.c b/epan/dissectors/packet-openwire.c
index a989211a66..2609db7faa 100644
--- a/epan/dissectors/packet-openwire.c
+++ b/epan/dissectors/packet-openwire.c
@@ -1362,7 +1362,7 @@ dissect_openwire(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
}
static guint
-get_openwire_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_openwire_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
if (tvb_length_remaining(tvb, offset) >= 5)
{
diff --git a/epan/dissectors/packet-opsi.c b/epan/dissectors/packet-opsi.c
index f1e4d9175d..6b76605e9f 100644
--- a/epan/dissectors/packet-opsi.c
+++ b/epan/dissectors/packet-opsi.c
@@ -491,7 +491,7 @@ decode_time_attribute(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto
/* To find the correct size of the PDU. Needed by the desegmentation feature*/
static guint
-get_opsi_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_opsi_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
/*
* Get the length of the OPSI packet.
diff --git a/epan/dissectors/packet-optommp.c b/epan/dissectors/packet-optommp.c
index 03827c77b4..a27f010a40 100644
--- a/epan/dissectors/packet-optommp.c
+++ b/epan/dissectors/packet-optommp.c
@@ -223,7 +223,7 @@ static const range_string optommp_mm_areas[] = {
/* Function Prototypes */
static guint get_optommp_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
- gint offset);
+ int offset, void *data _U_);
static gint dissect_optommp_reassemble_tcp(tvbuff_t *tvb, packet_info *pinfo,
proto_tree *tree, void *data);
static gint dissect_optommp_reassemble_udp(tvbuff_t *tvb, packet_info *pinfo,
@@ -274,7 +274,7 @@ parameters: pinfo: not used
purpose: Gets the message length depending on tcode and data_block len
****************************************************************************/
static guint get_optommp_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
- gint offset)
+ int offset, void *data _U_)
{
guint len = OPTO_FRAME_HEADER_LEN;
guint8 tcode = 0;
diff --git a/epan/dissectors/packet-osc.c b/epan/dissectors/packet-osc.c
index 5654afdf0d..3ac7be077b 100644
--- a/epan/dissectors/packet-osc.c
+++ b/epan/dissectors/packet-osc.c
@@ -619,7 +619,7 @@ dissect_osc_pdu_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
/* OSC TCP */
static guint
-get_osc_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_osc_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
return tvb_get_ntohl(tvb, offset) + 4;
}
diff --git a/epan/dissectors/packet-paltalk.c b/epan/dissectors/packet-paltalk.c
index dc2e0a755c..f9faa2fe3b 100644
--- a/epan/dissectors/packet-paltalk.c
+++ b/epan/dissectors/packet-paltalk.c
@@ -49,7 +49,8 @@ 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)
+dissect_paltalk_get_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
return tvb_get_ntohs(tvb, offset + 4) + PALTALK_HEADER_LENGTH;
}
diff --git a/epan/dissectors/packet-pcep.c b/epan/dissectors/packet-pcep.c
index 5b1f418562..3ce5a2796a 100644
--- a/epan/dissectors/packet-pcep.c
+++ b/epan/dissectors/packet-pcep.c
@@ -2895,7 +2895,7 @@ dissect_pcep_msg_tree(tvbuff_t *tvb, proto_tree *tree, guint tree_mode, packet_i
static guint
-get_pcep_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_pcep_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint16 plen;
diff --git a/epan/dissectors/packet-pcp.c b/epan/dissectors/packet-pcp.c
index 888a11d93d..8f6654646c 100644
--- a/epan/dissectors/packet-pcp.c
+++ b/epan/dissectors/packet-pcp.c
@@ -414,7 +414,7 @@ static const value_string packettypenames_creds[]= {
};
/* function prototypes */
-static guint get_pcp_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset);
+static guint get_pcp_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset, void *data);
static int dissect_pcp_message_creds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset);
static int dissect_pcp_message_error(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset);
static int dissect_pcp_message_start(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset);
@@ -435,7 +435,8 @@ static int dissect_pcp_partial_pmid(tvbuff_t *tvb, packet_info *pinfo, proto_tre
static int dissect_pcp_partial_when(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset);
/* message length for dissect_tcp */
-static guint get_pcp_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+static guint get_pcp_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
/* length is at the very start of the packet, after tcp header */
return (guint)tvb_get_ntohl(tvb, offset);
diff --git a/epan/dissectors/packet-pdc.c b/epan/dissectors/packet-pdc.c
index 92081c3321..67f20dee08 100644
--- a/epan/dissectors/packet-pdc.c
+++ b/epan/dissectors/packet-pdc.c
@@ -376,7 +376,8 @@ static int dissect_pdc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
}
/* function to provide TCP split packet combiner with size of packet */
-static guint get_pdc_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+static guint get_pdc_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
guint size;
guint extra;
diff --git a/epan/dissectors/packet-pgsql.c b/epan/dissectors/packet-pgsql.c
index ace10d781f..1ac35b151d 100644
--- a/epan/dissectors/packet-pgsql.c
+++ b/epan/dissectors/packet-pgsql.c
@@ -528,7 +528,7 @@ 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)
+pgsql_length(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
gint n = 0;
guchar type;
diff --git a/epan/dissectors/packet-pvfs2.c b/epan/dissectors/packet-pvfs2.c
index 8bde81a348..09d957c60e 100644
--- a/epan/dissectors/packet-pvfs2.c
+++ b/epan/dissectors/packet-pvfs2.c
@@ -274,7 +274,8 @@ static int dissect_pvfs_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
return tvb_reported_length(tvb);
}
-static guint get_pvfs_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+static guint get_pvfs_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
guint32 plen;
diff --git a/epan/dissectors/packet-reload-framing.c b/epan/dissectors/packet-reload-framing.c
index 66e5d67f25..9ec997dc7a 100644
--- a/epan/dissectors/packet-reload-framing.c
+++ b/epan/dissectors/packet-reload-framing.c
@@ -96,7 +96,8 @@ static const value_string types[] = {
};
static guint
-get_reload_framing_message_length(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_reload_framing_message_length(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
/* Get the type */
guint32 length = 9;
diff --git a/epan/dissectors/packet-riemann.c b/epan/dissectors/packet-riemann.c
index c719d95637..c4e0d94e4f 100644
--- a/epan/dissectors/packet-riemann.c
+++ b/epan/dissectors/packet-riemann.c
@@ -656,7 +656,8 @@ dissect_riemann_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
}
static guint
-get_riemann_tcp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_riemann_tcp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
return (tvb_get_ntohl(tvb, offset) + 4);
}
diff --git a/epan/dissectors/packet-rpcap.c b/epan/dissectors/packet-rpcap.c
index 77a0618272..2a9e7864b0 100644
--- a/epan/dissectors/packet-rpcap.c
+++ b/epan/dissectors/packet-rpcap.c
@@ -1091,7 +1091,7 @@ check_rpcap_heur (tvbuff_t *tvb, gboolean tcp)
static guint
-get_rpcap_pdu_len (packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_rpcap_pdu_len (packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
return tvb_get_ntohl (tvb, offset + 4) + 8;
}
diff --git a/epan/dissectors/packet-rpki-rtr.c b/epan/dissectors/packet-rpki-rtr.c
index 0f10b56688..bfc2350092 100644
--- a/epan/dissectors/packet-rpki-rtr.c
+++ b/epan/dissectors/packet-rpki-rtr.c
@@ -122,7 +122,7 @@ static const true_false_string tfs_flag_type_rk = {
};
static guint
-get_rpkirtr_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_rpkirtr_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint32 plen;
diff --git a/epan/dissectors/packet-s5066dts.c b/epan/dissectors/packet-s5066dts.c
index 62b1cf64af..2484b548e6 100644
--- a/epan/dissectors/packet-s5066dts.c
+++ b/epan/dissectors/packet-s5066dts.c
@@ -736,7 +736,8 @@ static guint dissect_s5066dts_warning(tvbuff_t *tvb, guint offset, proto_tree *t
return offset;
}
-static guint calculate_s5066dts_dpdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset _U_)
+static guint calculate_s5066dts_dpdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset _U_, void *data _U_)
{
guint pdu_type;
guint address_size;
@@ -744,6 +745,7 @@ static guint calculate_s5066dts_dpdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
guint pdu_size;
guint segmented_cpdu_size;
+ /* XXX: why is the offset not used to get this value? */
if (tvb_get_guint8(tvb, 0) != 0x90)
return 1;
else if (tvb_get_guint8(tvb, 1) != 0xEB)
@@ -912,7 +914,7 @@ static int dissect_s5066dts_raw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
/* Cannot find sync pattern at dissect_s5066dts_raw()! */
return 0;
}
- calculate_s5066dts_dpdu_len(pinfo, tvb, 0);
+ calculate_s5066dts_dpdu_len(pinfo, tvb, 0, NULL);
dissect_s5066dts(tvb, pinfo, tree, NULL);
return b_length;
diff --git a/epan/dissectors/packet-s5066sis.c b/epan/dissectors/packet-s5066sis.c
index 1b1671b8bf..5577080267 100644
--- a/epan/dissectors/packet-s5066sis.c
+++ b/epan/dissectors/packet-s5066sis.c
@@ -42,7 +42,7 @@ void proto_register_s5066(void);
void proto_reg_handoff_s5066(void);
/* Main dissectors */
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 guint get_s5066_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset, void *data);
static int dissect_s5066_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_);
/* Client transport layer header dissctor */
static guint dissect_s5066_client_transport_header(tvbuff_t *tvb, guint offset, proto_tree *tree, guint8 sapid, guint *client_app_id);
@@ -953,7 +953,7 @@ dissect_s5066_27(tvbuff_t *tvb, guint offset, proto_tree *tree, guint *client_ap
}
static guint
-get_s5066_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_s5066_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint16 plen;
diff --git a/epan/dissectors/packet-sabp.c b/epan/dissectors/packet-sabp.c
index 3b1fc452d5..fbbea58995 100644
--- a/epan/dissectors/packet-sabp.c
+++ b/epan/dissectors/packet-sabp.c
@@ -1804,7 +1804,7 @@ dissect_sabp_cb_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
static guint
-get_sabp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_sabp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint32 type_length;
int bit_offset;
diff --git a/epan/dissectors/packet-sametime.c b/epan/dissectors/packet-sametime.c
index 9bfdf7f88f..ccedc70d7a 100644
--- a/epan/dissectors/packet-sametime.c
+++ b/epan/dissectors/packet-sametime.c
@@ -665,7 +665,8 @@ sametime_stats_tree_init(stats_tree* st)
length of the sametime message
*/
static guint
-get_sametime_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_sametime_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
/* XXX: Actually: the length of the tvb will always be 4 or greater at this point */
/* because tcp_dissect_pdus was called with 4 as a required "fixed length". */
diff --git a/epan/dissectors/packet-sasp.c b/epan/dissectors/packet-sasp.c
index 55bb3fca53..3c0567c1db 100644
--- a/epan/dissectors/packet-sasp.c
+++ b/epan/dissectors/packet-sasp.c
@@ -319,7 +319,7 @@ static const value_string set_mem_state_reply_response_code[] = {
static guint
-get_sasp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_sasp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
/* Get the length of the SASP packet. */
return tvb_get_ntohl(tvb, offset + 5);
diff --git a/epan/dissectors/packet-scop.c b/epan/dissectors/packet-scop.c
index e2db6be5ee..2aa35558a6 100644
--- a/epan/dissectors/packet-scop.c
+++ b/epan/dissectors/packet-scop.c
@@ -77,7 +77,7 @@ void proto_reg_handoff_scop(void);
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);
-static guint get_scop_length(packet_info *pinfo _U_, tvbuff_t *tvb, int offset);
+static guint get_scop_length(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data);
/* Initialize protocol and registered fields */
static int proto_scop = -1;
@@ -221,7 +221,7 @@ dissect_scop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
*---------------------------------------------------------------
*/
static guint
-get_scop_length(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_scop_length(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
/* Byte 0: Protocol Type.
* Byte 1: Protocol Version.
diff --git a/epan/dissectors/packet-selfm.c b/epan/dissectors/packet-selfm.c
index c8fbd888d3..c856b060e1 100644
--- a/epan/dissectors/packet-selfm.c
+++ b/epan/dissectors/packet-selfm.c
@@ -2561,10 +2561,11 @@ dissect_selfm(tvbuff_t *selfm_tvb, packet_info *pinfo, proto_tree *tree, void* d
/* SEL Protocol "Response" messages include a "length" byte in offset 2 of each response message */
/******************************************************************************************************/
static guint
-get_selfm_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset _U_)
+get_selfm_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset _U_, void *data _U_)
{
guint message_len=0; /* message length, inclusive of header, data, crc */
+ /* XXX: this logic doesn't take into account the offset */
/* Get length byte from message */
if (tvb_length(tvb) > 2) {
message_len = tvb_get_guint8(tvb, 2);
diff --git a/epan/dissectors/packet-simulcrypt.c b/epan/dissectors/packet-simulcrypt.c
index 9c806cefdc..509112a57c 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 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 guint get_simulcrypt_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset, void *data);
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,
int container_data_length, guint16 iftype, gboolean is_subtree);
@@ -1405,7 +1405,8 @@ dissect_simulcrypt_data(proto_tree *simulcrypt_tree, proto_item *simulcrypt_item
/* determine PDU length of protocol foo */
static guint
-get_simulcrypt_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_simulcrypt_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
guint iLg;
diff --git a/epan/dissectors/packet-skinny.c b/epan/dissectors/packet-skinny.c
index 375c65543c..f0cb6af62c 100644
--- a/epan/dissectors/packet-skinny.c
+++ b/epan/dissectors/packet-skinny.c
@@ -2182,7 +2182,7 @@ dissector_handle_t skinny_handle;
/* Get the length of a single SCCP PDU */
static guint
-get_skinny_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_skinny_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint32 hdr_data_length;
diff --git a/epan/dissectors/packet-slsk.c b/epan/dissectors/packet-slsk.c
index 6b0b66603f..e079a65072 100644
--- a/epan/dissectors/packet-slsk.c
+++ b/epan/dissectors/packet-slsk.c
@@ -288,7 +288,8 @@ static const char* get_message_type(tvbuff_t *tvb) {
return message_type;
}
-static guint get_slsk_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+static guint get_slsk_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
guint32 msg_len;
msg_len = tvb_get_letohl(tvb, offset);
diff --git a/epan/dissectors/packet-smcr.c b/epan/dissectors/packet-smcr.c
index 2a36fbe5dc..bd9a390003 100644
--- a/epan/dissectors/packet-smcr.c
+++ b/epan/dissectors/packet-smcr.c
@@ -867,7 +867,7 @@ dissect_smcr_infiniband(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
static guint
-get_smcr_pdu_length(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_smcr_pdu_length(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint32 length;
length = tvb_get_ntohs(tvb, offset+CLC_MSG_LEN_OFFSET);
diff --git a/epan/dissectors/packet-smpp.c b/epan/dissectors/packet-smpp.c
index d92d726d2e..97f17eecb0 100644
--- a/epan/dissectors/packet-smpp.c
+++ b/epan/dissectors/packet-smpp.c
@@ -79,7 +79,7 @@
void proto_register_smpp(void);
void proto_reg_handoff_smpp(void);
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 guint get_smpp_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset, void *data);
static int dissect_smpp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_);
/*
@@ -2375,7 +2375,7 @@ dissect_smpp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
}
static guint
-get_smpp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_smpp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
return tvb_get_ntohl(tvb, offset);
}
diff --git a/epan/dissectors/packet-soupbintcp.c b/epan/dissectors/packet-soupbintcp.c
index 2e47558fc6..d48eebca0e 100644
--- a/epan/dissectors/packet-soupbintcp.c
+++ b/epan/dissectors/packet-soupbintcp.c
@@ -447,7 +447,8 @@ static guint
get_soupbintcp_pdu_len(
packet_info *pinfo _U_,
tvbuff_t *tvb,
- int offset)
+ int offset,
+ void *data _U_)
{
/* Determine the length of the PDU using the SOUP header's 16-bit
big-endian length (at offset zero). We're guaranteed to get at
diff --git a/epan/dissectors/packet-spdy.c b/epan/dissectors/packet-spdy.c
index 6a0a63dfe3..868de067e1 100644
--- a/epan/dissectors/packet-spdy.c
+++ b/epan/dissectors/packet-spdy.c
@@ -1639,7 +1639,7 @@ static int dissect_spdy_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
}
static guint get_spdy_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
- int offset)
+ int offset, void *data _U_)
{
return (guint)tvb_get_ntoh24(tvb, offset + 5) + 8;
}
diff --git a/epan/dissectors/packet-srvloc.c b/epan/dissectors/packet-srvloc.c
index b60419531d..f3b1c3d1eb 100644
--- a/epan/dissectors/packet-srvloc.c
+++ b/epan/dissectors/packet-srvloc.c
@@ -1370,7 +1370,7 @@ return offset;
}
static guint
-get_srvloc_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_srvloc_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
/*
* Get the length of the SRVLOC packet.
diff --git a/epan/dissectors/packet-starteam.c b/epan/dissectors/packet-starteam.c
index ae7d466500..d41da47f0d 100644
--- a/epan/dissectors/packet-starteam.c
+++ b/epan/dissectors/packet-starteam.c
@@ -573,7 +573,8 @@ dissect_starteam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
}
static guint
-get_starteam_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_starteam_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
guint32 iPDULength = 0;
if(tvb_length_remaining(tvb, offset) >= 8 && tvb_get_ntohl(tvb, offset + 0) == STARTEAM_MAGIC){
diff --git a/epan/dissectors/packet-stun.c b/epan/dissectors/packet-stun.c
index 50c8c2f186..56524c71c6 100644
--- a/epan/dissectors/packet-stun.c
+++ b/epan/dissectors/packet-stun.c
@@ -441,7 +441,8 @@ static const value_string federation_vals[] = {
};
static guint
-get_stun_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_stun_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
guint16 type = tvb_get_ntohs(tvb, offset);
guint length = tvb_get_ntohs(tvb, offset+2);
diff --git a/epan/dissectors/packet-synphasor.c b/epan/dissectors/packet-synphasor.c
index b715a8d006..96e7653a9e 100644
--- a/epan/dissectors/packet-synphasor.c
+++ b/epan/dissectors/packet-synphasor.c
@@ -562,7 +562,8 @@ static int dissect_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
}
/* 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)
+static guint get_pdu_length(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
return tvb_get_ntohs(tvb, offset + 2);
}
diff --git a/epan/dissectors/packet-tali.c b/epan/dissectors/packet-tali.c
index 92f5c1eb97..8371e940f0 100644
--- a/epan/dissectors/packet-tali.c
+++ b/epan/dissectors/packet-tali.c
@@ -87,7 +87,7 @@ static gboolean tali_desegment = TRUE;
/* Code to actually dissect the packets */
static guint
-get_tali_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_tali_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint16 length;
diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c
index d788d43e20..63e3722cce 100644
--- a/epan/dissectors/packet-tcp.c
+++ b/epan/dissectors/packet-tcp.c
@@ -2327,7 +2327,7 @@ again:
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),
+ guint (*get_pdu_len)(packet_info *, tvbuff_t *, int, void*),
new_dissector_t dissect_pdu, void* dissector_data)
{
volatile int offset = 0;
@@ -2378,7 +2378,7 @@ tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/*
* Get the length of the PDU.
*/
- plen = (*get_pdu_len)(pinfo, tvb, offset);
+ plen = (*get_pdu_len)(pinfo, tvb, offset, dissector_data);
if (plen < fixed_len) {
/*
* Either:
diff --git a/epan/dissectors/packet-tcp.h b/epan/dissectors/packet-tcp.h
index 8f6e0450dd..26a95da85b 100644
--- a/epan/dissectors/packet-tcp.h
+++ b/epan/dissectors/packet-tcp.h
@@ -106,7 +106,7 @@ struct tcpinfo {
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),
+ guint (*get_pdu_len)(packet_info *, tvbuff_t *, int, void*),
new_dissector_t dissect_pdu, void* dissector_data);
extern struct tcp_multisegment_pdu *
diff --git a/epan/dissectors/packet-tipc.c b/epan/dissectors/packet-tipc.c
index 9dd92234b2..4de6afea41 100644
--- a/epan/dissectors/packet-tipc.c
+++ b/epan/dissectors/packet-tipc.c
@@ -2007,7 +2007,7 @@ dissect_tipc_int_prot_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tipc_tr
/* determines the length of a TIPC package */
static guint
-get_tipc_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_tipc_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
return tvb_get_ntohl(tvb, offset) & 0x0001FFFF;
}
diff --git a/epan/dissectors/packet-tns.c b/epan/dissectors/packet-tns.c
index 0a96835d42..530b7f1b04 100644
--- a/epan/dissectors/packet-tns.c
+++ b/epan/dissectors/packet-tns.c
@@ -190,7 +190,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 guint get_tns_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset, void *data);
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,
@@ -747,7 +747,7 @@ static void dissect_tns_control(tvbuff_t *tvb, int offset, packet_info *pinfo,
}
static guint
-get_tns_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_tns_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
/*
* Get the length of the TNS message, including header
diff --git a/epan/dissectors/packet-tpncp.c b/epan/dissectors/packet-tpncp.c
index ce4018cf3a..f36116d474 100644
--- a/epan/dissectors/packet-tpncp.c
+++ b/epan/dissectors/packet-tpncp.c
@@ -314,7 +314,9 @@ static int dissect_tpncp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, vo
/*-------------------------------------------------------------------------------------------------------------------------------------------*/
-static guint get_tpncp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, gint offset) {
+static guint get_tpncp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
+{
guint16 plen;
/* Get the length of the DNS packet. */
diff --git a/epan/dissectors/packet-turnchannel.c b/epan/dissectors/packet-turnchannel.c
index 7599bb80a7..50bcb55b27 100644
--- a/epan/dissectors/packet-turnchannel.c
+++ b/epan/dissectors/packet-turnchannel.c
@@ -120,7 +120,8 @@ dissect_turnchannel_message(tvbuff_t *tvb, packet_info *pinfo,
}
static guint
-get_turnchannel_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_turnchannel_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
return (guint)tvb_get_ntohs(tvb, offset+2) + TURNCHANNEL_HDR_LEN;
}
diff --git a/epan/dissectors/packet-ucp.c b/epan/dissectors/packet-ucp.c
index 100934612f..a333f43f60 100644
--- a/epan/dissectors/packet-ucp.c
+++ b/epan/dissectors/packet-ucp.c
@@ -1733,7 +1733,7 @@ add_6xO(proto_tree *tree, tvbuff_t *tvb, guint8 OT)
#undef UcpHandleData
static guint
-get_ucp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_ucp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint intval=0;
int i;
diff --git a/epan/dissectors/packet-ulp.c b/epan/dissectors/packet-ulp.c
index 285b07a481..64d1ed08a4 100644
--- a/epan/dissectors/packet-ulp.c
+++ b/epan/dissectors/packet-ulp.c
@@ -6484,7 +6484,7 @@ static int dissect_ULP_PDU_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_
static guint
-get_ulp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_ulp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
/* PDU length = Message length */
return tvb_get_ntohs(tvb,offset);
diff --git a/epan/dissectors/packet-uma.c b/epan/dissectors/packet-uma.c
index d83ece0607..992db319b6 100644
--- a/epan/dissectors/packet-uma.c
+++ b/epan/dissectors/packet-uma.c
@@ -1675,7 +1675,7 @@ dissect_uma(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
}
static guint
-get_uma_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_uma_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
/* PDU length = Message length + length of length indicator */
return tvb_get_ntohs(tvb,offset)+2;
diff --git a/epan/dissectors/packet-winsrepl.c b/epan/dissectors/packet-winsrepl.c
index d4ce7af214..e9714e3f05 100644
--- a/epan/dissectors/packet-winsrepl.c
+++ b/epan/dissectors/packet-winsrepl.c
@@ -677,7 +677,8 @@ dissect_winsrepl_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
}
static guint
-get_winsrepl_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_winsrepl_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
guint pdu_len;
diff --git a/epan/dissectors/packet-wow.c b/epan/dissectors/packet-wow.c
index 9b31546721..32e90f9ff6 100644
--- a/epan/dissectors/packet-wow.c
+++ b/epan/dissectors/packet-wow.c
@@ -138,7 +138,7 @@ static gint ett_wow = -1;
static gint ett_wow_realms = -1;
static guint
-get_wow_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset)
+get_wow_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset, void *data _U_)
{
gint8 size_field_offset = -1;
guint8 cmd;
diff --git a/epan/dissectors/packet-xmcp.c b/epan/dissectors/packet-xmcp.c
index 73d0645dc8..ed77ab9ed4 100644
--- a/epan/dissectors/packet-xmcp.c
+++ b/epan/dissectors/packet-xmcp.c
@@ -316,7 +316,8 @@ static gint32 xmcp_service_port = -1;
static proto_item *xmcp_it_service_port = NULL;
static guint
-get_xmcp_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_xmcp_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
return(XMCP_HDR_LEN + tvb_get_ntohs(tvb, offset+2));
}
diff --git a/epan/dissectors/packet-xot.c b/epan/dissectors/packet-xot.c
index e3826ce7a7..2647a262fa 100644
--- a/epan/dissectors/packet-xot.c
+++ b/epan/dissectors/packet-xot.c
@@ -103,7 +103,8 @@ static gboolean xot_desegment = TRUE;
/* desegmentation of X.25 packet sequences */
static gboolean x25_desegment = FALSE;
-static guint get_xot_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+static guint get_xot_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
guint16 plen;
int remain = tvb_length_remaining(tvb, offset);
@@ -119,7 +120,8 @@ static guint get_xot_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
return XOT_HEADER_LENGTH + plen;
}
-static guint get_xot_pdu_len_mult(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+static guint get_xot_pdu_len_mult(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
int offset_before = offset; /* offset where we start this test */
int offset_next = offset + XOT_HEADER_LENGTH + X25_MIN_HEADER_LENGTH;
@@ -143,7 +145,7 @@ static guint get_xot_pdu_len_mult(packet_info *pinfo _U_, tvbuff_t *tvb, int off
/*
* Get the length of the current X.25-over-TCP packet.
*/
- plen = get_xot_pdu_len(pinfo, tvb, offset);
+ plen = get_xot_pdu_len(pinfo, tvb, offset, NULL);
offset_next = offset + plen;
/* Make sure we have enough data */
@@ -277,7 +279,7 @@ static int dissect_xot_pdu(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);
+ int len = get_xot_pdu_len_mult(pinfo, tvb, offset, NULL);
tvbuff_t *next_tvb;
int offset_max = offset+MIN(len,tvb_length_remaining(tvb, offset));
proto_item *ti;
@@ -292,7 +294,7 @@ static int dissect_xot_mult(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
while (offset <= offset_max - XOT_HEADER_LENGTH){
- int plen = get_xot_pdu_len(pinfo, tvb, offset);
+ int plen = get_xot_pdu_len(pinfo, tvb, offset, NULL);
next_tvb = tvb_new_subset(tvb, offset,plen, plen);
/*MIN(plen,tvb_length_remaining(tvb, offset)),plen*/
@@ -315,14 +317,14 @@ static int dissect_xot_tcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
XOT_HEADER_LENGTH,
get_xot_pdu_len,
dissect_xot_pdu, data);
- len=get_xot_pdu_len(pinfo, tvb, 0);
+ len=get_xot_pdu_len(pinfo, tvb, 0, NULL);
} 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, data);
- len=get_xot_pdu_len_mult(pinfo, tvb, 0);
+ len=get_xot_pdu_len_mult(pinfo, tvb, 0, NULL);
}
/*As tcp_dissect_pdus will not report the success/failure, we have to compute
again */
diff --git a/epan/dissectors/packet-yami.c b/epan/dissectors/packet-yami.c
index 7f66e90c94..5f2491189f 100644
--- a/epan/dissectors/packet-yami.c
+++ b/epan/dissectors/packet-yami.c
@@ -528,7 +528,8 @@ dissect_yami_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
#define FRAME_HEADER_LEN 16
static guint
-get_yami_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_yami_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
guint32 len = tvb_get_letohl(tvb, offset + 12);
diff --git a/epan/dissectors/packet-ymsg.c b/epan/dissectors/packet-ymsg.c
index 74ded821e8..661ef9c17a 100644
--- a/epan/dissectors/packet-ymsg.c
+++ b/epan/dissectors/packet-ymsg.c
@@ -340,7 +340,7 @@ static int get_content_item_length(tvbuff_t *tvb, int offset)
}
static guint
-get_ymsg_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_ymsg_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint plen;
diff --git a/epan/dissectors/packet-ziop.c b/epan/dissectors/packet-ziop.c
index 588b0efdeb..86fb38a152 100644
--- a/epan/dissectors/packet-ziop.c
+++ b/epan/dissectors/packet-ziop.c
@@ -183,7 +183,7 @@ dissect_ziop (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
}
static guint
-get_ziop_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_ziop_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint8 flags;
guint message_size;
diff --git a/epan/wslua/init_wslua.c b/epan/wslua/init_wslua.c
index 7b8399da0f..6e044ea811 100644
--- a/epan/wslua/init_wslua.c
+++ b/epan/wslua/init_wslua.c
@@ -142,6 +142,7 @@ lua_pinfo_end(wmem_allocator_t *allocator _U_, wmem_cb_event_t event _U_,
clear_outstanding_PrivateTable();
clear_outstanding_TreeItem();
clear_outstanding_FieldInfo();
+ clear_outstanding_FuncSavers();
/* keep invoking this callback later? */
return FALSE;
@@ -162,10 +163,7 @@ int dissect_lua(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data
lua_pinfo = pinfo;
lua_tvb = tvb;
- lua_tree = (struct _wslua_treeitem *)g_malloc(sizeof(struct _wslua_treeitem));
- lua_tree->tree = tree;
- lua_tree->item = proto_tree_add_item(tree, hf_wslua_fake, tvb, 0, 0, ENC_NA);
- lua_tree->expired = FALSE;
+ lua_tree = create_TreeItem(tree, proto_tree_add_item(tree, hf_wslua_fake, tvb, 0, 0, ENC_NA));
PROTO_ITEM_SET_HIDDEN(lua_tree->item);
/*
@@ -280,10 +278,7 @@ gboolean heur_dissect_lua(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, v
return FALSE;
}
- lua_tree = (struct _wslua_treeitem *)g_malloc(sizeof(struct _wslua_treeitem));
- lua_tree->tree = tree;
- lua_tree->item = proto_tree_add_item(tree, hf_wslua_fake, tvb, 0, 0, ENC_NA);
- lua_tree->expired = FALSE;
+ lua_tree = create_TreeItem(tree, proto_tree_add_item(tree, hf_wslua_fake, tvb, 0, 0, ENC_NA));
PROTO_ITEM_SET_HIDDEN(lua_tree->item);
push_Tvb(L,tvb);
diff --git a/epan/wslua/wslua.h b/epan/wslua/wslua.h
index 9fe25bfcf8..8413e94046 100644
--- a/epan/wslua/wslua.h
+++ b/epan/wslua/wslua.h
@@ -686,6 +686,10 @@ extern void lua_prime_all_fields(proto_tree* tree);
extern int Proto_commit(lua_State* L);
+extern TreeItem create_TreeItem(proto_tree* tree, proto_item* item);
+
+extern void clear_outstanding_FuncSavers(void);
+
extern void Int64_pack(lua_State* L, luaL_Buffer *b, gint idx, gboolean asLittleEndian);
extern int Int64_unpack(lua_State* L, const gchar *buff, gboolean asLittleEndian);
extern void UInt64_pack(lua_State* L, luaL_Buffer *b, gint idx, gboolean asLittleEndian);
diff --git a/epan/wslua/wslua_listener.c b/epan/wslua/wslua_listener.c
index 3f7767d347..c7feb6595e 100644
--- a/epan/wslua/wslua_listener.c
+++ b/epan/wslua/wslua_listener.c
@@ -103,10 +103,7 @@ static int lua_tap_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt
lua_pinfo = pinfo;
lua_tvb = edt->tvb;
- lua_tree = (struct _wslua_treeitem *)g_malloc(sizeof(struct _wslua_treeitem));
- lua_tree->tree = edt->tree;
- lua_tree->item = NULL;
- lua_tree->expired = FALSE;
+ lua_tree = create_TreeItem(edt->tree, NULL);
switch ( lua_pcall(tap->L,3,1,1) ) {
case 0:
diff --git a/epan/wslua/wslua_proto.c b/epan/wslua/wslua_proto.c
index 309c6d7ce7..2a4197a7ba 100644
--- a/epan/wslua/wslua_proto.c
+++ b/epan/wslua/wslua_proto.c
@@ -43,6 +43,7 @@
*/
#include "wslua.h"
+#include <epan/dissectors/packet-tcp.h>
#include <epan/exceptions.h>
#include <epan/show_exception.h>
@@ -2069,6 +2070,176 @@ int Proto_commit(lua_State* L) {
return 0;
}
+typedef struct _func_saver {
+ lua_State* state;
+ int get_len_ref;
+ int dissect_ref;
+} func_saver_t;
+
+static GPtrArray* outstanding_FuncSavers = NULL;
+
+void clear_outstanding_FuncSavers(void) {
+ while (outstanding_FuncSavers->len) {
+ func_saver_t* fs = (func_saver_t*)g_ptr_array_remove_index_fast(outstanding_FuncSavers,0);
+ if (fs->state) {
+ lua_State* L = fs->state;
+ if (fs->get_len_ref != LUA_NOREF) {
+ luaL_unref(L, LUA_REGISTRYINDEX, fs->get_len_ref);
+ }
+ if (fs->dissect_ref != LUA_NOREF) {
+ luaL_unref(L, LUA_REGISTRYINDEX, fs->dissect_ref);
+ }
+ }
+ g_free(fs);
+ }
+}
+
+static guint
+wslua_dissect_tcp_get_pdu_len(packet_info *pinfo, tvbuff_t *tvb,
+ int offset, void *data _U_)
+{
+ func_saver_t* fs = (func_saver_t*)data;
+ lua_State* L = fs->state;
+ int pdu_len = 0;
+
+ lua_settop(L, 0);
+ lua_rawgeti(L, LUA_REGISTRYINDEX, fs->get_len_ref);
+
+ if (lua_isfunction(L,1)) {
+
+ push_Tvb(L,tvb);
+ push_Pinfo(L,pinfo);
+ lua_pushinteger(L,offset);
+
+ if ( lua_pcall(L,3,1,0) ) {
+ luaL_error(L, "Lua Error in dissect_tcp_pdus get_len_func: %s", lua_tostring(L,-1));
+ } else {
+ /* if the Lua dissector reported the consumed bytes, pass it to our caller */
+ if (lua_isnumber(L, -1)) {
+ /* we got the pdu_len */
+ pdu_len = wslua_togint(L, -1);
+ lua_pop(L, 1);
+ } else {
+ luaL_error(L,"Lua Error dissect_tcp_pdus: get_len_func did not return a Lua number of the PDU length");
+ }
+ }
+
+ } else {
+ luaL_error(L,"Lua Error in dissect_tcp_pdus: did not find the get_len_func dissector");
+ }
+
+ return pdu_len;
+}
+
+static int
+wslua_dissect_tcp_dissector(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, void *data)
+{
+ func_saver_t* fs = (func_saver_t*)data;
+ lua_State* L = fs->state;
+ int consumed_bytes = 0;
+
+ lua_settop(L, 0);
+ lua_rawgeti(L, LUA_REGISTRYINDEX, fs->dissect_ref);
+
+ if (lua_isfunction(L,1)) {
+ /* XXX: not sure if it's kosher to just use the tree as the item */
+ TreeItem ti = create_TreeItem(tree, (proto_item*)tree);
+
+ push_Tvb(L,tvb);
+ push_Pinfo(L,pinfo);
+ push_TreeItem(L,ti);
+
+ if ( lua_pcall(L,3,1,0) ) {
+ luaL_error(L, "Lua Error dissect_tcp_pdus dissect_func: %s", lua_tostring(L,-1));
+ } else {
+ /* if the Lua dissector reported the consumed bytes, pass it to our caller */
+ if (lua_isnumber(L, -1)) {
+ /* we got the consumed bytes or the missing bytes as a negative number */
+ consumed_bytes = wslua_togint(L, -1);
+ lua_pop(L, 1);
+ }
+ }
+
+ } else {
+ luaL_error(L,"Lua Error dissect_tcp_pdus: did not find the dissect_func dissector");
+ }
+
+ return consumed_bytes;
+}
+
+
+WSLUA_FUNCTION wslua_dissect_tcp_pdus(lua_State* L) {
+ /* Make the TCP-layer invoke the given Lua dissection function for each
+ PDU in the TCP segment, of the length returned by the given get_len_func
+ function.
+
+ This function is useful for protocols that run over TCP and that are
+ either a fixed length always, or have a minimum size and have a length
+ field encoded within that minimum portion that identifies their full
+ length. For such protocols, their protocol dissector function can invoke
+ this `dissect_tcp_pdus()` function to make it easier to handle dissecting
+ their protocol's messages (i.e., their protocol data unit (PDU)). This
+ function shouild not be used for protocols whose PDU length cannot be
+ determined from a fixed minimum portion, such as HTTP or Telnet.
+
+ @since 1.99.2
+ */
+#define WSLUA_ARG_dissect_tcp_pdus_TVB 1 /* The Tvb buffer to dissect PDUs from. */
+#define WSLUA_ARG_dissect_tcp_pdus_TREE 2 /* The Tvb buffer to dissect PDUs from. */
+#define WSLUA_ARG_dissect_tcp_pdus_MIN_HEADER_SIZE 3 /* The number of bytes
+ in the fixed-length part of the PDU. */
+#define WSLUA_ARG_dissect_tcp_pdus_GET_LEN_FUNC 4 /* A Lua function that will be
+ called for each PDU, to determine the full length of the
+ PDU. The called function will be given (1) the `Tvb` object
+ of the whole `Tvb` (possibly reassembled), (2) the `Pinfo` object,
+ and (3) an offset number of the index of the first byte
+ of the PDU (i.e., its first header byte). The Lua function
+ must return a Lua number of the full length of the PDU. */
+#define WSLUA_ARG_dissect_tcp_pdus_DISSECT_FUNC 5 /* A Lua function that will be
+ called for each PDU, to dissect the PDU. The called
+ function will be given (1) the `Tvb` object of the PDU's
+ `Tvb` (possibly reassembled), (2) the `Pinfo` object,
+ and (3) the `TreeItem` object. The Lua function must
+ return a Lua number of the number of bytes read/handled,
+ which would typically be the `Tvb:len()`.*/
+#define WSLUA_OPTARG_dissect_tcp_pdus_DESEGMENT 6 /* Whether to reassemble PDUs
+ crossing TCP segment boundaries or not. (default=true) */
+ Tvb tvb = checkTvb(L,WSLUA_ARG_dissect_tcp_pdus_TVB);
+ TreeItem ti = checkTreeItem(L,WSLUA_ARG_dissect_tcp_pdus_TREE);
+ guint fixed_len = (guint)luaL_checkinteger(L,WSLUA_ARG_dissect_tcp_pdus_MIN_HEADER_SIZE);
+ gboolean proto_desegment = wslua_optbool(L, WSLUA_OPTARG_dissect_tcp_pdus_DESEGMENT, TRUE);
+
+ if (!lua_pinfo) {
+ luaL_error(L,"dissect_tcp_pdus can only be invoked while in a dissect function");
+ return 0;
+ }
+
+ if (lua_isfunction(L,WSLUA_ARG_dissect_tcp_pdus_GET_LEN_FUNC) &&
+ lua_isfunction(L,WSLUA_ARG_dissect_tcp_pdus_DISSECT_FUNC))
+ {
+ /* save the Lua functions so that we can call them later */
+ func_saver_t* fs = g_new(func_saver_t, 1);
+
+ lua_settop(L, WSLUA_ARG_dissect_tcp_pdus_DISSECT_FUNC);
+
+ fs->state = L;
+ /* the following pops the top function and sets a ref to it in the registry */
+ fs->dissect_ref = luaL_ref(L, LUA_REGISTRYINDEX);
+ fs->get_len_ref = luaL_ref(L, LUA_REGISTRYINDEX);
+
+ g_ptr_array_add(outstanding_FuncSavers, fs);
+
+ tcp_dissect_pdus(tvb->ws_tvb, lua_pinfo, ti->tree, proto_desegment,
+ fixed_len, wslua_dissect_tcp_get_pdu_len,
+ wslua_dissect_tcp_dissector, (void*)fs);
+ } else {
+ luaL_error(L,"The third and fourth arguments need to be Lua functions");
+ }
+ return 0;
+}
+
+
WSLUA_CLASS_DEFINE(Dissector,NOP,NOP);
/*
A refererence to a dissector, used to call a dissector against a packet or a part of it.
@@ -2188,6 +2359,7 @@ WSLUA_META Dissector_meta[] = {
int Dissector_register(lua_State* L) {
WSLUA_REGISTER_CLASS(Dissector);
+ outstanding_FuncSavers = g_ptr_array_new();
return 0;
}
diff --git a/epan/wslua/wslua_tree.c b/epan/wslua/wslua_tree.c
index 6a90d41b9e..bd0bb14e14 100644
--- a/epan/wslua/wslua_tree.c
+++ b/epan/wslua/wslua_tree.c
@@ -44,6 +44,16 @@ TreeItem* push_TreeItem(lua_State*L, TreeItem t) {
return pushTreeItem(L,t);
}
+TreeItem create_TreeItem(proto_tree* tree, proto_item* item)
+{
+ TreeItem tree_item = (TreeItem)g_malloc(sizeof(struct _wslua_treeitem));
+ tree_item->tree = tree;
+ tree_item->item = item;
+ tree_item->expired = FALSE;
+
+ return tree_item;
+}
+
CLEAR_OUTSTANDING(TreeItem, expired, TRUE)
WSLUA_CLASS_DEFINE(TreeItem,FAIL_ON_NULL_OR_EXPIRED("TreeItem"),NOP);
@@ -254,10 +264,7 @@ WSLUA_METHOD TreeItem_add_packet_field(lua_State *L) {
nargs--;
}
- tree_item = (TreeItem)g_malloc(sizeof(struct _wslua_treeitem));
- tree_item->item = item;
- tree_item->tree = proto_item_add_subtree(item,ett > 0 ? ett : wslua_ett);
- tree_item->expired = FALSE;
+ tree_item = create_TreeItem(proto_item_add_subtree(item,ett > 0 ? ett : wslua_ett), item);
PUSH_TREEITEM(L,tree_item);
@@ -414,10 +421,7 @@ static int TreeItem_add_item_any(lua_State *L, gboolean little_endian) {
lua_remove(L,1);
}
- tree_item = (TreeItem)g_malloc(sizeof(struct _wslua_treeitem));
- tree_item->item = item;
- tree_item->tree = proto_item_add_subtree(item,ett > 0 ? ett : wslua_ett);
- tree_item->expired = FALSE;
+ tree_item = create_TreeItem(proto_item_add_subtree(item,ett > 0 ? ett : wslua_ett), item);
PUSH_TREEITEM(L,tree_item);
diff --git a/plugins/gryphon/packet-gryphon.c b/plugins/gryphon/packet-gryphon.c
index 41a971fb77..ad18e0ad07 100644
--- a/plugins/gryphon/packet-gryphon.c
+++ b/plugins/gryphon/packet-gryphon.c
@@ -755,7 +755,7 @@ static const true_false_string set_not_set = { "Set", "Not set" };
#define FRAME_HEADER_LEN 8
static guint
-get_gryphon_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_gryphon_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
guint16 plen;
int padded_len;
diff --git a/plugins/opcua/opcua.c b/plugins/opcua/opcua.c
index 3a5ba17a95..acde1ab74b 100644
--- a/plugins/opcua/opcua.c
+++ b/plugins/opcua/opcua.c
@@ -133,7 +133,8 @@ static const char* g_szMessageTypes[] =
* This function reads the length information from
* the transport header.
*/
-static guint get_opcua_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+static guint get_opcua_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
+ int offset, void *data _U_)
{
gint32 plen;
diff --git a/test/captures/segmented_fpm.pcap b/test/captures/segmented_fpm.pcap
new file mode 100644
index 0000000000..f86e1038bb
--- /dev/null
+++ b/test/captures/segmented_fpm.pcap
Binary files differ
diff --git a/test/lua/dissectFPM.lua b/test/lua/dissectFPM.lua
new file mode 100644
index 0000000000..da52d74a5c
--- /dev/null
+++ b/test/lua/dissectFPM.lua
@@ -0,0 +1,452 @@
+----------------------------------------
+--
+-- author: Hadriel Kaplan <hadriel@128technology.com>
+-- Copyright (c) 2015, Hadriel Kaplan
+-- This code is in the Public Domain, or the BSD (3 clause) license
+-- if Public Domain does not apply in your country.
+--
+-- Version: 1.0
+--
+------------------------------------------
+--[[
+ This code is a plugin for Wireshark, to dissect Quagga FPM Netlink
+ protocol messages over TCP.
+
+ This script is used for testing, so it does some odd things:
+ * it dissects the FPM in two ways, controlled by a pref setting:
+ 1) using the desegment_offset/desegment_len method
+ 2) using the dissect_tcp_pdus() method
+ * it removes any existing FPM dissector; there isn't one right now
+ but there likely will be in the future.
+
+ Wireshark has a "Netlink" protocol dissector, but it currently expects
+ to be running on a Linux cooked-mode SLL header and link type. That's
+ because Netlink has traditionally been used between the Linux kernel
+ and user-space apps. But the open-source Quagga, zebra, and the
+ commercial ZebOS routing products also send Netlink messages over TCP
+ to other processes or even outside the box, to a "Forwarding Plane Manager"
+ (FPM) that controls forwarding-plane devices (typically hardware).
+
+ The Netlink message is encapsulated within an FPM header, which identifies
+ an FPM message version (currently 1), the type of message it contains
+ (namely a Netlink message), and its length.
+
+ So we have:
+ struct fpm_msg_hdr_t
+ {
+ uint8_t version;
+ uint8_t msg_type;
+ uint16_t msg_len;
+ }
+ followed by a Netlink message.
+]]----------------------------------------
+
+
+----------------------------------------
+-- do not modify this table
+local debug_level = {
+ DISABLED = 0,
+ LEVEL_1 = 1,
+ LEVEL_2 = 2
+}
+
+-- set this DEBUG to debug_level.LEVEL_1 to enable printing debug_level info
+-- set it to debug_level.LEVEL_2 to enable really verbose printing
+-- note: this will be overridden by user's preference settings
+local DEBUG = debug_level.LEVEL_1
+
+local default_settings =
+{
+ debug_level = DEBUG,
+ enabled = true, -- whether this dissector is enabled or not
+ port = 2620,
+ max_msg_len = 4096,
+ desegment = true, -- whether to TCP desegement or not
+ dissect_tcp = false, -- whether to use the dissect_tcp_pdus method or not
+ subdissect = true, -- whether to call sub-dissector or not
+ subdiss_type = wtap.NETLINK, -- the encap we get the subdissector for
+}
+
+local dprint = function() end
+local dprint2 = function() end
+local function reset_debug_level()
+ if default_settings.debug_level > debug_level.DISABLED then
+ dprint = function(...)
+ print(table.concat({"Lua:", ...}," "))
+ end
+
+ if default_settings.debug_level > debug_level.LEVEL_1 then
+ dprint2 = dprint
+ end
+ end
+end
+-- call it now
+reset_debug_level()
+
+
+----------------------------------------
+-- creates a Proto object, but doesn't register it yet
+local fpmProto = Proto("fpm", "FPM Header")
+
+
+----------------------------------------
+-- a function to convert tables of enumerated types to valstring tables
+-- i.e., from { "name" = number } to { number = "name" }
+local function makeValString(enumTable)
+ local t = {}
+ for name,num in pairs(enumTable) do
+ t[num] = name
+ end
+ return t
+end
+
+local MsgType = {
+ NONE = 0,
+ NETLINK = 1,
+}
+local msgtype_valstr = makeValString(MsgType)
+
+
+----------------------------------------
+-- a table of all of our Protocol's fields
+local hdr_fields =
+{
+ version = ProtoField.uint8 ("fpm.version", "Version", base.DEC),
+ msg_type = ProtoField.uint8 ("fpm.type", "Type", base.DEC, msgtype_valstr),
+ msg_len = ProtoField.uint16("fpm.length", "Length", base.DEC),
+}
+
+-- create a flat array table of the above that can be registered
+local pfields = {}
+
+-- recursive function to flatten the table into pfields
+local function flattenTable(tbl)
+ for k,v in pairs(tbl) do
+ if type(v) == 'table' then
+ flattenTable(v)
+ else
+ pfields[#pfields+1] = v
+ end
+ end
+end
+-- call it
+flattenTable(hdr_fields)
+
+-- register them
+fpmProto.fields = pfields
+
+dprint2("fpmProto ProtoFields registered")
+
+
+----------------------------------------
+-- some forward "declarations" of helper functions we use in the dissector
+local createSLL
+
+-- due to a bug in wireshark, we need to keep newly created tvb's for longer
+-- than the duration of the dissect function
+local tvbs = {}
+
+function fpmProto.init()
+ tvbs = {}
+end
+
+
+local FPM_MSG_HDR_LEN = 4
+
+----------------------------------------
+-- the following function is used for the new dissect_tcp_pdus method
+-- this one returns the length of the full message
+local function get_fpm_length(tvbuf, pktinfo, offset)
+ dprint2("FPM get_fpm_length function called")
+ local lengthVal = tvbuf:range(offset + 2, 2):uint()
+
+ if lengthVal > default_settings.max_msg_len then
+ -- too many bytes, invalid message
+ dprint("FPM message length is too long: ", lengthVal)
+ lengthVal = tvbuf:len()
+ end
+
+ return lengthVal
+end
+
+-- the following is the dissection function called for
+-- the new dissect_tcp_pdus method
+local function dissect_fpm_pdu(tvbuf, pktinfo, root)
+ dprint2("FPM dissect_fpm_pdu function called")
+
+ local lengthTvbr = tvbuf:range(2, 2)
+ local lengthVal = lengthTvbr:uint()
+
+ -- set the protocol column to show our protocol name
+ pktinfo.cols.protocol:set("FPM")
+
+ -- We start by adding our protocol to the dissection display tree.
+ local tree = root:add(fpmProto, tvbuf:range(offset, lengthVal))
+
+ local versionTvbr = tvbuf:range(0, 1)
+ local versionVal = versionTvbr:uint()
+ tree:add(hdr_fields.version, versionTvbr)
+
+ local msgTypeTvbr = tvbuf:range(1, 1)
+ local msgTypeVal = msgTypeTvbr:uint()
+ tree:add(hdr_fields.msg_type, msgTypeTvbr)
+
+ tree:add(hdr_fields.msg_len, lengthTvbr)
+
+ local result
+ if (versionVal == 1) and (msgTypeVal == MsgType.NETLINK) then
+ -- it carries a Netlink message, so we're going to create
+ -- a fake Linux SLL header for the built-in Netlink dissector
+ local payload = tvbuf:raw(FPM_MSG_HDR_LEN, lengthVal - FPM_MSG_HDR_LEN)
+ result = createSLL(payload)
+ end
+
+ -- looks good, go dissect it
+ if result then
+ -- ok now the hard part - try calling a sub-dissector?
+ -- only if settings/prefs told us to of course...
+ if default_settings.subdissect then
+ dprint2("FPM trying sub-dissector for wtap encap type:", default_settings.subdiss_type)
+
+ -- due to a bug in wireshark, we need to keep newly created tvb's for longer
+ -- than the duration of the dissect function
+ tvbs[#tvbs+1] = ByteArray.new(result, true):tvb("Netlink Message")
+ DissectorTable.get("wtap_encap"):try(default_settings.subdiss_type, tvbs[#tvbs], pktinfo, root)
+
+ -- local tvb = ByteArray.new(result, true):tvb("Netlink Message")
+ -- DissectorTable.get("wtap_encap"):try(default_settings.subdiss_type, tvb, pktinfo, root)
+ dprint2("FPM returning from sub-dissector")
+ end
+ else
+ dprint("FPM header not correctly dissected")
+ end
+
+ return lengthVal, 0
+end
+
+
+----------------------------------------
+-- the following function is used for dissecting using the
+-- old desegment_offset/desegment_len method
+-- it's a separate function because we run over TCP and thus might
+-- need to parse multiple messages in a single segment
+local function dissect(tvbuf, pktinfo, root, offset, origlen)
+ dprint2("FPM dissect function called")
+
+ local pktlen = origlen - offset
+
+ if pktlen < FPM_MSG_HDR_LEN then
+ -- we need more bytes
+ pktinfo.desegment_offset = offset
+ pktinfo.desegment_len = DESEGMENT_ONE_MORE_SEGMENT
+ return 0, DESEGMENT_ONE_MORE_SEGMENT
+ end
+
+ local lengthTvbr = tvbuf:range(offset + 2, 2)
+ local lengthVal = lengthTvbr:uint()
+
+ if lengthVal > default_settings.max_msg_len then
+ -- too many bytes, invalid message
+ dprint("FPM message length is too long: ", lengthVal)
+ return pktlen, 0
+ end
+
+ if pktlen < lengthVal then
+ dprint2("Need more bytes to desegment FPM")
+ pktinfo.desegment_offset = offset
+ pktinfo.desegment_len = (lengthVal - pktlen)
+ return 0, -(lengthVal - pktlen)
+ end
+
+ -- set the protocol column to show our protocol name
+ pktinfo.cols.protocol:set("FPM")
+
+ -- We start by adding our protocol to the dissection display tree.
+ local tree = root:add(fpmProto, tvbuf:range(offset, lengthVal))
+
+ local versionTvbr = tvbuf:range(offset, 1)
+ local versionVal = versionTvbr:uint()
+ tree:add(hdr_fields.version, versionTvbr)
+
+ local msgTypeTvbr = tvbuf:range(offset + 1, 1)
+ local msgTypeVal = msgTypeTvbr:uint()
+ tree:add(hdr_fields.msg_type, msgTypeTvbr)
+
+ tree:add(hdr_fields.msg_len, lengthTvbr)
+
+ local result
+ if (versionVal == 1) and (msgTypeVal == MsgType.NETLINK) then
+ -- it carries a Netlink message, so we're going to create
+ -- a fake Linux SLL header for the built-in Netlink dissector
+ local payload = tvbuf:raw(offset + FPM_MSG_HDR_LEN, lengthVal - FPM_MSG_HDR_LEN)
+ result = createSLL(payload)
+ end
+
+ -- looks good, go dissect it
+ if result then
+ -- ok now the hard part - try calling a sub-dissector?
+ -- only if settings/prefs told us to of course...
+ if default_settings.subdissect then
+ dprint2("FPM trying sub-dissector for wtap encap type:", default_settings.subdiss_type)
+
+ -- due to a bug in wireshark, we need to keep newly created tvb's for longer
+ -- than the duration of the dissect function
+ tvbs[#tvbs+1] = ByteArray.new(result, true):tvb("Netlink Message")
+ DissectorTable.get("wtap_encap"):try(default_settings.subdiss_type, tvbs[#tvbs], pktinfo, root)
+
+ -- local tvb = ByteArray.new(result, true):tvb("Netlink Message")
+ -- DissectorTable.get("wtap_encap"):try(default_settings.subdiss_type, tvb, pktinfo, root)
+ dprint2("FPM returning from sub-dissector")
+ end
+ else
+ dprint("FPM header not correctly dissected")
+ end
+
+ return lengthVal, 0
+end
+
+
+----------------------------------------
+-- The following creates the callback function for the dissector.
+-- It's the same as doing "appProto.dissector = function (tvbuf,pkt,root)"
+-- The 'tvbuf' is a Tvb object, 'pktinfo' is a Pinfo object, and 'root' is a TreeItem object.
+-- Whenever Wireshark dissects a packet that our Proto is hooked into, it will call
+-- this function and pass it these arguments for the packet it's dissecting.
+function fpmProto.dissector(tvbuf, pktinfo, root)
+ dprint2("fpmProto.dissector called")
+
+ local bytes_consumed = 0
+
+ if default_settings.dissect_tcp then
+ dprint2("using new dissect_tcp_pdus method")
+ dissect_tcp_pdus(tvbuf, root, FPM_MSG_HDR_LEN, get_fpm_length, dissect_fpm_pdu, default_settings.desegment)
+ bytes_consumed = tvbuf:len()
+ else
+ dprint2("using old desegment_offset/desegment_len method")
+ -- get the length of the packet buffer (Tvb).
+ local pktlen = tvbuf:len()
+ local offset, bytes_needed = 0, 0
+
+ tvbs = {}
+ while bytes_consumed < pktlen do
+ offset, bytes_needed = dissect(tvbuf, pktinfo, root, bytes_consumed, pktlen)
+ if offset == 0 then
+ if bytes_consumed > 0 then
+ return bytes_consumed
+ else
+ return bytes_needed
+ end
+ end
+ bytes_consumed = bytes_consumed + offset
+ end
+ end
+
+ return bytes_consumed
+end
+
+
+----------------------------------------
+-- we want to have our protocol dissection invoked for a specific TCP port,
+-- so get the TCP dissector table and add our protocol to it
+-- first remove any existing dissector for that port, if there is one
+local old_dissector = DissectorTable.get("tcp.port"):get_dissector(default_settings.port)
+if old_dissector then
+ dprint("Retrieved existing dissector")
+end
+
+local function enableDissector()
+ DissectorTable.get("tcp.port"):set(default_settings.port, fpmProto)
+end
+-- call it now
+enableDissector()
+
+local function disableDissector()
+ if old_dissector then
+ DissectorTable.get("tcp.port"):set(default_settings.port, old_dissector)
+ end
+end
+
+
+--------------------------------------------------------------------------------
+-- preferences handling stuff
+--------------------------------------------------------------------------------
+
+local debug_pref_enum = {
+ { 1, "Disabled", debug_level.DISABLED },
+ { 2, "Level 1", debug_level.LEVEL_1 },
+ { 3, "Level 2", debug_level.LEVEL_2 },
+}
+
+----------------------------------------
+-- register our preferences
+fpmProto.prefs.enabled = Pref.bool("Dissector enabled", default_settings.enabled,
+ "Whether the FPM dissector is enabled or not")
+
+
+fpmProto.prefs.desegment = Pref.bool("Reassemble FPM messages spanning multiple TCP segments",
+ default_settings.desegment,
+ "Whether the FPM dissector should reassemble"..
+ " messages spanning multiple TCP segments."..
+ " To use this option, you must also enable"..
+ " \"Allow subdissectors to reassemble TCP"..
+ " streams\" in the TCP protocol settings.")
+
+fpmProto.prefs.dissect_tcp = Pref.bool("Use dissect_tcp_pdus", default_settings.dissect_tcp,
+ "Whether the FPM dissector should use the new" ..
+ " dissect_tcp_pdus model or not")
+
+fpmProto.prefs.subdissect = Pref.bool("Enable sub-dissectors", default_settings.subdissect,
+ "Whether the FPM packet's content" ..
+ " should be dissected or not")
+
+fpmProto.prefs.debug = Pref.enum("Debug", default_settings.debug_level,
+ "The debug printing level", debug_pref_enum)
+
+----------------------------------------
+-- a function for handling prefs being changed
+function fpmProto.prefs_changed()
+ dprint2("prefs_changed called")
+
+ default_settings.dissect_tcp = fpmProto.prefs.dissect_tcp
+
+ default_settings.subdissect = fpmProto.prefs.subdissect
+
+ default_settings.debug_level = fpmProto.prefs.debug
+ reset_debug_level()
+
+ if default_settings.enabled ~= fpmProto.prefs.enabled then
+ default_settings.enabled = fpmProto.prefs.enabled
+ if default_settings.enabled then
+ enableDissector()
+ else
+ disableDissector()
+ end
+ -- have to reload the capture file for this type of change
+ reload()
+ end
+
+end
+
+dprint2("pcapfile Prefs registered")
+
+
+----------------------------------------
+-- the hatype field of the SLL must be 824 decimal, in big-endian encoding (0x0338)
+local ARPHRD_NETLINK = "\003\056"
+local WS_NETLINK_ROUTE = "\000\000"
+local function emptyBytes(num)
+ return string.rep("\000", num)
+end
+
+createSLL = function (payload)
+ dprint2("FPM createSLL function called")
+ local sllmsg =
+ {
+ emptyBytes(2), -- Unused 2B
+ ARPHRD_NETLINK, -- netlink type
+ emptyBytes(10), -- Unused 10B
+ WS_NETLINK_ROUTE, -- Route type
+ payload -- the Netlink message
+ }
+ return table.concat(sllmsg)
+end
diff --git a/test/suite-wslua.sh b/test/suite-wslua.sh
index 76a6bf3c3d..d45062427c 100755
--- a/test/suite-wslua.sh
+++ b/test/suite-wslua.sh
@@ -67,7 +67,7 @@ wslua_step_dissector_test() {
if [ ! $RETURNVALUE -eq $EXIT_OK ]; then
echo
cat ./testin.txt
- test_step_failed "subtest-1 exit status of $DUT: $RETURNVALUE"
+ test_step_failed "subtest-2 exit status of $DUT: $RETURNVALUE"
return
fi
@@ -77,7 +77,7 @@ wslua_step_dissector_test() {
if [ $? -ne 0 ]; then
cat ./testin.txt
cat ./testout.txt
- test_step_failed "subtest-1 didn't find pass marker"
+ test_step_failed "subtest-2 didn't find pass marker"
fi
# run tshark with the dissector script again, but in mode 3.
@@ -86,19 +86,49 @@ wslua_step_dissector_test() {
if [ ! $RETURNVALUE -eq $EXIT_OK ]; then
echo
cat ./testin.txt
- test_step_failed "subtest-1 exit status of $DUT: $RETURNVALUE"
+ test_step_failed "subtest-3 exit status of $DUT: $RETURNVALUE"
return
fi
# then run tshark again with the verification script. (it internally reads in testin.txt)
$TSHARK -r $CAPTURE_DIR/empty.pcap -X lua_script:$TESTS_DIR/lua/verify_dissector.lua -X lua_script1:no_heur > testout.txt 2>&1
- if grep -q "All tests passed!" testout.txt; then
+ grep -q "All tests passed!" testout.txt
+ if [ $? -ne 0 ]; then
+ cat ./testin.txt
+ cat ./testout.txt
+ test_step_failed "subtest-3 didn't find pass marker"
+ return
+ fi
+
+ # then run tshark again with the verification script. (it internally reads in testin.txt)
+ $TSHARK -r $CAPTURE_DIR/segmented_fpm.pcap -X lua_script:$TESTS_DIR/lua/dissectFPM.lua -o fpm.dissect_tcp:true -V > testin.txt 2>&1
+ RETURNVALUE=$?
+ if [ ! $RETURNVALUE -eq $EXIT_OK ]; then
+ echo
+ cat ./testin.txt
+ test_step_failed "subtest-4a exit status of $DUT: $RETURNVALUE"
+ return
+ fi
+
+ $TSHARK -r $CAPTURE_DIR/segmented_fpm.pcap -X lua_script:$TESTS_DIR/lua/dissectFPM.lua -o fpm.dissect_tcp:false -V > testout.txt 2>&1
+ RETURNVALUE=$?
+ if [ ! $RETURNVALUE -eq $EXIT_OK ]; then
+ echo
+ cat ./testout.txt
+ test_step_failed "subtest-4b exit status of $DUT: $RETURNVALUE"
+ return
+ fi
+
+ # now compare the two files - they should be identical
+ if diff -q ./testin.txt ./testout.txt; then
+ rm ./testin.txt
+ rm ./testout.txt
test_step_ok
else
echo
cat ./testin.txt
cat ./testout.txt
- test_step_failed "didn't find pass marker"
+ test_step_failed "subtest-4 the new and old tcp dissection methods differed"
fi
}