Ethereal-cvs: [ethereal-cvs] cvs commit: ethereal packet-atm.c packet-atm.h packet-lapd.c
guy 2000/05/29 03:57:51 CDT
Modified files:
. packet-atm.c packet-atm.h packet-lapd.c
packet-q2931.c packet-q2931.h
packet-q931.c packet-q931.h
packet-sscop.c packet-sscop.h packet.c
tvbuff.c tvbuff.h
Log:
Add "tvb_reported_length()" to get the "reported length" of a tvbuff
(i.e., the amount of data that was in the packet, even if not all of it
was captured), for use when dissecting packets containing data that
fills the packet (we want the dissector to try to dissect all of it; if
it runs past the end of the captured data, we want it to throw an
exception so that we'll put a "Short Frame" note in the protocol tree).
This means we always want a tvbuff to have a real reported length value,
so we make it an unsigned integer, and don't bother checking it for -1,
as it should never be -1.
If the reported length passed in to "tvb_set_subset()" is -1, set the
reported length to the reported length of the tvbuff of which the new
tvbuff will be a subset minus the offset in that tvbuff of the subset,
so that "-1" means "what's left of the packet after we chop off the
header". This is necessary in order to ensure that all tvbuffs have a
real reported length value.
Have "dissect_packet()" set the reported length of the top-level tvbuff
to the reported length of the frame, so that we start out with a tvbuff
with a real reported length value.
Have "tvb_offset_exists()" return FALSE if the offset is past the end of
the tvbuff.
If the offset passed to it is postitive, have "compute_offset_length()"
check for that it's not more than one byte past the end of the tvbuff -
if it's just past the end, we don't want the check to fail, as we don't
want attempts to create a subset tvbuff containing zero bytes to fail;
that would be done if a captured packet was all header and no payload,
and we'd want the dissector of the payload, not the dissector of the
header, to throw an exception, as the problem isn't with the protocol
for the header, it's with the protocol for the payload.
Convert the ATM dissector, the SSCOP dissector, the Q.2931 dissector,
and the Q.931 dissector to use tvbuffs.
Make the LAPD dissector set up a tvbuff for the Q.931 dissector (it's
not converted yet).
Revision Changes Path
1.21 +158 -152 ethereal/packet-atm.c
1.4 +2 -3 ethereal/packet-atm.h
1.9 +6 -4 ethereal/packet-lapd.c
1.9 +311 -321 ethereal/packet-q2931.c
1.2 +2 -3 ethereal/packet-q2931.h
1.15 +313 -303 ethereal/packet-q931.c
1.3 +5 -5 ethereal/packet-q931.h
1.8 +68 -65 ethereal/packet-sscop.c
1.2 +2 -3 ethereal/packet-sscop.h
1.92 +3 -3 ethereal/packet.c
1.4 +60 -23 ethereal/tvbuff.c
1.4 +5 -2 ethereal/tvbuff.h