From eb70c97a9bd9f362a3e2f888dd082c5b9b4b9516 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sun, 5 May 2002 00:16:38 +0000 Subject: Make a "tcp_dissect_pdus()" with the standard loop for a TCP segment, extracting PDUs from it and possibly doing reassembly. Make the COPS, DNS, DSI, Gryphon, and SCCP dissectors use it. Add "set_actual_length()", "tcp_dissect_pdus()", "decode_boolean_bitfield()", "decode_numeric_bitfield()", and "decode_enumerated_bitfield()" to the list of routines available to dissectors on platforms where routines in the main program aren't available to dynamically-loaded code. Declare routines in "to_str.h" as "extern"; as I remember, that's necessary to allow the "decode_XXX_bitfield()" routines declared therein to be made available to plugins as per the above. Note that new exported routines should be added to the end of the table if that's the only change being made to the table. Create a new "plugin_api_decls.h" header file, used to declare both the "p_" variables and the "p_" structure members in the routine-exporting mechanism; this reduces the number of places you have to change to change the list of exported routines. svn path=/trunk/; revision=5394 --- packet-tcp.h | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'packet-tcp.h') diff --git a/packet-tcp.h b/packet-tcp.h index 5e4c34184b..40d8a354e5 100644 --- a/packet-tcp.h +++ b/packet-tcp.h @@ -1,6 +1,6 @@ /* packet-tcp.h * - * $Id: packet-tcp.h,v 1.9 2002/02/18 23:51:55 guy Exp $ + * $Id: packet-tcp.h,v 1.10 2002/05/05 00:16:32 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -34,6 +34,29 @@ struct tcpinfo { guint16 urgent_pointer; /* Urgent pointer value for the current packet. */ }; +/* + * Loop for dissecting PDUs within a TCP stream; assumes that a PDU + * consists of a fixed-length chunk of data that contains enough information + * to determine the length of the PDU, followed by rest of the PDU. + * + * The first three arguments are the arguments passed to the dissector + * that calls this routine. + * + * "proto_desegment" is the dissector's flag controlling whether it should + * desegment PDUs that cross TCP segment boundaries. + * + * "fixed_len" is the length of the fixed-length part of the PDU. + * + * "get_pdu_len()" is a routine called to get the length of the PDU from + * the fixed-length part of the PDU; it's passed "tvb" and "offset". + * + * "dissect_pdu()" is the routine to dissect a PDU. + */ +extern void +tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + gboolean proto_desegment, int fixed_len, + guint (*get_pdu_len)(tvbuff_t *, int), + void (*dissect_pdu)(tvbuff_t *, packet_info *, proto_tree *)); extern void decode_tcp_ports(tvbuff_t *, int, packet_info *, proto_tree *, int, int); -- cgit v1.2.3