diff options
author | Guy Harris <guy@alum.mit.edu> | 2002-02-02 02:51:20 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2002-02-02 02:51:20 +0000 |
commit | 02d0d906824d007d0063188477060e27ec37be89 (patch) | |
tree | f455cdf13d6752fdfd2731b61de4c96a473974d2 /packet-tpkt.h | |
parent | 2e5847828aaaf8f33f60a55bc948e9df2722b7c3 (diff) |
Clean up the heuristic code in the Q.931 dissector. If it's a heuristic
dissector, it's looking for Q.931 encapsulated inside TPKT, so it
shouldn't check whether the first byte is NLPID_Q_931 or not, as it
*won't* be NLPID_Q_931, it'll be 3, for the TPKT version. It should
first check whether "is_tpkt()" thinks it's a TPKT packet, and then
check that the packet has at least 3 bytes past the TPKT header, then
check the first byte in the payload to see whether it's NLPID_Q_931. If
that all succeeds, treat it as Q.931 inside TPKT.
Make "is_tpkt()" return the length from the TPKT header on success, and
-1 on failure, and return the offset past the TPKT header via a pointer
(so clients don't have to know that the TPKT header is 4 bytes long).
svn path=/trunk/; revision=4669
Diffstat (limited to 'packet-tpkt.h')
-rw-r--r-- | packet-tpkt.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/packet-tpkt.h b/packet-tpkt.h index 588e1c7a33..9afc02a01a 100644 --- a/packet-tpkt.h +++ b/packet-tpkt.h @@ -5,7 +5,7 @@ * Copyright 2000, Philips Electronics N.V. * Andreas Sikkema <andreas.sikkema@philips.com> * - * $Id: packet-tpkt.h,v 1.4 2001/06/12 06:31:14 guy Exp $ + * $Id: packet-tpkt.h,v 1.5 2002/02/02 02:51:20 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -28,8 +28,11 @@ /* * Check whether this could be a TPKT-encapsulated PDU. + * Returns -1 if it's not. + * Sets "*offset" to the offset of the first byte past the TPKT header, + * and returns the length from the TPKT header, if it is. */ -gboolean is_tpkt( tvbuff_t *tvb, unsigned int* offset ); +int is_tpkt( tvbuff_t *tvb, int *offset ); /* @@ -38,8 +41,6 @@ gboolean is_tpkt( tvbuff_t *tvb, unsigned int* offset ); * * Returns -1 if TPKT isn't enabled, otherwise returns the PDU length * from the TPKT header. - * - * Sets "*offset" to the offset following the TPKT header. */ -int dissect_tpkt_header( tvbuff_t *tvb, unsigned int* offset, - packet_info *pinfo, proto_tree *tree ); +int dissect_tpkt_header( tvbuff_t *tvb, int offset, packet_info *pinfo, + proto_tree *tree ); |