From c604cb5fa97c11d0a537a3e61df738cf5d3f18db Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Fri, 16 Mar 2012 21:01:32 +0000 Subject: [PATCH] Remove dissect_ipv6_options function (unused from Revision 16302...) svn path=/trunk/; revision=41624 --- epan/dissectors/packet-ipv6.c | 97 ----------------------------------- epan/ip_opts.h | 9 +--- 2 files changed, 1 insertion(+), 105 deletions(-) diff --git a/epan/dissectors/packet-ipv6.c b/epan/dissectors/packet-ipv6.c index 22498ff4a9..57a16dff01 100644 --- a/epan/dissectors/packet-ipv6.c +++ b/epan/dissectors/packet-ipv6.c @@ -781,103 +781,6 @@ static const value_string rtalertvals[] = { { 0, NULL } }; -/* Like "dissect_ip_tcp_options()", but assumes the length of an option - *doesn't* include the type and length bytes. */ -void -dissect_ipv6_options(tvbuff_t *tvb, int offset, guint length, - const ip_tcp_opt *opttab, int nopts, int eol, - packet_info *pinfo, proto_tree *opt_tree) -{ - guchar opt; - const ip_tcp_opt *optp; - opt_len_type len_type; - unsigned int optlen; - const char *name; - char name_str[7+1+1+2+2+1+1]; /* "Unknown (0x%02x)" */ - void (*dissect)(const struct ip_tcp_opt *, tvbuff_t *, - int, guint, packet_info *, proto_tree *); - guint len; - - while (length > 0) { - opt = tvb_get_guint8(tvb, offset); - for (optp = &opttab[0]; optp < &opttab[nopts]; optp++) { - if (optp->optcode == opt) - break; - } - if (optp == &opttab[nopts]) { - /* We assume that the only NO_LENGTH options are Pad1 options, - so that we can treat unknown options as VARIABLE_LENGTH with a - minimum of 0, and at least be able to move on to the next option - by using the length in the option. */ - optp = NULL; /* indicate that we don't know this option */ - len_type = VARIABLE_LENGTH; - optlen = 0; - g_snprintf(name_str, sizeof name_str, "Unknown (0x%02x)", opt); - name = name_str; - dissect = NULL; - } else { - len_type = optp->len_type; - optlen = optp->optlen; - name = optp->name; - dissect = optp->dissect; - } - --length; /* account for type byte */ - if (len_type != NO_LENGTH) { - /* Option has a length. Is it in the packet? */ - if (length == 0) { - /* Bogus - packet must at least include option code byte and - length byte! */ - proto_tree_add_text(opt_tree, tvb, offset, 1, - "%s (length byte past end of options)", name); - return; - } - len = tvb_get_guint8(tvb, offset + 1); /* total including type, len */ - --length; /* account for length byte */ - if (len > length) { - /* Bogus - option goes past the end of the header. */ - proto_tree_add_text(opt_tree, tvb, offset, length, - "%s (option length = %u byte%s says option goes past end of options)", - name, len, plurality(len, "", "s")); - return; - } else if (len_type == FIXED_LENGTH && len != optlen) { - /* Bogus - option length isn't what it's supposed to be for this - option. */ - proto_tree_add_text(opt_tree, tvb, offset, 2 + len, - "%s (with option length = %u byte%s; should be %u)", name, - len, plurality(len, "", "s"), optlen); - return; - } else if (len_type == VARIABLE_LENGTH && len < optlen) { - /* Bogus - option length is less than what it's supposed to be for - this option. */ - proto_tree_add_text(opt_tree, tvb, offset, 2 + len, - "%s (with option length = %u byte%s; should be >= %u)", name, - len, plurality(len, "", "s"), optlen); - return; - } else { - if (optp == NULL) { - proto_tree_add_text(opt_tree, tvb, offset, 2 + len, "%s (%u byte%s)", - name, len, plurality(len, "", "s")); - } else { - if (dissect != NULL) { - /* Option has a dissector. */ - (*dissect)(optp, tvb, offset, 2 + len, pinfo, opt_tree); - } else { - /* Option has no data, hence no dissector. */ - proto_tree_add_text(opt_tree, tvb, offset, 2 + len, "%s", name); - } - } - offset += 2 + len; - } - length -= len; - } else { - proto_tree_add_text(opt_tree, tvb, offset, 1, "%s", name); - offset += 1; - } - if (opt == eol) - break; - } -} - static int dissect_unknown_option(tvbuff_t *tvb, int offset, proto_tree *tree) { diff --git a/epan/ip_opts.h b/epan/ip_opts.h index c4c854671c..e39aced53d 100644 --- a/epan/ip_opts.h +++ b/epan/ip_opts.h @@ -1,6 +1,6 @@ /* ip_opts.h * Definitions of structures and routines for dissection of options that - * work like IPv4 or IPv6 options + * work like IPv4 options * * $Id$ * @@ -57,11 +57,4 @@ extern void dissect_ip_tcp_options(tvbuff_t *, int, guint, const ip_tcp_opt *, int, int, packet_info *, proto_tree *, proto_item *); -/** Routine to dissect options that work like IPv6 options, where the - length field in the option, if present, includes only the data, not - the type and length bytes. */ -extern void dissect_ipv6_options(tvbuff_t *, int, guint, - const ip_tcp_opt *, int, int, - packet_info *, proto_tree *); - #endif