diff options
-rw-r--r-- | epan/plugins.c | 9 | ||||
-rw-r--r-- | epan/to_str.h | 39 | ||||
-rw-r--r-- | packet-cops.c | 123 | ||||
-rw-r--r-- | packet-dns.c | 143 | ||||
-rw-r--r-- | packet-dsi.c | 130 | ||||
-rw-r--r-- | packet-skinny.c | 123 | ||||
-rw-r--r-- | packet-tcp.c | 137 | ||||
-rw-r--r-- | packet-tcp.h | 25 | ||||
-rw-r--r-- | plugins/Makefile.am | 3 | ||||
-rw-r--r-- | plugins/gryphon/packet-gryphon.c | 143 | ||||
-rw-r--r-- | plugins/plugin_api.c | 14 | ||||
-rw-r--r-- | plugins/plugin_api.h | 18 | ||||
-rw-r--r-- | plugins/plugin_api_decls.h | 212 | ||||
-rw-r--r-- | plugins/plugin_api_defs.h | 171 | ||||
-rw-r--r-- | plugins/plugin_table.h | 182 |
15 files changed, 557 insertions, 915 deletions
diff --git a/epan/plugins.c b/epan/plugins.c index f1fd26201b..84dbd62b40 100644 --- a/epan/plugins.c +++ b/epan/plugins.c @@ -1,7 +1,7 @@ /* plugins.c * plugin routines * - * $Id: plugins.c,v 1.50 2002/02/23 02:16:12 guy Exp $ + * $Id: plugins.c,v 1.51 2002/05/05 00:16:34 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -64,6 +64,7 @@ #include "conversation.h" #include "packet-giop.h" #include "packet-tpkt.h" +#include "packet-tcp.h" #include "plugins/plugin_table.h" static plugin_address_table_t patable; #endif @@ -441,6 +442,12 @@ init_plugins(const char *plugin_dir) patable.p_is_tpkt = is_tpkt; patable.p_dissect_tpkt_encap = dissect_tpkt_encap; + + patable.p_set_actual_length = set_actual_length; + patable.p_tcp_dissect_pdus = tcp_dissect_pdus; + patable.p_decode_boolean_bitfield = decode_boolean_bitfield; + patable.p_decode_numeric_bitfield = decode_numeric_bitfield; + patable.p_decode_enumerated_bitfield = decode_enumerated_bitfield; #endif #ifdef WIN32 diff --git a/epan/to_str.h b/epan/to_str.h index 18a412f90e..a954700205 100644 --- a/epan/to_str.h +++ b/epan/to_str.h @@ -1,7 +1,7 @@ /* to_str.h * Definitions for utilities to convert various other types to strings. * - * $Id: to_str.h,v 1.5 2001/09/14 07:10:10 guy Exp $ + * $Id: to_str.h,v 1.6 2002/05/05 00:16:34 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -51,28 +51,29 @@ typedef enum { * but for which no more specific module applies. */ -gchar* ether_to_str(const guint8 *); -gchar* ether_to_str_punct(const guint8 *, char); -gchar* ip_to_str(const guint8 *); -void ip_to_str_buf(const guint8 *, gchar *); +extern gchar* ether_to_str(const guint8 *); +extern gchar* ether_to_str_punct(const guint8 *, char); +extern gchar* ip_to_str(const guint8 *); +extern void ip_to_str_buf(const guint8 *, gchar *); struct e_in6_addr; -gchar* ip6_to_str(struct e_in6_addr *); -gchar* ipx_addr_to_str(guint32, const guint8 *); -gchar* ipxnet_to_string(const guint8 *ad); -gchar* ipxnet_to_str_punct(const guint32 ad, char punct); -gchar* vines_addr_to_str(const guint8 *addrp); -gchar* time_secs_to_str(guint32); -gchar* time_msecs_to_str(guint32); -gchar* abs_time_to_str(nstime_t*); -void display_signed_time(gchar *, int, gint32, gint32, time_res_t); -gchar* rel_time_to_str(nstime_t*); -gchar* rel_time_to_secs_str(nstime_t*); +extern char* ip6_to_str(struct e_in6_addr *); +extern gchar* ipx_addr_to_str(guint32, const guint8 *); +extern gchar* ipxnet_to_string(const guint8 *ad); +extern gchar* ipxnet_to_str_punct(const guint32 ad, char punct); +extern gchar* vines_addr_to_str(const guint8 *addrp); +extern gchar* time_secs_to_str(guint32); +extern gchar* time_msecs_to_str(guint32); +extern gchar* abs_time_to_str(nstime_t*); +extern void display_signed_time(gchar *, int, gint32, gint32, time_res_t); +extern gchar* rel_time_to_str(nstime_t*); +extern gchar* rel_time_to_secs_str(nstime_t*); -char * decode_bitfield_value(char *buf, guint32 val, guint32 mask, int width); -const char *decode_boolean_bitfield(guint32 val, guint32 mask, int width, +extern char *decode_bitfield_value(char *buf, guint32 val, guint32 mask, + int width); +extern const char *decode_boolean_bitfield(guint32 val, guint32 mask, int width, const char *truedesc, const char *falsedesc); -const char *decode_numeric_bitfield(guint32 val, guint32 mask, int width, +extern const char *decode_numeric_bitfield(guint32 val, guint32 mask, int width, const char *fmt); #endif /* __TO_STR_H__ */ diff --git a/packet-cops.c b/packet-cops.c index 6848218862..a664e9818f 100644 --- a/packet-cops.c +++ b/packet-cops.c @@ -4,7 +4,7 @@ * * Copyright 2000, Heikki Vatiainen <hessu@cs.tut.fi> * - * $Id: packet-cops.c,v 1.29 2002/04/28 00:43:16 guy Exp $ + * $Id: packet-cops.c,v 1.30 2002/05/05 00:16:32 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -37,7 +37,7 @@ #include <glib.h> #include <epan/packet.h> #include "packet-ipv6.h" -#include "packet-frame.h" +#include "packet-tcp.h" #include "asn1.h" #include "format-oid.h" @@ -426,6 +426,7 @@ static gint ett_cops_pdp = -1; void proto_reg_handoff_cops(void); +static guint get_cops_pdu_len(tvbuff_t *tvb, int offset); static void dissect_cops_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); static int dissect_cops_object(tvbuff_t *tvb, guint32 offset, proto_tree *tree); @@ -440,115 +441,17 @@ static int dissect_cops_pr_object_data(tvbuff_t *tvb, guint32 offset, proto_tree static void dissect_cops(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - volatile int offset = 0; - int length_remaining; - guint32 msg_len; - int length; - tvbuff_t *next_tvb; - - while (tvb_reported_length_remaining(tvb, offset) != 0) { - length_remaining = tvb_length_remaining(tvb, offset); - if (length_remaining == -1) - THROW(BoundsError); - - /* - * Can we do reassembly? - */ - if (cops_desegment && pinfo->can_desegment) { - /* - * Yes - is the COPS header split across segment - * boundaries? - */ - if (length_remaining < 8) { - /* - * Yes. Tell the TCP dissector where - * the data for this message starts in - * the data it handed us, and how many - * more bytes we need, and return. - */ - pinfo->desegment_offset = offset; - pinfo->desegment_len = 8 - length_remaining; - return; - } - } - - /* - * Get the length of the COPS message. - */ - msg_len = tvb_get_ntohl(tvb, offset + 4); - - /* - * Can we do reassembly? - */ - if (cops_desegment && pinfo->can_desegment) { - /* - * Yes - is the DNS packet split across segment - * boundaries? - */ - if ((guint32)length_remaining < msg_len) { - /* - * Yes. Tell the TCP dissector where - * the data for this message starts in - * the data it handed us, and how many - * more bytes we need, and return. - */ - pinfo->desegment_offset = offset; - pinfo->desegment_len = - msg_len - length_remaining; - return; - } - } - - /* - * Construct a tvbuff containing the amount of the payload - * we have available. Make its reported length the - * amount of data in the COPS packet. - * - * XXX - if reassembly isn't enabled. the subdissector - * will throw a BoundsError exception, rather than a - * ReportedBoundsError exception. We really want - * a tvbuff where the length is "length", the reported - * length is "plen + 2", and the "if the snapshot length - * were infinite" length were the minimum of the - * reported length of the tvbuff handed to us and "plen+2", - * with a new type of exception thrown if the offset is - * within the reported length but beyond that third length, - * with that exception getting the "Unreassembled Packet" - * error. - */ - length = length_remaining; - if ((guint32)length > msg_len) - length = msg_len; - next_tvb = tvb_new_subset(tvb, offset, length, msg_len); - - /* - * Dissect the COPS packet. - * - * Catch the ReportedBoundsError exception; if this - * particular message happens to get a ReportedBoundsError - * exception, that doesn't mean that we should stop - * dissecting COPS messages within this frame or chunk - * of reassembled data. - * - * If it gets a BoundsError, we can stop, as there's nothing - * more to see, so we just re-throw it. - */ - TRY { - dissect_cops_pdu(next_tvb, pinfo, tree); - } - CATCH(BoundsError) { - RETHROW; - } - CATCH(ReportedBoundsError) { - show_reported_bounds_error(tvb, pinfo, tree); - } - ENDTRY; + tcp_dissect_pdus(tvb, pinfo, tree, cops_desegment, 8, + get_cops_pdu_len, dissect_cops_pdu); +} - /* - * Skip the COPS packet. - */ - offset += msg_len; - } +static guint +get_cops_pdu_len(tvbuff_t *tvb, int offset) +{ + /* + * Get the length of the COPS message. + */ + return tvb_get_ntohl(tvb, offset + 4); } static void diff --git a/packet-dns.c b/packet-dns.c index f95e0e553c..0ef668a35b 100644 --- a/packet-dns.c +++ b/packet-dns.c @@ -1,7 +1,7 @@ /* packet-dns.c * Routines for DNS packet disassembly * - * $Id: packet-dns.c,v 1.84 2002/03/19 09:18:42 guy Exp $ + * $Id: packet-dns.c,v 1.85 2002/05/05 00:16:32 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -39,7 +39,7 @@ #include "ipproto.h" #include <epan/resolv.h> #include "packet-dns.h" -#include "packet-frame.h" +#include "packet-tcp.h" #include "prefs.h" static int proto_dns = -1; @@ -1753,8 +1753,8 @@ dissect_answer_records(tvbuff_t *tvb, int cur_off, int dns_data_offset, } static void -dissect_dns_common(tvbuff_t *tvb, int msg_len, packet_info *pinfo, - proto_tree *tree, gboolean is_tcp) +dissect_dns_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + gboolean is_tcp) { int offset = is_tcp ? 2 : 0; int dns_data_offset; @@ -1816,7 +1816,7 @@ dissect_dns_common(tvbuff_t *tvb, int msg_len, packet_info *pinfo, if (is_tcp) { /* Put the length indication into the tree. */ - proto_tree_add_uint(dns_tree, hf_dns_length, tvb, offset - 2, 2, msg_len); + proto_tree_add_item(dns_tree, hf_dns_length, tvb, offset - 2, 2, FALSE); } if (flags & F_RESPONSE) @@ -1946,119 +1946,36 @@ dissect_dns_common(tvbuff_t *tvb, int msg_len, packet_info *pinfo, static void dissect_dns_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - dissect_dns_common(tvb, -1, pinfo, tree, FALSE); + dissect_dns_common(tvb, pinfo, tree, FALSE); +} + +static guint +get_dns_pdu_len(tvbuff_t *tvb, int offset) +{ + guint16 plen; + + /* + * Get the length of the DNS packet. + */ + plen = tvb_get_ntohs(tvb, offset); + + /* + * That length doesn't include the length field itself; add that in. + */ + return plen + 2; +} + +static void +dissect_dns_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + dissect_dns_common(tvb, pinfo, tree, TRUE); } static void dissect_dns_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - volatile int offset = 0; - int length_remaining; - guint16 plen; - int length; - tvbuff_t *next_tvb; - - while (tvb_reported_length_remaining(tvb, offset) != 0) { - length_remaining = tvb_length_remaining(tvb, offset); - - /* - * Can we do reassembly? - */ - if (dns_desegment && pinfo->can_desegment) { - /* - * Yes - is the DNS-over-TCP header split across - * segment boundaries? - */ - if (length_remaining < 2) { - /* - * Yes. Tell the TCP dissector where - * the data for this message starts in - * the data it handed us, and how many - * more bytes we need, and return. - */ - pinfo->desegment_offset = offset; - pinfo->desegment_len = 2 - length_remaining; - return; - } - } - - /* - * Get the length of the DNS packet. - */ - plen = tvb_get_ntohs(tvb, offset); - - /* - * Can we do reassembly? - */ - if (dns_desegment && pinfo->can_desegment) { - /* - * Yes - is the DNS packet split across segment - * boundaries? - */ - if (length_remaining < plen + 2) { - /* - * Yes. Tell the TCP dissector where - * the data for this message starts in - * the data it handed us, and how many - * more bytes we need, and return. - */ - pinfo->desegment_offset = offset; - pinfo->desegment_len = - (plen + 2) - length_remaining; - return; - } - } - - /* - * Construct a tvbuff containing the amount of the payload - * we have available. Make its reported length the - * amount of data in the DNS-over-TCP packet. - * - * XXX - if reassembly isn't enabled. the subdissector - * will throw a BoundsError exception, rather than a - * ReportedBoundsError exception. We really want - * a tvbuff where the length is "length", the reported - * length is "plen + 2", and the "if the snapshot length - * were infinite" length is the minimum of the - * reported length of the tvbuff handed to us and "plen+2", - * with a new type of exception thrown if the offset is - * within the reported length but beyond that third length, - * with that exception getting the "Unreassembled Packet" - * error. - */ - length = length_remaining; - if (length > plen + 2) - length = plen + 2; - next_tvb = tvb_new_subset(tvb, offset, length, plen + 2); - - /* - * Dissect the DNS-over-TCP packet. - * - * Catch the ReportedBoundsError exception; if this - * particular message happens to get a ReportedBoundsError - * exception, that doesn't mean that we should stop - * dissecting DNS-over-TCP messages within this frame or - * chunk of reassembled data. - * - * If it gets a BoundsError, we can stop, as there's nothing - * more to see, so we just re-throw it. - */ - TRY { - dissect_dns_common(next_tvb, plen, pinfo, tree, TRUE); - } - CATCH(BoundsError) { - RETHROW; - } - CATCH(ReportedBoundsError) { - show_reported_bounds_error(tvb, pinfo, tree); - } - ENDTRY; - - /* - * Skip the DNS-over-TCP header and the payload. - */ - offset += plen + 2; - } + tcp_dissect_pdus(tvb, pinfo, tree, dns_desegment, 2, get_dns_pdu_len, + dissect_dns_tcp_pdu); } void diff --git a/packet-dsi.c b/packet-dsi.c index e2387cbbd1..4db93e87f5 100644 --- a/packet-dsi.c +++ b/packet-dsi.c @@ -2,7 +2,7 @@ * Routines for dsi packet dissection * Copyright 2001, Randy McEoin <rmceoin@pe.com> * - * $Id: packet-dsi.c,v 1.18 2002/05/03 21:25:43 guy Exp $ + * $Id: packet-dsi.c,v 1.19 2002/05/05 00:16:32 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -43,7 +43,7 @@ #include <epan/packet.h> #include "prefs.h" -#include "packet-frame.h" +#include "packet-tcp.h" #include "packet-afp.h" @@ -402,120 +402,28 @@ dissect_dsi_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } -static void -dissect_dsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static guint +get_dsi_pdu_len(tvbuff_t *tvb, int offset) { - volatile int offset = 0; - int length_remaining; guint32 plen; - int length; - tvbuff_t *next_tvb; - - while (tvb_reported_length_remaining(tvb, offset) != 0) { - length_remaining = tvb_length_remaining(tvb, offset); - - /* - * Can we do reassembly? - */ - if (dsi_desegment && pinfo->can_desegment) { - /* - * Yes - is the DSI header split across segment - * boundaries? - */ - if (length_remaining < 12) { - /* - * Yes. Tell the TCP dissector where - * the data for this message starts in - * the data it handed us, and how many - * more bytes we need, and return. - */ - pinfo->desegment_offset = offset; - pinfo->desegment_len = 12 - length_remaining; - return; - } - } - /* - * Get the length of the DSI packet. - */ - plen = tvb_get_ntohl(tvb, offset+8); - - /* - * Can we do reassembly? - */ - if (dsi_desegment && pinfo->can_desegment) { - /* - * Yes - is the DSI packet split across segment - * boundaries? - */ - if ((guint32)length_remaining < plen + 16) { - /* - * Yes. Tell the TCP dissector where - * the data for this message starts in - * the data it handed us, and how many - * more bytes we need, and return. - */ - pinfo->desegment_offset = offset; - pinfo->desegment_len = - (plen + 16) - length_remaining; - return; - } - } + /* + * Get the length of the DSI packet. + */ + plen = tvb_get_ntohl(tvb, offset+8); - /* - * Construct a tvbuff containing the amount of the payload - * we have available. Make its reported length the - * amount of data in the DSI packet. - * - * XXX - if reassembly isn't enabled. the subdissector - * will throw a BoundsError exception, rather than a - * ReportedBoundsError exception. We really want - * a tvbuff where the length is "length", the reported - * length is "plen + 16", and the "if the snapshot length - * were infinite" length is the minimum of the - * reported length of the tvbuff handed to us and "plen+16", - * with a new type of exception thrown if the offset is - * within the reported length but beyond that third length, - * with that exception getting the "Unreassembled Packet" - * error. - */ - if (plen > 0x7fffffff) { - show_reported_bounds_error(tvb, pinfo, tree); - return; - } - length = length_remaining; - if ((guint32)length > plen + 16) - length = plen + 16; - next_tvb = tvb_new_subset(tvb, offset, length, plen + 16); - - /* - * Dissect the DSI packet. - * - * Catch the ReportedBoundsError exception; if this - * particular message happens to get a ReportedBoundsError - * exception, that doesn't mean that we should stop - * dissecting DSI messages within this frame or chunk - * of reassembled data. - * - * If it gets a BoundsError, we can stop, as there's nothing - * more to see, so we just re-throw it. - */ - TRY { - dissect_dsi_packet(next_tvb, pinfo, tree); - } - CATCH(BoundsError) { - RETHROW; - } - CATCH(ReportedBoundsError) { - show_reported_bounds_error(tvb, pinfo, tree); - } - ENDTRY; + /* + * That length doesn't include the length of the header itself; + * add that in. + */ + return plen + 16; +} - /* - * Skip the DSI header and the payload. - */ - offset += plen + 16; - } +static void +dissect_dsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + tcp_dissect_pdus(tvb, pinfo, tree, dsi_desegment, 12, + get_dsi_pdu_len, dissect_dsi_packet); } void diff --git a/packet-skinny.c b/packet-skinny.c index 7933827819..663bd5fb9e 100644 --- a/packet-skinny.c +++ b/packet-skinny.c @@ -11,7 +11,7 @@ * This file is based on packet-aim.c, which is * Copyright 2000, Ralf Hoelzer <ralf@well.com> * - * $Id: packet-skinny.c,v 1.17 2002/03/27 20:29:05 guy Exp $ + * $Id: packet-skinny.c,v 1.18 2002/05/05 00:16:32 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -45,7 +45,7 @@ #include <epan/packet.h> #include "prefs.h" -#include "packet-frame.h" +#include "packet-tcp.h" #define TCP_PORT_SKINNY 2000 @@ -828,6 +828,23 @@ static gboolean skinny_desegment = TRUE; static dissector_handle_t data_handle; +/* Get the length of a single SCCP PDU */ +static guint get_skinny_pdu_len(tvbuff_t *tvb, int offset) +{ + guint32 hdr_data_length; + + /* + * Get the length of the SCCP packet. + */ + hdr_data_length = tvb_get_letohl(tvb, offset); + + /* + * That length doesn't include the length of the header itself; + * add that in. + */ + return hdr_data_length + 8; +} + /* Dissect a single SCCP PDU */ static void dissect_skinny_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { @@ -1446,12 +1463,6 @@ static void dissect_skinny(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* The general structure of a packet: {IP-Header|TCP-Header|n*SKINNY} * SKINNY-Packet: {Header(Size, Reserved)|Data(MessageID, Message-Data)} */ - - volatile int offset = 0; - int length_remaining; - int length; - tvbuff_t *next_tvb; - /* Header fields */ volatile guint32 hdr_data_length; guint32 hdr_reserved; @@ -1480,100 +1491,8 @@ static void dissect_skinny(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_INFO, "Skinny Client Control Protocol"); } - while (tvb_reported_length_remaining(tvb, offset) != 0) { - length_remaining = tvb_length_remaining(tvb, offset); - - /* - * Can we do reassembly? - */ - if (skinny_desegment && pinfo->can_desegment) { - /* - * Yes - is the length field in the SCCP header split across - * segment boundaries? - */ - if (length_remaining < 4) { - /* - * Yes. Tell the TCP dissector where the data for this message - * starts in the data it handed us, and how many more bytes we - * need, and return. - */ - pinfo->desegment_offset = offset; - pinfo->desegment_len = 4 - length_remaining; - return; - } - } - - /* - * Get the length of the SCCP packet. - */ - hdr_data_length = tvb_get_letohl(tvb, offset); - - /* - * Can we do reassembly? - */ - if (skinny_desegment && pinfo->can_desegment) { - /* - * Yes - is the SCCP packet split across segment boundaries? - */ - if ((guint32)length_remaining < hdr_data_length + 8) { - /* - * Yes. Tell the TCP dissector where the data for this message - * starts in the data it handed us, and how many more bytes we - * need, and return. - */ - pinfo->desegment_offset = offset; - pinfo->desegment_len = (hdr_data_length + 8) - length_remaining; - return; - } - } - - /* - * Construct a tvbuff containing the amount of the payload we have - * available. Make its reported length the amount of data in the - * SCCP packet. - * - * XXX - if reassembly isn't enabled. the subdissector will throw a - * BoundsError exception, rather than a ReportedBoundsError exception. - * We really want a tvbuff where the length is "length", the reported - * length is "hdr_data_length + 8", and the "if the snapshot length - * were infinite" length is the minimum of the reported length of - * the tvbuff handed to us and "hdr_data_length + 8", with a new type - * of exception thrown if the offset is within the reported length but - * beyond that third length, with that exception getting the - * "Unreassembled Packet" error. - */ - length = length_remaining; - if ((guint32)length > hdr_data_length + 8) - length = hdr_data_length + 8; - next_tvb = tvb_new_subset(tvb, offset, length, hdr_data_length + 8); - - /* - * Dissect the SCCP packet. - * - * Catch the ReportedBoundsError exception; if this particular message - * happens to get a ReportedBoundsError exception, that doesn't mean - * that we should stop dissecting SCCP messages within this frame or - * chunk of reassembled data. - * - * If it gets a BoundsError, we can stop, as there's nothing more to - * see, so we just re-throw it. - */ - TRY { - dissect_skinny_pdu(next_tvb, pinfo, tree); - } - CATCH(BoundsError) { - RETHROW; - } - CATCH(ReportedBoundsError) { - show_reported_bounds_error(tvb, pinfo, tree); - } - ENDTRY; - - /* - * Skip the SCCP header and the payload. - */ - offset += hdr_data_length + 8; - } + tcp_dissect_pdus(tvb, pinfo, tree, skinny_desegment, 4, + get_skinny_pdu_len, dissect_skinny_pdu); } /* Register the protocol with Ethereal */ diff --git a/packet-tcp.c b/packet-tcp.c index f3919a74c1..0bfa45eb65 100644 --- a/packet-tcp.c +++ b/packet-tcp.c @@ -1,7 +1,7 @@ /* packet-tcp.c * Routines for TCP packet disassembly * - * $Id: packet-tcp.c,v 1.139 2002/05/04 02:54:48 sharpe Exp $ + * $Id: packet-tcp.c,v 1.140 2002/05/05 00:16:32 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -49,6 +49,7 @@ #include "prefs.h" #include "packet-tcp.h" #include "packet-ip.h" +#include "packet-frame.h" #include <epan/conversation.h> #include <epan/strutil.h> #include "reassemble.h" @@ -643,8 +644,142 @@ desegment_tcp(tvbuff_t *tvb, packet_info *pinfo, int offset, pinfo->desegment_len = 0; } +/* + * 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. + */ +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 *)) +{ + volatile int offset = 0; + int length_remaining; + guint plen; + int length; + tvbuff_t *next_tvb; + + while (tvb_reported_length_remaining(tvb, offset) != 0) { + length_remaining = tvb_length_remaining(tvb, offset); + if (length_remaining == -1) + THROW(BoundsError); + + /* + * Can we do reassembly? + */ + if (proto_desegment && pinfo->can_desegment) { + /* + * Yes - is the fixed-length part of the PDU split across segment + * boundaries? + */ + if (length_remaining < fixed_len) { + /* + * Yes. Tell the TCP dissector where the data for this message + * starts in the data it handed us, and how many more bytes we + * need, and return. + */ + pinfo->desegment_offset = offset; + pinfo->desegment_len = fixed_len - length_remaining; + return; + } + } + /* + * Get the length of the PDU. + */ + plen = (*get_pdu_len)(tvb, offset); + /* + * Can we do reassembly? + */ + if (proto_desegment && pinfo->can_desegment) { + /* + * Yes - is the PDU split across segment boundaries? + */ + if ((guint)length_remaining < plen) { + /* + * Yes. Tell the TCP dissector where the data for this message + * starts in the data it handed us, and how many more bytes we + * need, and return. + */ + pinfo->desegment_offset = offset; + pinfo->desegment_len = plen - length_remaining; + return; + } + } + + /* + * Construct a tvbuff containing the amount of the payload we have + * available. Make its reported length the amount of data in the PDU. + * + * XXX - if reassembly isn't enabled. the subdissector will throw a + * BoundsError exception, rather than a ReportedBoundsError exception. + * We really want a tvbuff where the length is "length", the reported + * length is "plen", and the "if the snapshot length were infinite" + * length is the minimum of the reported length of the tvbuff handed + * to us and "plen", with a new type of exception thrown if the offset + * is within the reported length but beyond that third length, with + * that exception getting the "Unreassembled Packet" error. + */ + if (plen < (guint)fixed_len) { + /* + * The PDU length from the fixed-length portion probably didn't + * include the fixed-length portion's length, and was probably so + * large that the total length overflowed. + * + * Report this as an error. + */ + show_reported_bounds_error(tvb, pinfo, tree); + return; + } + length = length_remaining; + if ((guint)length > plen) + length = plen; + next_tvb = tvb_new_subset(tvb, offset, length, plen); + + /* + * Dissect the PDU. + * + * Catch the ReportedBoundsError exception; if this particular message + * happens to get a ReportedBoundsError exception, that doesn't mean + * that we should stop dissecting PDUs within this frame or chunk of + * reassembled data. + * + * If it gets a BoundsError, we can stop, as there's nothing more to + * see, so we just re-throw it. + */ + TRY { + (*dissect_pdu)(next_tvb, pinfo, tree); + } + CATCH(BoundsError) { + RETHROW; + } + CATCH(ReportedBoundsError) { + show_reported_bounds_error(tvb, pinfo, tree); + } + ENDTRY; + + /* + * Step to the next PDU. + */ + offset += plen; + } +} static void tcp_info_append_uint(packet_info *pinfo, const char *abbrev, guint32 val) 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 <gerald@ethereal.com> @@ -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); diff --git a/plugins/Makefile.am b/plugins/Makefile.am index f4c28806a0..83338ea000 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -1,7 +1,7 @@ # Makefile.am # Automake file for Ethereal # -# $Id: Makefile.am,v 1.8 2001/10/31 10:40:54 guy Exp $ +# $Id: Makefile.am,v 1.9 2002/05/05 00:16:36 guy Exp $ # # Ethereal - Network traffic analyzer # By Gerald Combs <gerald@zing.org> @@ -29,6 +29,7 @@ plugindir = @PLUGIN_DIR@ EXTRA_DIST = \ plugin_api.c \ plugin_api.h \ + plugin_api_decls.h \ plugin_api_defs.h \ plugin_table.h \ Makefile.nmake diff --git a/plugins/gryphon/packet-gryphon.c b/plugins/gryphon/packet-gryphon.c index d7e607d476..fddad1487e 100644 --- a/plugins/gryphon/packet-gryphon.c +++ b/plugins/gryphon/packet-gryphon.c @@ -3,7 +3,7 @@ * By Steve Limkemann <stevelim@dgtech.com> * Copyright 1998 Steve Limkemann * - * $Id: packet-gryphon.c,v 1.32 2002/05/01 06:56:16 guy Exp $ + * $Id: packet-gryphon.c,v 1.33 2002/05/05 00:16:38 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -46,7 +46,7 @@ #endif #include <epan/packet.h> #include "packet-gryphon.h" -#include "packet-frame.h" +#include "packet-tcp.h" #include "prefs.h" #include "plugins/plugin_api_defs.h" @@ -154,115 +154,42 @@ static char *frame_type[] = { "Text string" }; -static void -dissect_gryphon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +/* + * Length of the frame header. + */ +#define FRAME_HEADER_LEN 8 + +static guint +get_gryphon_pdu_len(tvbuff_t *tvb, int offset) { - volatile int offset = 0; - int length_remaining; guint16 plen; int padded_len; - int length; - tvbuff_t *next_tvb; - - offset = 0; - while (tvb_reported_length_remaining(tvb, offset) != 0) { - length_remaining = tvb_length_remaining(tvb, offset); - - /* - * Can we do reassembly? - */ - if (gryphon_desegment && pinfo->can_desegment) { - /* - * Yes - is the Gryphon header split across segment boundaries? - */ - if (length_remaining < 8) { - /* - * Yes. Tell the TCP dissector where the data for - * this message starts in the data it handed us, - * and how many more bytes we need, and return. - */ - pinfo->desegment_offset = offset; - pinfo->desegment_len = 8 - length_remaining; - return; - } - } - - /* - * Get the length of the Gryphon packet, and then - * get the length as padded to a 4-byte boundary. - */ - plen = tvb_get_ntohs(tvb, offset + 4); - padded_len = plen + 3 - (plen + 3) % 4; - /* - * Can we do reassembly? - */ - if (gryphon_desegment && pinfo->can_desegment) { - /* - * Yes - is the Gryphon packet split across segment boundaries? - */ - if (length_remaining < padded_len + 8) { - /* - * Yes. Tell the TCP dissector where the data for - * this message starts in the data it handed us, - * and how many more bytes we need, and return. - */ - pinfo->desegment_offset = offset; - pinfo->desegment_len = (padded_len + 8) - length_remaining; - return; - } - } - - /* - * Construct a tvbuff containing the amount of the payload - * we have available. Make its reported length the - * amount of data in the Gryphon packet. - * - * XXX - if reassembly isn't enabled. the subdissector - * will throw a BoundsError exception, rather than a - * ReportedBoundsError exception. We really want - * a tvbuff where the length is "length", the reported - * length is "plen + 8", and the "if the snapshot length - * were infinite" length is the minimum of the - * reported length of the tvbuff handed to us and "plen+8", - * with a new type of exception thrown if the offset is - * within the reported length but beyond that third length, - * with that exception getting the "Unreassembled Packet" - * error. - */ - length = length_remaining; - if (length > plen + 8) - length = plen + 8; - next_tvb = tvb_new_subset(tvb, offset, length, plen + 8); + /* + * Get the length of the Gryphon packet, and then get the length as + * padded to a 4-byte boundary. + */ + plen = tvb_get_ntohs(tvb, offset + 4); + padded_len = plen + 3 - (plen + 3) % 4; + + /* + * That length doesn't include the fixed-length part of the header; + * add that in. + */ + return padded_len + FRAME_HEADER_LEN; +} - /* - * Dissect the Gryphon packet. - * - * Catch the ReportedBoundsError exception; if this - * particular message happens to get a ReportedBoundsError - * exception, that doesn't mean that we should stop - * dissecting Gryphon messages within this frame or - * chunk of reassembled data. - * - * If it gets a BoundsError, we can stop, as there's nothing - * more to see, so we just re-throw it. - */ - TRY { - dissect_gryphon_message(next_tvb, pinfo, tree, FALSE); - } - CATCH(BoundsError) { - RETHROW; - } - CATCH(ReportedBoundsError) { - show_reported_bounds_error(tvb, pinfo, tree); - } - ENDTRY; +static void +dissect_gryphon_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + dissect_gryphon_message(tvb, pinfo, tree, FALSE); +} - /* - * Skip the Gryphon header and the payload. - */ - offset += padded_len + 8; - } +static void +dissect_gryphon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + tcp_dissect_pdus(tvb, pinfo, tree, gryphon_desegment, FRAME_HEADER_LEN, + get_gryphon_pdu_len, dissect_gryphon_pdu); } static const value_string src_dest[] = { @@ -313,6 +240,12 @@ dissect_gryphon_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, frmtyp = flags & ~RESPONSE_FLAGS; if (!is_msgresp_add) { + /* + * This tvbuff includes padding to make its length a multiple + * of 4 bytes; set it to the actual length. + */ + set_actual_length(tvb, msglen + FRAME_HEADER_LEN); + if (check_col(pinfo->cinfo, COL_INFO)) { /* * Indicate what kind of message this is. diff --git a/plugins/plugin_api.c b/plugins/plugin_api.c index a76207d05c..2c6f1b8a65 100644 --- a/plugins/plugin_api.c +++ b/plugins/plugin_api.c @@ -1,7 +1,7 @@ /* plugin_api.c * Routines for Ethereal plugins. * - * $Id: plugin_api.c,v 1.37 2002/02/22 08:56:48 guy Exp $ + * $Id: plugin_api.c,v 1.38 2002/05/05 00:16:36 guy Exp $ * * Ethereal - Network traffic analyzer * Copyright 2000 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -140,8 +140,6 @@ plugin_address_table_init(plugin_address_table_t *pat) p_prefs_register_enum_preference = pat->p_prefs_register_enum_preference; p_prefs_register_string_preference = pat->p_prefs_register_string_preference; - /* GIOP Begin */ - p_register_giop_user = pat->p_register_giop_user; p_is_big_endian = pat->p_is_big_endian; p_get_CDR_encap_info = pat->p_get_CDR_encap_info; @@ -166,12 +164,12 @@ plugin_address_table_init(plugin_address_table_t *pat) p_get_CDR_wchar = pat->p_get_CDR_wchar; p_get_CDR_wstring = pat->p_get_CDR_wstring; - /* GIOP End */ - - /* TPKT Begin */ - p_is_tpkt = pat->p_is_tpkt; p_dissect_tpkt_encap = pat->p_dissect_tpkt_encap; - /* TPKT End */ + p_set_actual_length = pat->p_set_actual_length; + p_tcp_dissect_pdus = pat->p_tcp_dissect_pdus; + p_decode_boolean_bitfield = pat->p_decode_boolean_bitfield; + p_decode_numeric_bitfield = pat->p_decode_numeric_bitfield; + p_decode_enumerated_bitfield = pat->p_decode_enumerated_bitfield; } diff --git a/plugins/plugin_api.h b/plugins/plugin_api.h index b23e42438f..f76ae2ec71 100644 --- a/plugins/plugin_api.h +++ b/plugins/plugin_api.h @@ -1,7 +1,7 @@ /* plugin_api.h * Routines for Ethereal plugins. * - * $Id: plugin_api.h,v 1.38 2002/02/22 08:56:48 guy Exp $ + * $Id: plugin_api.h,v 1.39 2002/05/05 00:16:36 guy Exp $ * * Ethereal - Network traffic analyzer * Copyright 2000 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -168,8 +168,6 @@ #define prefs_register_enum_preference (*p_prefs_register_enum_preference) #define prefs_register_string_preference (*p_prefs_register_string_preference) -/* GIOP entries Begin */ - #define register_giop_user (*p_register_giop_user) #define is_big_endian (*p_is_big_endian) #define get_CDR_encap_info (*p_get_CDR_encap_info) @@ -194,14 +192,17 @@ #define get_CDR_wchar (*p_get_CDR_wchar) #define get_CDR_wstring (*p_get_CDR_wstring) -/* GIOP entries End */ - -/* TPKT entries Begin */ - #define is_tpkt (*p_is_tpkt) #define dissect_tpkt_encap (*p_dissect_tpkt_encap) -/* TPKT entries End */ +#define set_actual_length (*p_set_actual_length) + +#define tcp_dissect_pdus (*p_tcp_dissect_pdus) + +#define decode_boolean_bitfield (*p_decode_boolean_bitfield) +#define decode_numeric_bitfield (*p_decode_numeric_bitfield) +#define decode_enumerated_bitfield (*p_decode_enumerated_bitfield) + #endif #include <epan/packet.h> @@ -209,6 +210,7 @@ #include "prefs.h" #include "packet-giop.h" #include "packet-tpkt.h" +#include "packet-tcp.h" #include "plugin_table.h" diff --git a/plugins/plugin_api_decls.h b/plugins/plugin_api_decls.h new file mode 100644 index 0000000000..b25456d7e0 --- /dev/null +++ b/plugins/plugin_api_decls.h @@ -0,0 +1,212 @@ +/* plugin_api_decls.h + * Declarations of a list of "p_" names; included in various places + * to declare them as variables or as function members. + * + * $Id: plugin_api_decls.h,v 1.1 2002/05/05 00:16:36 guy Exp $ + * + * Ethereal - Network traffic analyzer + * Copyright 2000 by Gilbert Ramirez <gram@alumni.rice.edu> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* + * If you're adding a new routine, please add it to the *end* of this + * table, so that the ABI remains backwards-compatible if the only change + * is that new functions are added; don't bother trying to keep related + * routines together. (This list is included in "plugin_table.h" to + * declare the members of the function address table, so the order *does* + * matter.) + * + * If a routine is removed or a calling sequence changed, the ABI isn't + * going to be backwards-compatible no matter what you do; if that's + * done, you may re-shuffle the routines to put related routines + * together if you want. + */ + +addr_check_col p_check_col; +addr_col_clear p_col_clear; +addr_col_add_fstr p_col_add_fstr; +addr_col_append_fstr p_col_append_fstr; +addr_col_prepend_fstr p_col_prepend_fstr; +addr_col_add_str p_col_add_str; +addr_col_append_str p_col_append_str; +addr_col_set_str p_col_set_str; + +addr_register_init_routine p_register_init_routine; +addr_register_postseq_cleanup_routine p_register_postseq_cleanup_routine; + +addr_match_strval p_match_strval; +addr_val_to_str p_val_to_str; + +addr_conversation_new p_conversation_new; +addr_find_conversation p_find_conversation; +addr_conversation_set_dissector p_conversation_set_dissector; + +addr_proto_register_protocol p_proto_register_protocol; +addr_proto_register_field_array p_proto_register_field_array; +addr_proto_register_subtree_array p_proto_register_subtree_array; + +addr_dissector_add p_dissector_add; +addr_dissector_delete p_dissector_delete; +addr_dissector_add_handle p_dissector_add_handle; + +addr_heur_dissector_add p_heur_dissector_add; + +addr_register_dissector p_register_dissector; +addr_find_dissector p_find_dissector; +addr_create_dissector_handle p_create_dissector_handle; +addr_call_dissector p_call_dissector; + +addr_proto_is_protocol_enabled p_proto_is_protocol_enabled; + +addr_proto_item_get_len p_proto_item_get_len; +addr_proto_item_set_len p_proto_item_set_len; +addr_proto_item_set_text p_proto_item_set_text; +addr_proto_item_append_text p_proto_item_append_text; +addr_proto_item_add_subtree p_proto_item_add_subtree; +addr_proto_tree_add_item p_proto_tree_add_item; +addr_proto_tree_add_item_hidden p_proto_tree_add_item_hidden; +addr_proto_tree_add_protocol_format p_proto_tree_add_protocol_format; + +addr_proto_tree_add_bytes p_proto_tree_add_bytes; +addr_proto_tree_add_bytes_hidden p_proto_tree_add_bytes_hidden; +addr_proto_tree_add_bytes_format p_proto_tree_add_bytes_format; + +addr_proto_tree_add_time p_proto_tree_add_time; +addr_proto_tree_add_time_hidden p_proto_tree_add_time_hidden; +addr_proto_tree_add_time_format p_proto_tree_add_time_format; + +addr_proto_tree_add_ipxnet p_proto_tree_add_ipxnet; +addr_proto_tree_add_ipxnet_hidden p_proto_tree_add_ipxnet_hidden; +addr_proto_tree_add_ipxnet_format p_proto_tree_add_ipxnet_format; + +addr_proto_tree_add_ipv4 p_proto_tree_add_ipv4; +addr_proto_tree_add_ipv4_hidden p_proto_tree_add_ipv4_hidden; +addr_proto_tree_add_ipv4_format p_proto_tree_add_ipv4_format; + +addr_proto_tree_add_ipv6 p_proto_tree_add_ipv6; +addr_proto_tree_add_ipv6_hidden p_proto_tree_add_ipv6_hidden; +addr_proto_tree_add_ipv6_format p_proto_tree_add_ipv6_format; + +addr_proto_tree_add_ether p_proto_tree_add_ether; +addr_proto_tree_add_ether_hidden p_proto_tree_add_ether_hidden; +addr_proto_tree_add_ether_format p_proto_tree_add_ether_format; + +addr_proto_tree_add_string p_proto_tree_add_string; +addr_proto_tree_add_string_hidden p_proto_tree_add_string_hidden; +addr_proto_tree_add_string_format p_proto_tree_add_string_format; + +addr_proto_tree_add_boolean p_proto_tree_add_boolean; +addr_proto_tree_add_boolean_hidden p_proto_tree_add_boolean_hidden; +addr_proto_tree_add_boolean_format p_proto_tree_add_boolean_format; + +addr_proto_tree_add_double p_proto_tree_add_double; +addr_proto_tree_add_double_hidden p_proto_tree_add_double_hidden; +addr_proto_tree_add_double_format p_proto_tree_add_double_format; + +addr_proto_tree_add_uint p_proto_tree_add_uint; +addr_proto_tree_add_uint_hidden p_proto_tree_add_uint_hidden; +addr_proto_tree_add_uint_format p_proto_tree_add_uint_format; + +addr_proto_tree_add_int p_proto_tree_add_int; +addr_proto_tree_add_int_hidden p_proto_tree_add_int_hidden; +addr_proto_tree_add_int_format p_proto_tree_add_int_format; + +addr_proto_tree_add_text p_proto_tree_add_text; + +addr_tvb_new_subset p_tvb_new_subset; + +addr_tvb_set_free_cb p_tvb_set_free_cb; +addr_tvb_set_child_real_data_tvbuff p_tvb_set_child_real_data_tvbuff; +addr_tvb_new_real_data p_tvb_new_real_data; + +addr_tvb_length p_tvb_length; +addr_tvb_length_remaining p_tvb_length_remaining; +addr_tvb_bytes_exist p_tvb_bytes_exist; +addr_tvb_offset_exists p_tvb_offset_exists; +addr_tvb_reported_length p_tvb_reported_length; +addr_tvb_reported_length_remaining p_tvb_reported_length_remaining; + +addr_tvb_get_guint8 p_tvb_get_guint8; + +addr_tvb_get_ntohs p_tvb_get_ntohs; +addr_tvb_get_ntoh24 p_tvb_get_ntoh24; +addr_tvb_get_ntohl p_tvb_get_ntohl; + +addr_tvb_get_letohs p_tvb_get_letohs; +addr_tvb_get_letoh24 p_tvb_get_letoh24; +addr_tvb_get_letohl p_tvb_get_letohl; + +addr_tvb_memcpy p_tvb_memcpy; +addr_tvb_memdup p_tvb_memdup; + +addr_tvb_get_ptr p_tvb_get_ptr; + +addr_tvb_find_guint8 p_tvb_find_guint8; +addr_tvb_pbrk_guint8 p_tvb_pbrk_guint8; + +addr_tvb_strnlen p_tvb_strnlen; + +addr_tvb_format_text p_tvb_format_text; + +addr_tvb_get_nstringz p_tvb_get_nstringz; +addr_tvb_get_nstringz0 p_tvb_get_nstringz0; + +addr_tvb_find_line_end p_tvb_find_line_end; +addr_tvb_find_line_end_unquoted p_tvb_find_line_end_unquoted; + +addr_tvb_strneql p_tvb_strneql; +addr_tvb_strncaseeql p_tvb_strncaseeql; + +addr_tvb_bytes_to_str p_tvb_bytes_to_str; + +addr_prefs_register_protocol p_prefs_register_protocol; +addr_prefs_register_uint_preference p_prefs_register_uint_preference; +addr_prefs_register_bool_preference p_prefs_register_bool_preference; +addr_prefs_register_enum_preference p_prefs_register_enum_preference; +addr_prefs_register_string_preference p_prefs_register_string_preference; + +addr_register_giop_user p_register_giop_user; +addr_is_big_endian p_is_big_endian; +addr_get_CDR_encap_info p_get_CDR_encap_info; +addr_get_CDR_any p_get_CDR_any; +addr_get_CDR_boolean p_get_CDR_boolean; +addr_get_CDR_char p_get_CDR_char; +addr_get_CDR_double p_get_CDR_double; +addr_get_CDR_enum p_get_CDR_enum; +addr_get_CDR_fixed p_get_CDR_fixed; +addr_get_CDR_float p_get_CDR_float; +addr_get_CDR_interface p_get_CDR_interface; +addr_get_CDR_long p_get_CDR_long; +addr_get_CDR_object p_get_CDR_object; +addr_get_CDR_octet p_get_CDR_octet; +addr_get_CDR_octet_seq p_get_CDR_octet_seq; +addr_get_CDR_short p_get_CDR_short; +addr_get_CDR_string p_get_CDR_string; +addr_get_CDR_typeCode p_get_CDR_typeCode; +addr_get_CDR_ulong p_get_CDR_ulong; +addr_get_CDR_ushort p_get_CDR_ushort; +addr_get_CDR_wchar p_get_CDR_wchar; +addr_get_CDR_wstring p_get_CDR_wstring; + +addr_is_tpkt p_is_tpkt; +addr_dissect_tpkt_encap p_dissect_tpkt_encap; + +addr_set_actual_length p_set_actual_length; +addr_tcp_dissect_pdus p_tcp_dissect_pdus; +addr_decode_boolean_bitfield p_decode_boolean_bitfield; +addr_decode_numeric_bitfield p_decode_numeric_bitfield; +addr_decode_enumerated_bitfield p_decode_enumerated_bitfield; diff --git a/plugins/plugin_api_defs.h b/plugins/plugin_api_defs.h index 93fe80f598..24153f6c11 100644 --- a/plugins/plugin_api_defs.h +++ b/plugins/plugin_api_defs.h @@ -1,7 +1,7 @@ /* plugin_api_defs.h * Define the variables that hold pointers to plugin API functions * - * $Id: plugin_api_defs.h,v 1.13 2002/02/22 08:56:48 guy Exp $ + * $Id: plugin_api_defs.h,v 1.14 2002/05/05 00:16:36 guy Exp $ * * Ethereal - Network traffic analyzer * Copyright 2000 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -26,174 +26,7 @@ #ifdef PLUGINS_NEED_ADDRESS_TABLE -addr_check_col p_check_col; -addr_col_clear p_col_clear; -addr_col_add_fstr p_col_add_fstr; -addr_col_append_fstr p_col_append_fstr; -addr_col_prepend_fstr p_col_prepend_fstr; -addr_col_add_str p_col_add_str; -addr_col_append_str p_col_append_str; -addr_col_set_str p_col_set_str; - -addr_register_init_routine p_register_init_routine; -addr_register_postseq_cleanup_routine p_register_postseq_cleanup_routine; - -addr_match_strval p_match_strval; -addr_val_to_str p_val_to_str; - -addr_conversation_new p_conversation_new; -addr_find_conversation p_find_conversation; -addr_conversation_set_dissector p_conversation_set_dissector; - -addr_proto_register_protocol p_proto_register_protocol; -addr_proto_register_field_array p_proto_register_field_array; -addr_proto_register_subtree_array p_proto_register_subtree_array; - -addr_dissector_add p_dissector_add; -addr_dissector_delete p_dissector_delete; -addr_dissector_add_handle p_dissector_add_handle; - -addr_heur_dissector_add p_heur_dissector_add; - -addr_register_dissector p_register_dissector; -addr_find_dissector p_find_dissector; -addr_create_dissector_handle p_create_dissector_handle; -addr_call_dissector p_call_dissector; - -addr_proto_is_protocol_enabled p_proto_is_protocol_enabled; - -addr_proto_item_get_len p_proto_item_get_len; -addr_proto_item_set_len p_proto_item_set_len; -addr_proto_item_set_text p_proto_item_set_text; -addr_proto_item_append_text p_proto_item_append_text; -addr_proto_item_add_subtree p_proto_item_add_subtree; -addr_proto_tree_add_item p_proto_tree_add_item; -addr_proto_tree_add_item_hidden p_proto_tree_add_item_hidden; -addr_proto_tree_add_protocol_format p_proto_tree_add_protocol_format; - -addr_proto_tree_add_bytes p_proto_tree_add_bytes; -addr_proto_tree_add_bytes_hidden p_proto_tree_add_bytes_hidden; -addr_proto_tree_add_bytes_format p_proto_tree_add_bytes_format; - -addr_proto_tree_add_time p_proto_tree_add_time; -addr_proto_tree_add_time_hidden p_proto_tree_add_time_hidden; -addr_proto_tree_add_time_format p_proto_tree_add_time_format; - -addr_proto_tree_add_ipxnet p_proto_tree_add_ipxnet; -addr_proto_tree_add_ipxnet_hidden p_proto_tree_add_ipxnet_hidden; -addr_proto_tree_add_ipxnet_format p_proto_tree_add_ipxnet_format; - -addr_proto_tree_add_ipv4 p_proto_tree_add_ipv4; -addr_proto_tree_add_ipv4_hidden p_proto_tree_add_ipv4_hidden; -addr_proto_tree_add_ipv4_format p_proto_tree_add_ipv4_format; - -addr_proto_tree_add_ipv6 p_proto_tree_add_ipv6; -addr_proto_tree_add_ipv6_hidden p_proto_tree_add_ipv6_hidden; -addr_proto_tree_add_ipv6_format p_proto_tree_add_ipv6_format; - -addr_proto_tree_add_ether p_proto_tree_add_ether; -addr_proto_tree_add_ether_hidden p_proto_tree_add_ether_hidden; -addr_proto_tree_add_ether_format p_proto_tree_add_ether_format; - -addr_proto_tree_add_string p_proto_tree_add_string; -addr_proto_tree_add_string_hidden p_proto_tree_add_string_hidden; -addr_proto_tree_add_string_format p_proto_tree_add_string_format; - -addr_proto_tree_add_boolean p_proto_tree_add_boolean; -addr_proto_tree_add_boolean_hidden p_proto_tree_add_boolean_hidden; -addr_proto_tree_add_boolean_format p_proto_tree_add_boolean_format; - -addr_proto_tree_add_double p_proto_tree_add_double; -addr_proto_tree_add_double_hidden p_proto_tree_add_double_hidden; -addr_proto_tree_add_double_format p_proto_tree_add_double_format; - -addr_proto_tree_add_uint p_proto_tree_add_uint; -addr_proto_tree_add_uint_hidden p_proto_tree_add_uint_hidden; -addr_proto_tree_add_uint_format p_proto_tree_add_uint_format; - -addr_proto_tree_add_int p_proto_tree_add_int; -addr_proto_tree_add_int_hidden p_proto_tree_add_int_hidden; -addr_proto_tree_add_int_format p_proto_tree_add_int_format; - -addr_proto_tree_add_text p_proto_tree_add_text; - -addr_tvb_new_subset p_tvb_new_subset; - -addr_tvb_set_free_cb p_tvb_set_free_cb; -addr_tvb_set_child_real_data_tvbuff p_tvb_set_child_real_data_tvbuff; -addr_tvb_new_real_data p_tvb_new_real_data; - -addr_tvb_length p_tvb_length; -addr_tvb_length_remaining p_tvb_length_remaining; -addr_tvb_bytes_exist p_tvb_bytes_exist; -addr_tvb_offset_exists p_tvb_offset_exists; -addr_tvb_reported_length p_tvb_reported_length; -addr_tvb_reported_length_remaining p_tvb_reported_length_remaining; - -addr_tvb_get_guint8 p_tvb_get_guint8; - -addr_tvb_get_ntohs p_tvb_get_ntohs; -addr_tvb_get_ntoh24 p_tvb_get_ntoh24; -addr_tvb_get_ntohl p_tvb_get_ntohl; - -addr_tvb_get_letohs p_tvb_get_letohs; -addr_tvb_get_letoh24 p_tvb_get_letoh24; -addr_tvb_get_letohl p_tvb_get_letohl; - -addr_tvb_memcpy p_tvb_memcpy; -addr_tvb_memdup p_tvb_memdup; - -addr_tvb_get_ptr p_tvb_get_ptr; - -addr_tvb_find_guint8 p_tvb_find_guint8; -addr_tvb_pbrk_guint8 p_tvb_pbrk_guint8; - -addr_tvb_strnlen p_tvb_strnlen; - -addr_tvb_format_text p_tvb_format_text; - -addr_tvb_get_nstringz p_tvb_get_nstringz; -addr_tvb_get_nstringz0 p_tvb_get_nstringz0; - -addr_tvb_find_line_end p_tvb_find_line_end; -addr_tvb_find_line_end_unquoted p_tvb_find_line_end_unquoted; - -addr_tvb_strneql p_tvb_strneql; -addr_tvb_strncaseeql p_tvb_strncaseeql; - -addr_tvb_bytes_to_str p_tvb_bytes_to_str; - -addr_prefs_register_protocol p_prefs_register_protocol; -addr_prefs_register_uint_preference p_prefs_register_uint_preference; -addr_prefs_register_bool_preference p_prefs_register_bool_preference; -addr_prefs_register_enum_preference p_prefs_register_enum_preference; -addr_prefs_register_string_preference p_prefs_register_string_preference; - -addr_register_giop_user p_register_giop_user; -addr_is_big_endian p_is_big_endian; -addr_get_CDR_encap_info p_get_CDR_encap_info; -addr_get_CDR_any p_get_CDR_any; -addr_get_CDR_boolean p_get_CDR_boolean; -addr_get_CDR_char p_get_CDR_char; -addr_get_CDR_double p_get_CDR_double; -addr_get_CDR_enum p_get_CDR_enum; -addr_get_CDR_fixed p_get_CDR_fixed; -addr_get_CDR_float p_get_CDR_float; -addr_get_CDR_interface p_get_CDR_interface; -addr_get_CDR_long p_get_CDR_long; -addr_get_CDR_object p_get_CDR_object; -addr_get_CDR_octet p_get_CDR_octet; -addr_get_CDR_octet_seq p_get_CDR_octet_seq; -addr_get_CDR_short p_get_CDR_short; -addr_get_CDR_string p_get_CDR_string; -addr_get_CDR_typeCode p_get_CDR_typeCode; -addr_get_CDR_ulong p_get_CDR_ulong; -addr_get_CDR_ushort p_get_CDR_ushort; -addr_get_CDR_wchar p_get_CDR_wchar; -addr_get_CDR_wstring p_get_CDR_wstring; - -addr_is_tpkt p_is_tpkt; -addr_dissect_tpkt_encap p_dissect_tpkt_encap; +#include "plugin_api_decls.h" #endif /* PLUGINS_NEED_ADDRESS_TABLE */ diff --git a/plugins/plugin_table.h b/plugins/plugin_table.h index 89cd06a865..4b401a4b40 100644 --- a/plugins/plugin_table.h +++ b/plugins/plugin_table.h @@ -1,7 +1,7 @@ /* plugin_table.h * Table of exported addresses for Ethereal plugins. * - * $Id: plugin_table.h,v 1.44 2002/04/04 05:16:15 guy Exp $ + * $Id: plugin_table.h,v 1.45 2002/05/05 00:16:36 guy Exp $ * * Ethereal - Network traffic analyzer * Copyright 2000 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -223,173 +223,23 @@ typedef int (*addr_is_tpkt)(tvbuff_t *); typedef void (*addr_dissect_tpkt_encap)(tvbuff_t *, packet_info *, proto_tree *, gboolean, dissector_handle_t); +typedef void (*addr_set_actual_length)(tvbuff_t *, guint); + +typedef void (*addr_tcp_dissect_pdus)(tvbuff_t *, packet_info *, proto_tree *, + gboolean, int, guint (*)(tvbuff_t *, int), + void (*)(tvbuff_t *, packet_info *, proto_tree *)); + +typedef const char *(*addr_decode_boolean_bitfield)(guint32, guint32, int, + const char *, const char *); +typedef const char *(*addr_decode_numeric_bitfield)(guint32, guint32, int, + const char *); +typedef const char *(*addr_decode_enumerated_bitfield)(guint32, guint32, int, + const value_string *, const char *); + typedef struct { - addr_check_col p_check_col; - addr_col_clear p_col_clear; - addr_col_add_fstr p_col_add_fstr; - addr_col_append_fstr p_col_append_fstr; - addr_col_prepend_fstr p_col_prepend_fstr; - addr_col_add_str p_col_add_str; - addr_col_append_str p_col_append_str; - addr_col_set_str p_col_set_str; - - addr_register_init_routine p_register_init_routine; - addr_register_postseq_cleanup_routine p_register_postseq_cleanup_routine; - - addr_match_strval p_match_strval; - addr_val_to_str p_val_to_str; - - addr_conversation_new p_conversation_new; - addr_find_conversation p_find_conversation; - addr_conversation_set_dissector p_conversation_set_dissector; - - addr_proto_register_protocol p_proto_register_protocol; - addr_proto_register_field_array p_proto_register_field_array; - addr_proto_register_subtree_array p_proto_register_subtree_array; - - addr_dissector_add p_dissector_add; - addr_dissector_delete p_dissector_delete; - addr_dissector_add_handle p_dissector_add_handle; - - addr_heur_dissector_add p_heur_dissector_add; - - addr_register_dissector p_register_dissector; - addr_find_dissector p_find_dissector; - addr_create_dissector_handle p_create_dissector_handle; - addr_call_dissector p_call_dissector; - - addr_proto_is_protocol_enabled p_proto_is_protocol_enabled; - - addr_proto_item_get_len p_proto_item_get_len; - addr_proto_item_set_len p_proto_item_set_len; - addr_proto_item_set_text p_proto_item_set_text; - addr_proto_item_append_text p_proto_item_append_text; - addr_proto_item_add_subtree p_proto_item_add_subtree; - addr_proto_tree_add_item p_proto_tree_add_item; - addr_proto_tree_add_item_hidden p_proto_tree_add_item_hidden; - addr_proto_tree_add_protocol_format p_proto_tree_add_protocol_format; - addr_proto_tree_add_bytes p_proto_tree_add_bytes; - addr_proto_tree_add_bytes_hidden p_proto_tree_add_bytes_hidden; - addr_proto_tree_add_bytes_format p_proto_tree_add_bytes_format; - addr_proto_tree_add_time p_proto_tree_add_time; - addr_proto_tree_add_time_hidden p_proto_tree_add_time_hidden; - addr_proto_tree_add_time_format p_proto_tree_add_time_format; - addr_proto_tree_add_ipxnet p_proto_tree_add_ipxnet; - addr_proto_tree_add_ipxnet_hidden p_proto_tree_add_ipxnet_hidden; - addr_proto_tree_add_ipxnet_format p_proto_tree_add_ipxnet_format; - addr_proto_tree_add_ipv4 p_proto_tree_add_ipv4; - addr_proto_tree_add_ipv4_hidden p_proto_tree_add_ipv4_hidden; - addr_proto_tree_add_ipv4_format p_proto_tree_add_ipv4_format; - addr_proto_tree_add_ipv6 p_proto_tree_add_ipv6; - addr_proto_tree_add_ipv6_hidden p_proto_tree_add_ipv6_hidden; - addr_proto_tree_add_ipv6_format p_proto_tree_add_ipv6_format; - addr_proto_tree_add_ether p_proto_tree_add_ether; - addr_proto_tree_add_ether_hidden p_proto_tree_add_ether_hidden; - addr_proto_tree_add_ether_format p_proto_tree_add_ether_format; - addr_proto_tree_add_string p_proto_tree_add_string; - addr_proto_tree_add_string_hidden p_proto_tree_add_string_hidden; - addr_proto_tree_add_string_format p_proto_tree_add_string_format; - addr_proto_tree_add_boolean p_proto_tree_add_boolean; - addr_proto_tree_add_boolean_hidden p_proto_tree_add_boolean_hidden; - addr_proto_tree_add_boolean_format p_proto_tree_add_boolean_format; - addr_proto_tree_add_double p_proto_tree_add_double; - addr_proto_tree_add_double_hidden p_proto_tree_add_double_hidden; - addr_proto_tree_add_double_format p_proto_tree_add_double_format; - addr_proto_tree_add_uint p_proto_tree_add_uint; - addr_proto_tree_add_uint_hidden p_proto_tree_add_uint_hidden; - addr_proto_tree_add_uint_format p_proto_tree_add_uint_format; - addr_proto_tree_add_int p_proto_tree_add_int; - addr_proto_tree_add_int_hidden p_proto_tree_add_int_hidden; - addr_proto_tree_add_int_format p_proto_tree_add_int_format; - addr_proto_tree_add_text p_proto_tree_add_text; - - addr_tvb_new_subset p_tvb_new_subset; - - addr_tvb_set_free_cb p_tvb_set_free_cb; - addr_tvb_set_child_real_data_tvbuff p_tvb_set_child_real_data_tvbuff; - addr_tvb_new_real_data p_tvb_new_real_data; - - addr_tvb_length p_tvb_length; - addr_tvb_length_remaining p_tvb_length_remaining; - addr_tvb_bytes_exist p_tvb_bytes_exist; - addr_tvb_offset_exists p_tvb_offset_exists; - addr_tvb_reported_length p_tvb_reported_length; - addr_tvb_reported_length_remaining p_tvb_reported_length_remaining; - - addr_tvb_get_guint8 p_tvb_get_guint8; - - addr_tvb_get_ntohs p_tvb_get_ntohs; - addr_tvb_get_ntoh24 p_tvb_get_ntoh24; - addr_tvb_get_ntohl p_tvb_get_ntohl; - - addr_tvb_get_letohs p_tvb_get_letohs; - addr_tvb_get_letoh24 p_tvb_get_letoh24; - addr_tvb_get_letohl p_tvb_get_letohl; - - addr_tvb_memcpy p_tvb_memcpy; - addr_tvb_memdup p_tvb_memdup; - - addr_tvb_get_ptr p_tvb_get_ptr; - - addr_tvb_find_guint8 p_tvb_find_guint8; - addr_tvb_pbrk_guint8 p_tvb_pbrk_guint8; - - addr_tvb_strnlen p_tvb_strnlen; - - addr_tvb_format_text p_tvb_format_text; - - addr_tvb_get_nstringz p_tvb_get_nstringz; - addr_tvb_get_nstringz0 p_tvb_get_nstringz0; - - addr_tvb_find_line_end p_tvb_find_line_end; - addr_tvb_find_line_end_unquoted p_tvb_find_line_end_unquoted; - - addr_tvb_strneql p_tvb_strneql; - addr_tvb_strncaseeql p_tvb_strncaseeql; - - addr_tvb_bytes_to_str p_tvb_bytes_to_str; - - addr_prefs_register_protocol p_prefs_register_protocol; - addr_prefs_register_uint_preference p_prefs_register_uint_preference; - addr_prefs_register_bool_preference p_prefs_register_bool_preference; - addr_prefs_register_enum_preference p_prefs_register_enum_preference; - addr_prefs_register_string_preference p_prefs_register_string_preference; - - /* GIOP Begin */ - - addr_register_giop_user p_register_giop_user; - addr_is_big_endian p_is_big_endian; - addr_get_CDR_encap_info p_get_CDR_encap_info; - - addr_get_CDR_any p_get_CDR_any; - addr_get_CDR_boolean p_get_CDR_boolean; - addr_get_CDR_char p_get_CDR_char; - addr_get_CDR_double p_get_CDR_double; - addr_get_CDR_enum p_get_CDR_enum; - addr_get_CDR_fixed p_get_CDR_fixed; - addr_get_CDR_float p_get_CDR_float; - addr_get_CDR_interface p_get_CDR_interface; - addr_get_CDR_long p_get_CDR_long; - addr_get_CDR_object p_get_CDR_object; - addr_get_CDR_octet p_get_CDR_octet; - addr_get_CDR_octet_seq p_get_CDR_octet_seq; - addr_get_CDR_short p_get_CDR_short; - addr_get_CDR_string p_get_CDR_string; - addr_get_CDR_typeCode p_get_CDR_typeCode; - addr_get_CDR_ulong p_get_CDR_ulong; - addr_get_CDR_ushort p_get_CDR_ushort; - addr_get_CDR_wchar p_get_CDR_wchar; - addr_get_CDR_wstring p_get_CDR_wstring; - - /* GIOP End */ - - /* TPKT Begin */ - - addr_is_tpkt p_is_tpkt; - addr_dissect_tpkt_encap p_dissect_tpkt_encap; - - /* GIOP End */ +#include "plugin_api_decls.h" + } plugin_address_table_t; #else /* ! PLUGINS_NEED_ADDRESS_TABLE */ |