2 * Routines for "next tvb" list
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 #include <epan/packet.h>
31 void next_tvb_init(next_tvb_list_t *list) {
37 void next_tvb_add_handle(next_tvb_list_t *list, tvbuff_t *tvb, proto_tree *tree, dissector_handle_t handle) {
38 next_tvb_item_t *item;
40 item = wmem_new(wmem_packet_scope(), next_tvb_item_t);
42 item->type = NTVB_HANDLE;
43 item->handle = handle;
48 list->last->next = item;
53 item->previous = list->last;
58 void next_tvb_add_uint(next_tvb_list_t *list, tvbuff_t *tvb, proto_tree *tree, dissector_table_t table, guint32 uint_val) {
59 next_tvb_item_t *item;
61 item = wmem_new(wmem_packet_scope(), next_tvb_item_t);
63 item->type = NTVB_UINT;
65 item->uint_val = uint_val;
70 list->last->next = item;
75 item->previous = list->last;
80 void next_tvb_add_string(next_tvb_list_t *list, tvbuff_t *tvb, proto_tree *tree, dissector_table_t table, const gchar *string) {
81 next_tvb_item_t *item;
83 item = wmem_new(wmem_packet_scope(), next_tvb_item_t);
85 item->type = NTVB_STRING;
87 item->string = string;
92 list->last->next = item;
97 item->previous = list->last;
102 void next_tvb_call(next_tvb_list_t *list, packet_info *pinfo, proto_tree *tree, dissector_handle_t handle, dissector_handle_t data_handle) {
103 next_tvb_item_t *item;
107 if (item->tvb && tvb_captured_length(item->tvb)) {
108 switch (item->type) {
110 call_dissector((item->handle) ? item->handle : ((handle) ? handle : data_handle), item->tvb, pinfo, (item->tree) ? item->tree : tree);
113 dissector_try_uint(item->table, item->uint_val, item->tvb, pinfo, (item->tree) ? item->tree : tree);
116 dissector_try_string(item->table, item->string, item->tvb, pinfo, (item->tree) ? item->tree : tree, NULL);
126 * Editor modelines - http://www.wireshark.org/tools/modelines.html
131 * indent-tabs-mode: nil
134 * ex: set shiftwidth=2 tabstop=8 expandtab:
135 * :indentSize=2:tabSize=8:noTabs=true: