- "next tvb" list moved from h225 to new file next_tvb.[ch]

- h225 updated and regenerated
- restore calling subdissectors for SNMP variables which was broken with new SNMP

svn path=/trunk/; revision=18451
This commit is contained in:
Tomas Kukosa 2006-06-13 13:21:12 +00:00
parent a557a61ae0
commit a063a87af5
9 changed files with 277 additions and 159 deletions

View File

@ -273,14 +273,14 @@ CallIdentifier/guid guid
tvbuff_t *h245_tvb = NULL;
%(DEFAULT_BODY)s
next_tvb_add(&h245_list, h245_tvb, (h225_h245_in_tree)?tree:NULL, h245dg_handle);
next_tvb_add_handle(&h245_list, h245_tvb, (h225_h245_in_tree)?tree:NULL, h245dg_handle);
#.END
#----------------------------------------------------------------------------------------
#.FN_BODY H245Control/_item VAL_PTR = &h245_tvb
tvbuff_t *h245_tvb = NULL;
%(DEFAULT_BODY)s
next_tvb_add(&h245_list, h245_tvb, (h225_h245_in_tree)?tree:NULL, h245dg_handle);
next_tvb_add_handle(&h245_list, h245_tvb, (h225_h245_in_tree)?tree:NULL, h245dg_handle);
#.END
#----------------------------------------------------------------------------------------
#.FN_FTR H323-UU-PDU/h323-message-body/empty
@ -530,7 +530,7 @@ ReleaseCompleteReason VAL_PTR = &value
tvbuff_t *next_tvb = NULL;
%(DEFAULT_BODY)s
next_tvb_add(&tp_list, next_tvb, (h225_tp_in_tree)?tree:NULL, tp_handle);
next_tvb_add_handle(&tp_list, next_tvb, (h225_tp_in_tree)?tree:NULL, tp_handle);
#.END
#--- NonStandardParameter ---------------------------------------------------------------

View File

@ -45,6 +45,7 @@
#include <epan/prefs.h>
#include <epan/oid_resolv.h>
#include <epan/next_tvb.h>
#include "tap.h"
#include "packet-tpkt.h"
#include "packet-per.h"
@ -55,68 +56,6 @@
#include "packet-h245.h"
#include "packet-q931.h"
/*---------------------------------------------------------------------------*/
/* next tvb list - can be moved to some more common file if other dissector needs it */
#include <epan/emem.h>
typedef struct next_tvb_item {
struct next_tvb_item *next;
struct next_tvb_item *previous;
dissector_handle_t handle;
tvbuff_t *tvb;
proto_tree *tree;
} next_tvb_item_t;
typedef struct {
next_tvb_item_t *first;
next_tvb_item_t *last;
int count;
} next_tvb_list_t;
void next_tvb_init(next_tvb_list_t *list);
void next_tvb_add(next_tvb_list_t *list, tvbuff_t *tvb, proto_tree *tree, dissector_handle_t handle);
void next_tvb_call(next_tvb_list_t *list, packet_info *pinfo, proto_tree *tree, dissector_handle_t handle, dissector_handle_t data_handle);
void next_tvb_init(next_tvb_list_t *list) {
list->first = NULL;
list->last = NULL;
list->count = 0;
}
void next_tvb_add(next_tvb_list_t *list, tvbuff_t *tvb, proto_tree *tree, dissector_handle_t handle) {
next_tvb_item_t *item;
item = ep_alloc(sizeof(next_tvb_item_t));
item->handle = handle;
item->tvb = tvb;
item->tree = tree;
if (list->last) {
list->last->next = item;
} else {
list->first = item;
}
item->next = NULL;
item->previous = list->last;
list->last = item;
list->count++;
}
void next_tvb_call(next_tvb_list_t *list, packet_info *pinfo, proto_tree *tree, dissector_handle_t handle, dissector_handle_t data_handle) {
next_tvb_item_t *item;
item = list->first;
while (item) {
if (item->tvb && tvb_length(item->tvb)) {
call_dissector((item->handle) ? item->handle : ((handle) ? handle : data_handle), item->tvb, pinfo, (item->tree) ? item->tree : tree);
}
item = item->next;
}
}
/*---------------------------------------------------------------------------*/
#define PNAME "H323-MESSAGES"
#define PSNAME "H.225.0"

View File

@ -56,6 +56,7 @@
#include <epan/prefs.h>
#include <epan/sminmpec.h>
#include <epan/emem.h>
#include <epan/next_tvb.h>
#include "packet-ipx.h"
#include "packet-hpext.h"
@ -147,6 +148,7 @@ static int proto_smux = -1;
static const gchar *mib_modules = DEF_MIB_MODULES;
static gboolean display_oid = TRUE;
static gboolean snmp_var_in_tree = TRUE;
/* Subdissector tables */
static dissector_table_t variable_oid_dissector_table;
@ -162,10 +164,13 @@ static gboolean snmp_desegment = TRUE;
guint32 MsgSecurityModel;
tvbuff_t *oid_tvb=NULL;
tvbuff_t *value_tvb=NULL;
static dissector_handle_t snmp_handle;
static dissector_handle_t data_handle;
static next_tvb_list_t var_list;
static int hf_snmp_v3_flags_auth = -1;
static int hf_snmp_v3_flags_crypt = -1;
static int hf_snmp_v3_flags_report = -1;
@ -1129,6 +1134,8 @@ dissect_snmp_pdu(tvbuff_t *tvb, int offset, packet_info *pinfo,
}
}
next_tvb_init(&var_list);
if (check_col(pinfo->cinfo, COL_PROTOCOL)) {
col_set_str(pinfo->cinfo, COL_PROTOCOL,
proto_get_protocol_short_name(find_protocol_by_id(proto)));
@ -1162,10 +1169,10 @@ dissect_snmp_pdu(tvbuff_t *tvb, int offset, packet_info *pinfo,
return length_remaining;
break;
}
next_tvb_call(&var_list, pinfo, tree, NULL, data_handle);
return offset;
}
static gint
@ -1460,6 +1467,14 @@ void proto_register_snmp(void) {
" To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
&snmp_desegment);
prefs_register_bool_preference(snmp_module, "var_in_tree",
"Display dissected variables inside SNMP tree",
"ON - display dissected variables inside SNMP tree, OFF - display dissected variables in root tree after SNMP",
&snmp_var_in_tree);
variable_oid_dissector_table =
register_dissector_table("snmp.variable_oid",
"SNMP Variable OID", FT_STRING, BASE_NONE);
}
@ -1513,9 +1528,6 @@ proto_register_smux(void)
proto_register_field_array(proto_smux, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
variable_oid_dissector_table =
register_dissector_table("snmp.variable_oid",
"SNMP Variable OID", FT_STRING, BASE_NONE);
}
void

View File

@ -209,6 +209,16 @@ gint pdu_type;
proto_tree_add_item(tree, hf_snmp_v3_flags_auth, parameter_tvb, 0, 1, FALSE);
}
#.FN_BODY VarBind
oid_tvb = NULL;
value_tvb = NULL;
%(DEFAULT_BODY)s
if (oid_tvb && value_tvb) {
next_tvb_add_string(&var_list, value_tvb, (snmp_var_in_tree) ? tree : NULL,
variable_oid_dissector_table,
oid_to_str(tvb_get_ptr(oid_tvb, 0, tvb_length(oid_tvb)), tvb_length(oid_tvb)));
}
#.FN_PARS ObjectName
VAL_PTR = &oid_tvb
@ -216,7 +226,7 @@ gint pdu_type;
#.FN_BODY String-value
guint length;
snmp_variable_decode(tvb, tree, pinfo, oid_tvb, offset, &length, NULL);
snmp_variable_decode(tvb, tree, pinfo, oid_tvb, offset, &length, &value_tvb);
offset = offset + length;
#.FN_BODY Integer-value

View File

@ -59,6 +59,7 @@ LIBWIRESHARK_SRC = \
in_cksum.c \
ipproto.c \
ipv4.c \
next_tvb.c \
nstime.c \
oid_resolv.c \
osi-utils.c \
@ -144,6 +145,7 @@ LIBWIRESHARK_INCLUDES = \
guid-utils.h \
lapd_sapi.h \
llcsaps.h \
next_tvb.h \
nlpid.h \
nstime.h \
oid_resolv.h \

View File

@ -53,6 +53,7 @@
#include <epan/prefs.h>
#include <epan/oid_resolv.h>
#include <epan/next_tvb.h>
#include "tap.h"
#include "packet-tpkt.h"
#include "packet-per.h"
@ -63,68 +64,6 @@
#include "packet-h245.h"
#include "packet-q931.h"
/*---------------------------------------------------------------------------*/
/* next tvb list - can be moved to some more common file if other dissector needs it */
#include <epan/emem.h>
typedef struct next_tvb_item {
struct next_tvb_item *next;
struct next_tvb_item *previous;
dissector_handle_t handle;
tvbuff_t *tvb;
proto_tree *tree;
} next_tvb_item_t;
typedef struct {
next_tvb_item_t *first;
next_tvb_item_t *last;
int count;
} next_tvb_list_t;
void next_tvb_init(next_tvb_list_t *list);
void next_tvb_add(next_tvb_list_t *list, tvbuff_t *tvb, proto_tree *tree, dissector_handle_t handle);
void next_tvb_call(next_tvb_list_t *list, packet_info *pinfo, proto_tree *tree, dissector_handle_t handle, dissector_handle_t data_handle);
void next_tvb_init(next_tvb_list_t *list) {
list->first = NULL;
list->last = NULL;
list->count = 0;
}
void next_tvb_add(next_tvb_list_t *list, tvbuff_t *tvb, proto_tree *tree, dissector_handle_t handle) {
next_tvb_item_t *item;
item = ep_alloc(sizeof(next_tvb_item_t));
item->handle = handle;
item->tvb = tvb;
item->tree = tree;
if (list->last) {
list->last->next = item;
} else {
list->first = item;
}
item->next = NULL;
item->previous = list->last;
list->last = item;
list->count++;
}
void next_tvb_call(next_tvb_list_t *list, packet_info *pinfo, proto_tree *tree, dissector_handle_t handle, dissector_handle_t data_handle) {
next_tvb_item_t *item;
item = list->first;
while (item) {
if (item->tvb && tvb_length(item->tvb)) {
call_dissector((item->handle) ? item->handle : ((handle) ? handle : data_handle), item->tvb, pinfo, (item->tree) ? item->tree : tree);
}
item = item->next;
}
}
/*---------------------------------------------------------------------------*/
#define PNAME "H323-MESSAGES"
#define PSNAME "H.225.0"
@ -922,7 +861,7 @@ static int hf_h225_stopped = -1; /* NULL */
static int hf_h225_notAvailable = -1; /* NULL */
/*--- End of included file: packet-h225-hf.c ---*/
#line 170 "packet-h225-template.c"
#line 109 "packet-h225-template.c"
/* Initialize the subtree pointers */
static gint ett_h225 = -1;
@ -1162,7 +1101,7 @@ static gint ett_h225_ServiceControlResponse = -1;
static gint ett_h225_T_result = -1;
/*--- End of included file: packet-h225-ett.c ---*/
#line 174 "packet-h225-template.c"
#line 113 "packet-h225-template.c"
/* Preferences */
static gboolean h225_reassembly = TRUE;
@ -5482,7 +5421,7 @@ dissect_h225_ParallelH245Control_item(tvbuff_t *tvb, int offset, asn_ctx_t *actx
offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index,
NO_BOUND, NO_BOUND, &h245_tvb);
next_tvb_add(&h245_list, h245_tvb, (h225_h245_in_tree)?tree:NULL, h245dg_handle);
next_tvb_add_handle(&h245_list, h245_tvb, (h225_h245_in_tree)?tree:NULL, h245dg_handle);
return offset;
@ -6356,7 +6295,7 @@ dissect_h225_H245Control_item(tvbuff_t *tvb, int offset, asn_ctx_t *actx _U_, pr
offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index,
NO_BOUND, NO_BOUND, &h245_tvb);
next_tvb_add(&h245_list, h245_tvb, (h225_h245_in_tree)?tree:NULL, h245dg_handle);
next_tvb_add_handle(&h245_list, h245_tvb, (h225_h245_in_tree)?tree:NULL, h245dg_handle);
return offset;
@ -6431,7 +6370,7 @@ dissect_h225_T_messageContent_item(tvbuff_t *tvb, int offset, asn_ctx_t *actx _U
offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index,
NO_BOUND, NO_BOUND, &next_tvb);
next_tvb_add(&tp_list, next_tvb, (h225_tp_in_tree)?tree:NULL, tp_handle);
next_tvb_add_handle(&tp_list, next_tvb, (h225_tp_in_tree)?tree:NULL, tp_handle);
return offset;
@ -9406,7 +9345,7 @@ dissect_h225_RasMessage(tvbuff_t *tvb, int offset, asn_ctx_t *actx _U_, proto_tr
/*--- End of included file: packet-h225-fn.c ---*/
#line 198 "packet-h225-template.c"
#line 137 "packet-h225-template.c"
static int
@ -12496,7 +12435,7 @@ void proto_register_h225(void) {
"ServiceControlResponse/result/notAvailable", HFILL }},
/*--- End of included file: packet-h225-hfarr.c ---*/
#line 311 "packet-h225-template.c"
#line 250 "packet-h225-template.c"
};
/* List of subtrees */
@ -12738,7 +12677,7 @@ void proto_register_h225(void) {
&ett_h225_T_result,
/*--- End of included file: packet-h225-ettarr.c ---*/
#line 317 "packet-h225-template.c"
#line 256 "packet-h225-template.c"
};
module_t *h225_module;

View File

@ -64,6 +64,7 @@
#include <epan/prefs.h>
#include <epan/sminmpec.h>
#include <epan/emem.h>
#include <epan/next_tvb.h>
#include "packet-ipx.h"
#include "packet-hpext.h"
@ -155,6 +156,7 @@ static int proto_smux = -1;
static const gchar *mib_modules = DEF_MIB_MODULES;
static gboolean display_oid = TRUE;
static gboolean snmp_var_in_tree = TRUE;
/* Subdissector tables */
static dissector_table_t variable_oid_dissector_table;
@ -170,10 +172,13 @@ static gboolean snmp_desegment = TRUE;
guint32 MsgSecurityModel;
tvbuff_t *oid_tvb=NULL;
tvbuff_t *value_tvb=NULL;
static dissector_handle_t snmp_handle;
static dissector_handle_t data_handle;
static next_tvb_list_t var_list;
static int hf_snmp_v3_flags_auth = -1;
static int hf_snmp_v3_flags_crypt = -1;
static int hf_snmp_v3_flags_report = -1;
@ -277,7 +282,7 @@ static int hf_snmp_priority = -1; /* INTEGER_M1_2147483647 */
static int hf_snmp_operation = -1; /* T_operation */
/*--- End of included file: packet-snmp-hf.c ---*/
#line 185 "packet-snmp-template.c"
#line 190 "packet-snmp-template.c"
static int hf_smux_version = -1;
static int hf_smux_pdutype = -1;
@ -317,7 +322,7 @@ static gint ett_snmp_SimpleOpen = -1;
static gint ett_snmp_RReqPDU = -1;
/*--- End of included file: packet-snmp-ett.c ---*/
#line 196 "packet-snmp-template.c"
#line 201 "packet-snmp-template.c"
/* defined in net-SNMP; include/net-snmp/library/snmp.h */
#undef SNMP_MSG_GET
@ -1187,7 +1192,7 @@ dissect_snmp_NotificationName(gboolean implicit_tag _U_, tvbuff_t *tvb, int offs
static int
dissect_snmp_Integer_value(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
#line 223 "snmp.cnf"
#line 233 "snmp.cnf"
guint length;
snmp_variable_decode(tvb, tree, pinfo, oid_tvb, offset, &length, NULL);
@ -1205,10 +1210,10 @@ static int dissect_integer_value(packet_info *pinfo, proto_tree *tree, tvbuff_t
static int
dissect_snmp_String_value(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
#line 217 "snmp.cnf"
#line 227 "snmp.cnf"
guint length;
snmp_variable_decode(tvb, tree, pinfo, oid_tvb, offset, &length, NULL);
snmp_variable_decode(tvb, tree, pinfo, oid_tvb, offset, &length, &value_tvb);
offset = offset + length;
@ -1223,7 +1228,7 @@ static int dissect_string_value(packet_info *pinfo, proto_tree *tree, tvbuff_t *
static int
dissect_snmp_ObjectID_value(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
#line 229 "snmp.cnf"
#line 239 "snmp.cnf"
guint length;
snmp_variable_decode(tvb, tree, pinfo, oid_tvb, offset, &length, NULL);
@ -1241,7 +1246,7 @@ static int dissect_objectID_value(packet_info *pinfo, proto_tree *tree, tvbuff_t
static int
dissect_snmp_Empty(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
#line 235 "snmp.cnf"
#line 245 "snmp.cnf"
guint length;
snmp_variable_decode(tvb, tree, pinfo, oid_tvb, offset, &length, NULL);
@ -1651,9 +1656,20 @@ static const ber_sequence_t VarBind_sequence[] = {
static int
dissect_snmp_VarBind(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
#line 213 "snmp.cnf"
oid_tvb = NULL;
value_tvb = NULL;
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
VarBind_sequence, hf_index, ett_snmp_VarBind);
if (oid_tvb && value_tvb) {
next_tvb_add_string(&var_list, value_tvb, (snmp_var_in_tree) ? tree : NULL,
variable_oid_dissector_table,
oid_to_str(tvb_get_ptr(oid_tvb, 0, tvb_length(oid_tvb)), tvb_length(oid_tvb)));
}
return offset;
}
static int dissect_VarBindList_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
@ -2682,7 +2698,7 @@ static void dissect_SMUX_PDUs_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree
/*--- End of included file: packet-snmp-fn.c ---*/
#line 1032 "packet-snmp-template.c"
#line 1037 "packet-snmp-template.c"
guint
dissect_snmp_pdu(tvbuff_t *tvb, int offset, packet_info *pinfo,
@ -2783,6 +2799,8 @@ dissect_snmp_pdu(tvbuff_t *tvb, int offset, packet_info *pinfo,
}
}
next_tvb_init(&var_list);
if (check_col(pinfo->cinfo, COL_PROTOCOL)) {
col_set_str(pinfo->cinfo, COL_PROTOCOL,
proto_get_protocol_short_name(find_protocol_by_id(proto)));
@ -2816,10 +2834,10 @@ dissect_snmp_pdu(tvbuff_t *tvb, int offset, packet_info *pinfo,
return length_remaining;
break;
}
next_tvb_call(&var_list, pinfo, tree, NULL, data_handle);
return offset;
}
static gint
@ -3372,7 +3390,7 @@ void proto_register_snmp(void) {
"RReqPDU/operation", HFILL }},
/*--- End of included file: packet-snmp-hfarr.c ---*/
#line 1385 "packet-snmp-template.c"
#line 1392 "packet-snmp-template.c"
};
/* List of subtrees */
@ -3410,7 +3428,7 @@ void proto_register_snmp(void) {
&ett_snmp_RReqPDU,
/*--- End of included file: packet-snmp-ettarr.c ---*/
#line 1394 "packet-snmp-template.c"
#line 1401 "packet-snmp-template.c"
};
module_t *snmp_module;
@ -3480,6 +3498,14 @@ void proto_register_snmp(void) {
" To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
&snmp_desegment);
prefs_register_bool_preference(snmp_module, "var_in_tree",
"Display dissected variables inside SNMP tree",
"ON - display dissected variables inside SNMP tree, OFF - display dissected variables in root tree after SNMP",
&snmp_var_in_tree);
variable_oid_dissector_table =
register_dissector_table("snmp.variable_oid",
"SNMP Variable OID", FT_STRING, BASE_NONE);
}
@ -3533,9 +3559,6 @@ proto_register_smux(void)
proto_register_field_array(proto_smux, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
variable_oid_dissector_table =
register_dissector_table("snmp.variable_oid",
"SNMP Variable OID", FT_STRING, BASE_NONE);
}
void

128
epan/next_tvb.c Normal file
View File

@ -0,0 +1,128 @@
/* next_tvb.c
* Routines for "next tvb" list
*
* $Id$
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* 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.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <glib.h>
#include <epan/packet.h>
#include <epan/emem.h>
#include "next_tvb.h"
void next_tvb_init(next_tvb_list_t *list) {
list->first = NULL;
list->last = NULL;
list->count = 0;
}
void next_tvb_add_handle(next_tvb_list_t *list, tvbuff_t *tvb, proto_tree *tree, dissector_handle_t handle) {
next_tvb_item_t *item;
item = ep_alloc(sizeof(next_tvb_item_t));
item->type = NTVB_HANDLE;
item->handle = handle;
item->tvb = tvb;
item->tree = tree;
if (list->last) {
list->last->next = item;
} else {
list->first = item;
}
item->next = NULL;
item->previous = list->last;
list->last = item;
list->count++;
}
void next_tvb_add_port(next_tvb_list_t *list, tvbuff_t *tvb, proto_tree *tree, dissector_table_t table, guint32 port) {
next_tvb_item_t *item;
item = ep_alloc(sizeof(next_tvb_item_t));
item->type = NTVB_PORT;
item->table = table;
item->port = port;
item->tvb = tvb;
item->tree = tree;
if (list->last) {
list->last->next = item;
} else {
list->first = item;
}
item->next = NULL;
item->previous = list->last;
list->last = item;
list->count++;
}
void next_tvb_add_string(next_tvb_list_t *list, tvbuff_t *tvb, proto_tree *tree, dissector_table_t table, const gchar *string) {
next_tvb_item_t *item;
item = ep_alloc(sizeof(next_tvb_item_t));
item->type = NTVB_STRING;
item->table = table;
item->string = string;
item->tvb = tvb;
item->tree = tree;
if (list->last) {
list->last->next = item;
} else {
list->first = item;
}
item->next = NULL;
item->previous = list->last;
list->last = item;
list->count++;
}
void next_tvb_call(next_tvb_list_t *list, packet_info *pinfo, proto_tree *tree, dissector_handle_t handle, dissector_handle_t data_handle) {
next_tvb_item_t *item;
item = list->first;
while (item) {
if (item->tvb && tvb_length(item->tvb)) {
switch (item->type) {
case NTVB_HANDLE:
call_dissector((item->handle) ? item->handle : ((handle) ? handle : data_handle), item->tvb, pinfo, (item->tree) ? item->tree : tree);
break;
case NTVB_PORT:
dissector_try_port(item->table, item->port, item->tvb, pinfo, (item->tree) ? item->tree : tree);
break;
case NTVB_STRING:
dissector_try_string(item->table, item->string, item->tvb, pinfo, (item->tree) ? item->tree : tree);
break;
}
}
item = item->next;
}
}

65
epan/next_tvb.h Normal file
View File

@ -0,0 +1,65 @@
/* next_tvb.h
* Definitions for "next tvb" list
*
* $Id$
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* 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.
*/
/* The buffers returned by these functions are all allocated with a
* packet lifetime or are static buffers and does not have have to be freed.
* However, take into account that when the packet dissection
* completes, these buffers will be automatically reclaimed/freed.
* If you need the buffer to remain for a longer scope than packet lifetime
* you must copy the content to an se_alloc() buffer.
*/
#ifndef __NEXT_TVB_H__
#define __NEXT_TVB_H__
typedef enum {
NTVB_HANDLE,
NTVB_PORT,
NTVB_STRING,
} next_tvb_call_e;
typedef struct next_tvb_item {
struct next_tvb_item *next;
struct next_tvb_item *previous;
next_tvb_call_e type;
dissector_handle_t handle;
dissector_table_t table;
guint32 port;
const gchar *string;
tvbuff_t *tvb;
proto_tree *tree;
} next_tvb_item_t;
typedef struct {
next_tvb_item_t *first;
next_tvb_item_t *last;
int count;
} next_tvb_list_t;
extern void next_tvb_init(next_tvb_list_t *list);
extern void next_tvb_add_handle(next_tvb_list_t *list, tvbuff_t *tvb, proto_tree *tree, dissector_handle_t handle);
extern void next_tvb_add_port(next_tvb_list_t *list, tvbuff_t *tvb, proto_tree *tree, dissector_table_t table, guint32 port);
extern void next_tvb_add_string(next_tvb_list_t *list, tvbuff_t *tvb, proto_tree *tree, dissector_table_t table, const gchar *string);
extern void next_tvb_call(next_tvb_list_t *list, packet_info *pinfo, proto_tree *tree, dissector_handle_t handle, dissector_handle_t data_handle);
#endif /* __NEXT_TVB_H__ */