Get rid of the "data_src" member of the "frame_data" structure; put it

in the "packet_info" structure instead, as we don't need a pointer for
every single frame in the capture file, just for each frame for which we
currently have an open "epan_dissect_t".

svn path=/trunk/; revision=5614
This commit is contained in:
Guy Harris 2002-06-04 07:03:57 +00:00
parent 1155a2fb43
commit 392a7dfc04
30 changed files with 136 additions and 153 deletions

View File

@ -1,6 +1,6 @@
/* epan.h
*
* $Id: epan.c,v 1.18 2002/05/09 23:50:28 gram Exp $
* $Id: epan.c,v 1.19 2002/06/04 07:03:54 guy Exp $
*
* Ethereal Protocol Analyzer Library
*
@ -95,9 +95,6 @@ void
epan_dissect_run(epan_dissect_t *edt, void* pseudo_header,
const guint8* data, frame_data *fd, column_info *cinfo)
{
/* start with empty data source list */
free_data_sources(fd);
dissect_packet(edt, pseudo_header, data, fd, cinfo);
}
@ -105,6 +102,9 @@ epan_dissect_run(epan_dissect_t *edt, void* pseudo_header,
void
epan_dissect_free(epan_dissect_t* edt)
{
/* Free the data sources list. */
free_data_sources(&edt->pi);
/* Free all tvb's created from this tvb, unless dissector
* wanted to store the pointer (in which case, the dissector
* would have incremented the usage count on that tvbuff_t*) */

View File

@ -1,7 +1,7 @@
/* frame_data.h
* Definitions for frame_data structures and routines
*
* $Id: frame_data.h,v 1.4 2002/02/18 01:08:41 guy Exp $
* $Id: frame_data.h,v 1.5 2002/06/04 07:03:54 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -35,7 +35,6 @@ typedef struct _frame_data {
struct _frame_data *next; /* Next element in list */
struct _frame_data *prev; /* Previous element in list */
GSList *pfd; /* Per frame proto data */
GSList *data_src; /* Frame data sources */
guint32 num; /* Frame number */
guint32 pkt_len; /* Packet length */
guint32 cap_len; /* Amount actually captured */

View File

@ -1,7 +1,7 @@
/* packet.c
* Routines for packet disassembly
*
* $Id: packet.c,v 1.71 2002/05/15 21:18:19 guy Exp $
* $Id: packet.c,v 1.72 2002/06/04 07:03:54 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -193,7 +193,7 @@ static GMemChunk *data_source_chunk = NULL;
* the tvbuff for the data source and its name.
*/
void
add_new_data_source(frame_data *fd, tvbuff_t *tvb, char *name)
add_new_data_source(packet_info *pinfo, tvbuff_t *tvb, char *name)
{
data_source *src;
@ -210,25 +210,25 @@ add_new_data_source(frame_data *fd, tvbuff_t *tvb, char *name)
* copy, and wouldn't need to free the buffer, either.
*/
src->name = g_strdup(name);
fd->data_src = g_slist_append(fd->data_src, src);
pinfo->data_src = g_slist_append(pinfo->data_src, src);
}
/*
* Free up a frame's list of data sources.
*/
void
free_data_sources(frame_data *fd)
free_data_sources(packet_info *pinfo)
{
GSList *src_le;
data_source *src;
for (src_le = fd->data_src; src_le != NULL; src_le = src_le->next) {
for (src_le = pinfo->data_src; src_le != NULL; src_le = src_le->next) {
src = src_le->data;
g_free(src->name);
g_mem_chunk_free(data_source_chunk, src);
}
g_slist_free(fd->data_src);
fd->data_src = NULL;
g_slist_free(pinfo->data_src);
pinfo->data_src = NULL;
}
/* Allow dissectors to register a "final_registration" routine
@ -283,6 +283,7 @@ dissect_packet(epan_dissect_t *edt, union wtap_pseudo_header *pseudo_header,
edt->pi.cinfo = cinfo;
edt->pi.fd = fd;
edt->pi.pseudo_header = pseudo_header;
edt->pi.data_src = NULL;
edt->pi.dl_src.type = AT_NONE;
edt->pi.dl_dst.type = AT_NONE;
edt->pi.net_src.type = AT_NONE;
@ -305,7 +306,7 @@ dissect_packet(epan_dissect_t *edt, union wtap_pseudo_header *pseudo_header,
TRY {
edt->tvb = tvb_new_real_data(pd, fd->cap_len, fd->pkt_len);
/* Add this tvbuffer into the data_src list */
add_new_data_source(fd, edt->tvb, "Frame");
add_new_data_source(&edt->pi, edt->tvb, "Frame");
/* Even though dissect_frame() catches all the exceptions a
* sub-dissector can throw, dissect_frame() itself may throw

View File

@ -1,7 +1,7 @@
/* packet.h
* Definitions for packet disassembly structures and routines
*
* $Id: packet.h,v 1.56 2002/05/09 23:50:28 gram Exp $
* $Id: packet.h,v 1.57 2002/06/04 07:03:54 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -266,12 +266,13 @@ final_registration_all_protocols(void);
* Add a new data source to the list of data sources for a frame, given
* the tvbuff for the data source and its name.
*/
extern void add_new_data_source(frame_data *fd, tvbuff_t *tvb, char *name);
extern void add_new_data_source(packet_info *pinfo, tvbuff_t *tvb,
char *name);
/*
* Free up a frame's list of data sources.
*/
extern void free_data_sources(frame_data *fd);
extern void free_data_sources(packet_info *pinfo);
/*
* Dissectors should never modify the packet data.

View File

@ -1,7 +1,7 @@
/* packet_info.h
* Definitions for packet info structures and routines
*
* $Id: packet_info.h,v 1.13 2001/12/10 00:26:16 guy Exp $
* $Id: packet_info.h,v 1.14 2002/06/04 07:03:55 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -92,6 +92,7 @@ typedef struct _packet_info {
column_info *cinfo; /* Column formatting information */
frame_data *fd;
union wtap_pseudo_header *pseudo_header;
GSList *data_src; /* Frame data sources */
address dl_src; /* link-layer source address */
address dl_dst; /* link-layer destination address */
address net_src; /* network-layer source address */

13
file.c
View File

@ -1,7 +1,7 @@
/* file.c
* File I/O routines
*
* $Id: file.c,v 1.275 2002/05/23 10:27:12 guy Exp $
* $Id: file.c,v 1.276 2002/06/04 07:03:44 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -798,7 +798,6 @@ read_packet(capture_file *cf, long offset)
fdata->next = NULL;
fdata->prev = NULL;
fdata->pfd = NULL;
fdata->data_src = NULL;
fdata->pkt_len = phdr->len;
fdata->cap_len = phdr->caplen;
fdata->file_off = offset;
@ -1017,7 +1016,6 @@ rescan_packets(capture_file *cf, const char *action, gboolean refilter,
g_slist_free(fdata->pfd);
fdata->pfd = NULL;
}
free_data_sources(fdata); /* release data source list */
}
/* XXX - do something with "err" */
@ -1046,7 +1044,6 @@ rescan_packets(capture_file *cf, const char *action, gboolean refilter,
g_slist_free(fdata->pfd);
fdata->pfd = NULL;
}
free_data_sources(fdata); /* release data source list */
}
}
@ -1243,12 +1240,11 @@ print_packets(capture_file *cf, print_args_t *print_args)
epan_dissect_run(edt, &cf->pseudo_header, cf->pd, fdata, NULL);
/* Print the information in that tree. */
proto_tree_print(print_args, (GNode *)edt->tree,
fdata, cf->print_fh);
proto_tree_print(print_args, edt, cf->print_fh);
if (print_args->print_hex) {
/* Print the full packet data as hex. */
print_hex_data(cf->print_fh, print_args->format, fdata);
print_hex_data(cf->print_fh, print_args->format, edt);
}
/* Print a blank line if we print anything after this. */
@ -1597,8 +1593,7 @@ select_packet(capture_file *cf, int row)
/* Display the GUI protocol tree and hex dump.
XXX - why do we dump core if we call "proto_tree_draw()"
before calling "add_byte_views()"? */
add_byte_views(cf->current_frame, cf->edt->tree, tree_view,
byte_nb_ptr);
add_byte_views(cf->edt, tree_view, byte_nb_ptr);
proto_tree_draw(cf->edt->tree, tree_view);
/* A packet is selected. */

View File

@ -3,7 +3,7 @@
*
* Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
*
* $Id: packet_win.c,v 1.36 2002/03/31 23:11:04 guy Exp $
* $Id: packet_win.c,v 1.37 2002/06/04 07:03:56 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -87,53 +87,46 @@ static void new_tree_view_select_row_cb( GtkCTree *ctree, GList *node,
static void new_tree_view_unselect_row_cb( GtkCTree *ctree, GList *node,
gint column, gpointer user_data);
static void create_new_window( char *Title, gint tv_size, gint bv_size);
static void destroy_new_window(GtkObject *object, gpointer user_data);
void new_window_cb(GtkWidget *w _U_){
#define NewWinTitleLen 1000
int row;
gint tv_size = 95, bv_size = 75;
int i;
char Title[ NewWinTitleLen] = "";
char *TextPtr;
/* build title of window by getting */
/* data from the packet_list GtkCList */
/* Find what row this packet is in. */
row = gtk_clist_find_row_from_data(GTK_CLIST(packet_list),
cfile.current_frame);
g_assert(row != -1);
for( i = 0; i < cfile.cinfo.num_cols; ++i){
if ( gtk_clist_get_text(GTK_CLIST( packet_list),
row, i, &TextPtr)){
if (( strlen( Title) + strlen( TextPtr))
< ( NewWinTitleLen - 1)){
strcat( Title, TextPtr);
strcat( Title, " ");
}
}
}
create_new_window ( Title, tv_size, bv_size);
}
static void
create_new_window(char *Title, gint tv_size, gint bv_size)
void new_window_cb(GtkWidget *w _U_)
{
#define NewWinTitleLen 1000
char Title[NewWinTitleLen] = "";
char *TextPtr;
gint tv_size = 95, bv_size = 75;
GtkWidget *main_w, *main_vbox, *pane,
*tree_view, *tv_scrollw,
*bv_nb_ptr;
struct PacketWinData *DataPtr;
int i;
/* Allocate data structure to represent this window. */
DataPtr = (struct PacketWinData *) g_malloc(sizeof(struct PacketWinData));
DataPtr->frame = cfile.current_frame;
memcpy(&DataPtr->pseudo_header, &cfile.pseudo_header, sizeof DataPtr->pseudo_header);
DataPtr->pd = g_malloc(DataPtr->frame->cap_len);
memcpy(DataPtr->pd, cfile.pd, DataPtr->frame->cap_len);
DataPtr->edt = epan_dissect_new(TRUE, TRUE);
epan_dissect_run(DataPtr->edt, &DataPtr->pseudo_header, DataPtr->pd,
DataPtr->frame, &cfile.cinfo);
epan_dissect_fill_in_columns(DataPtr->edt);
main_w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
/*
* Build title of window by getting column data constructed when the
* frame was dissected.
*/
for (i = 0; i < cfile.cinfo.num_cols; ++i) {
TextPtr = cfile.cinfo.col_data[i];
if ((strlen(Title) + strlen(TextPtr)) < NewWinTitleLen - 1) {
strcat(Title, TextPtr);
strcat(Title, " ");
}
}
gtk_window_set_title(GTK_WINDOW(main_w), Title);
gtk_window_set_default_size(GTK_WINDOW(main_w), DEF_WIDTH, -1);
@ -156,16 +149,6 @@ create_new_window(char *Title, gint tv_size, gint bv_size)
/* Byte view */
bv_nb_ptr = create_byte_view(bv_size, pane);
/* Allocate data structure to represent this window. */
DataPtr = (struct PacketWinData *) g_malloc(sizeof(struct PacketWinData));
DataPtr->frame = cfile.current_frame;
memcpy(&DataPtr->pseudo_header, &cfile.pseudo_header, sizeof DataPtr->pseudo_header);
DataPtr->pd = g_malloc(DataPtr->frame->cap_len);
memcpy(DataPtr->pd, cfile.pd, DataPtr->frame->cap_len);
DataPtr->edt = epan_dissect_new(TRUE, TRUE);
epan_dissect_run(DataPtr->edt, &DataPtr->pseudo_header, DataPtr->pd,
DataPtr->frame, &cfile.cinfo);
DataPtr->main = main_w;
DataPtr->tv_scrollw = tv_scrollw;
DataPtr->tree_view = tree_view;
@ -183,8 +166,7 @@ create_new_window(char *Title, gint tv_size, gint bv_size)
GTK_SIGNAL_FUNC(destroy_new_window), DataPtr);
/* draw the protocol tree & print hex data */
add_byte_views(DataPtr->frame, DataPtr->edt->tree, tree_view,
DataPtr->bv_nb_ptr);
add_byte_views(DataPtr->edt, tree_view, DataPtr->bv_nb_ptr);
proto_tree_draw(DataPtr->edt->tree, tree_view);
DataPtr->finfo_selected = NULL;

View File

@ -1,7 +1,7 @@
/* print_dlg.c
* Dialog boxes for printing
*
* $Id: print_dlg.c,v 1.31 2002/03/31 20:57:02 guy Exp $
* $Id: print_dlg.c,v 1.32 2002/06/04 07:03:57 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -587,7 +587,8 @@ print_destroy_cb(GtkWidget *win, gpointer user_data _U_)
/* Print a packet */
void
file_print_packet_cmd_cb(GtkWidget *widget _U_, gpointer data _U_) {
file_print_packet_cmd_cb(GtkWidget *widget _U_, gpointer data _U_)
{
FILE *fh;
print_args_t print_args;
@ -631,8 +632,7 @@ file_print_packet_cmd_cb(GtkWidget *widget _U_, gpointer data _U_) {
print_args.print_hex = FALSE;
print_args.expand_all = TRUE;
print_args.suppress_unmarked = FALSE;
proto_tree_print(&print_args, (GNode*) cfile.edt->tree,
cfile.current_frame, fh);
proto_tree_print(&print_args, cfile.edt, fh);
print_finale(fh, prefs.pr_format);
close_print_dest(print_args.to_file, fh);
}

View File

@ -1,7 +1,7 @@
/* proto_draw.c
* Routines for GTK+ packet display
*
* $Id: proto_draw.c,v 1.52 2002/04/23 06:42:05 guy Exp $
* $Id: proto_draw.c,v 1.53 2002/06/04 07:03:57 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -46,6 +46,8 @@
#include <stdio.h>
#include <string.h>
#include <epan/epan_dissect.h>
#include "main.h"
#include <epan/packet.h>
#include "util.h"
@ -444,7 +446,7 @@ add_byte_tab(GtkWidget *byte_nb, const char *name, tvbuff_t *tvb,
}
void
add_byte_views(frame_data *frame, proto_tree *tree, GtkWidget *tree_view,
add_byte_views(epan_dissect_t *edt, GtkWidget *tree_view,
GtkWidget *byte_nb_ptr)
{
GSList *src_le;
@ -460,9 +462,9 @@ add_byte_views(frame_data *frame, proto_tree *tree, GtkWidget *tree_view,
* Add to the specified byte view notebook tabs for hex dumps
* of all the data sources for the specified frame.
*/
for (src_le = frame->data_src; src_le != NULL; src_le = src_le->next) {
for (src_le = edt->pi.data_src; src_le != NULL; src_le = src_le->next) {
src = src_le->data;
add_byte_tab(byte_nb_ptr, src->name, src->tvb, tree,
add_byte_tab(byte_nb_ptr, src->name, src->tvb, edt->tree,
tree_view);
}

View File

@ -1,7 +1,7 @@
/* proto_draw.h
* Definitions for GTK+ packet display structures and routines
*
* $Id: proto_draw.h,v 1.17 2002/03/31 23:11:04 guy Exp $
* $Id: proto_draw.h,v 1.18 2002/06/04 07:03:57 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -49,8 +49,8 @@ extern void redraw_hex_dump_all(void);
extern GtkWidget *create_byte_view(gint bv_size, GtkWidget *pane);
extern void add_byte_views(frame_data *frame, proto_tree *tree,
GtkWidget *tree_view, GtkWidget *byte_nb_ptr);
extern void add_byte_views(epan_dissect_t *edt, GtkWidget *tree_view,
GtkWidget *byte_nb_ptr);
void packet_hex_print(GtkText *, const guint8 *, frame_data *, field_info *,
guint);

View File

@ -2,7 +2,7 @@
* Routines for AppleTalk packet disassembly: LLAP, DDP, NBP, ATP, ASP,
* RTMP.
*
* $Id: packet-atalk.c,v 1.72 2002/05/10 23:20:37 guy Exp $
* $Id: packet-atalk.c,v 1.73 2002/06/04 07:03:44 guy Exp $
*
* Simon Wilkinson <sxw@dcs.ed.ac.uk>
*
@ -858,7 +858,7 @@ dissect_atp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
if (fd_head->next != NULL) {
new_tvb = tvb_new_real_data(fd_head->data, fd_head->len, fd_head->len);
tvb_set_child_real_data_tvbuff(tvb, new_tvb);
add_new_data_source(pinfo->fd, new_tvb, "Reassembled ATP");
add_new_data_source(pinfo, new_tvb, "Reassembled ATP");
/* Show all fragments. */
if (tree)
show_fragments(new_tvb, pinfo, atp_tree, fd_head);

View File

@ -1,7 +1,7 @@
/* packet-clnp.c
* Routines for ISO/OSI network and transport protocol packet disassembly
*
* $Id: packet-clnp.c,v 1.55 2002/05/30 01:56:54 guy Exp $
* $Id: packet-clnp.c,v 1.56 2002/06/04 07:03:44 guy Exp $
* Laurent Deniel <deniel@worldnet.fr>
* Ralf Schneider <Ralf.Schneider@t-online.de>
*
@ -1842,7 +1842,7 @@ static void dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tvb_set_child_real_data_tvbuff(tvb, next_tvb);
/* Add the defragmented data to the data source list. */
add_new_data_source(pinfo->fd, next_tvb, "Reassembled CLNP");
add_new_data_source(pinfo, next_tvb, "Reassembled CLNP");
/* It's not fragmented. */
pinfo->fragmented = FALSE;

View File

@ -2,7 +2,7 @@
* Routines for MS Exchange MAPI
* Copyright 2002, Ronnie Sahlberg
*
* $Id: packet-dcerpc-mapi.c,v 1.9 2002/05/31 00:31:13 tpot Exp $
* $Id: packet-dcerpc-mapi.c,v 1.10 2002/06/04 07:03:44 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -177,7 +177,7 @@ mapi_decrypt_pdu(tvbuff_t *tvb, int offset,
mmd=g_hash_table_lookup(mapi_decrypted_table, &mmd_key);
}
add_new_data_source(pinfo->fd, mmd->tvb, "Decrypted MAPI");
add_new_data_source(pinfo, mmd->tvb, "Decrypted MAPI");
/* decrypted PDU */

View File

@ -2,7 +2,7 @@
* Routines for DCERPC packet disassembly
* Copyright 2001, Todd Sabin <tas@webspan.net>
*
* $Id: packet-dcerpc.c,v 1.52 2002/05/27 09:50:58 sahlberg Exp $
* $Id: packet-dcerpc.c,v 1.53 2002/06/04 07:03:44 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -1626,7 +1626,7 @@ dissect_dcerpc_cn_rqst (tvbuff_t *tvb, packet_info *pinfo, proto_tree *dcerpc_tr
next_tvb = tvb_new_real_data(ipfd_head->data, ipfd_head->datalen, ipfd_head->datalen);
tvb_set_child_real_data_tvbuff(tvb, next_tvb);
add_new_data_source(pinfo->fd, next_tvb, "Reassembled DCE/RPC");
add_new_data_source(pinfo, next_tvb, "Reassembled DCE/RPC");
pinfo->fragmented=FALSE;
fi = proto_tree_add_item(dcerpc_tree, hf_dcerpc_fragments, next_tvb, 0, -1, FALSE);
ft = proto_item_add_subtree(fi, ett_dcerpc_fragments);
@ -1849,7 +1849,7 @@ dissect_dcerpc_cn_resp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *dcerpc_tr
next_tvb = tvb_new_real_data(ipfd_head->data, ipfd_head->datalen, ipfd_head->datalen);
tvb_set_child_real_data_tvbuff(tvb, next_tvb);
add_new_data_source(pinfo->fd, next_tvb, "Reassembled DCE/RPC");
add_new_data_source(pinfo, next_tvb, "Reassembled DCE/RPC");
pinfo->fragmented=FALSE;
fi = proto_tree_add_item(dcerpc_tree, hf_dcerpc_fragments, next_tvb, 0, -1, FALSE);
ft = proto_item_add_subtree(fi, ett_dcerpc_fragments);

View File

@ -2,7 +2,7 @@
* Routines for EAP Extensible Authentication Protocol dissection
* RFC 2284
*
* $Id: packet-eap.c,v 1.24 2002/03/28 09:51:17 guy Exp $
* $Id: packet-eap.c,v 1.25 2002/06/04 07:03:44 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -612,8 +612,7 @@ dissect_eap_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
fd_head->len,
fd_head->len);
tvb_set_child_real_data_tvbuff(tvb, next_tvb);
add_new_data_source(pinfo->fd, next_tvb,
"Reassembled EAP-TLS");
add_new_data_source(pinfo, next_tvb, "Reassembled EAP-TLS");
pinfo->fragmented = FALSE;
fi = proto_tree_add_item(eap_tree, hf_eaptls_fragments,

View File

@ -1,7 +1,7 @@
/* packet-icq.c
* Routines for ICQ packet disassembly
*
* $Id: packet-icq.c,v 1.43 2002/05/02 10:53:03 guy Exp $
* $Id: packet-icq.c,v 1.44 2002/06/04 07:03:44 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -1837,7 +1837,7 @@ dissect_icqv5Client(tvbuff_t *tvb,
tvb_set_child_real_data_tvbuff(tvb, decr_tvb);
/* Add the decrypted data to the data source list. */
add_new_data_source(pinfo->fd, decr_tvb, "Decrypted");
add_new_data_source(pinfo, decr_tvb, "Decrypted");
cmd = tvb_get_letohs(decr_tvb, ICQ5_CL_CMD);

View File

@ -3,7 +3,7 @@
* Copyright 2000, Axis Communications AB
* Inquiries/bugreports should be sent to Johan.Jorgensen@axis.com
*
* $Id: packet-ieee80211.c,v 1.62 2002/05/30 01:56:54 guy Exp $
* $Id: packet-ieee80211.c,v 1.63 2002/06/04 07:03:44 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -1665,7 +1665,7 @@ dissect_ieee80211_common (tvbuff_t * tvb, packet_info * pinfo,
if (fd_head->next != NULL) {
next_tvb = tvb_new_real_data(fd_head->data, fd_head->len, fd_head->len);
tvb_set_child_real_data_tvbuff(tvb, next_tvb);
add_new_data_source(pinfo->fd, next_tvb, "Reassembled 802.11");
add_new_data_source(pinfo, next_tvb, "Reassembled 802.11");
/* Show all fragments. */
show_fragments(next_tvb, pinfo, hdr_tree, fd_head);

View File

@ -1,7 +1,7 @@
/* packet-ip.c
* Routines for IP and miscellaneous IP protocol packet disassembly
*
* $Id: packet-ip.c,v 1.166 2002/05/30 01:56:55 guy Exp $
* $Id: packet-ip.c,v 1.167 2002/06/04 07:03:45 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -998,7 +998,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tvb_set_child_real_data_tvbuff(tvb, next_tvb);
/* Add the defragmented data to the data source list. */
add_new_data_source(pinfo->fd, next_tvb, "Reassembled IPv4");
add_new_data_source(pinfo, next_tvb, "Reassembled IPv4");
/* It's not fragmented. */
pinfo->fragmented = FALSE;

View File

@ -1,7 +1,7 @@
/* packet-ipv6.c
* Routines for IPv6 packet disassembly
*
* $Id: packet-ipv6.c,v 1.81 2002/05/02 11:52:52 guy Exp $
* $Id: packet-ipv6.c,v 1.82 2002/06/04 07:03:45 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -843,7 +843,7 @@ again:
tvb_set_child_real_data_tvbuff(tvb, next_tvb);
/* Add the defragmented data to the data source list. */
add_new_data_source(pinfo->fd, next_tvb, "Reassembled IPv6");
add_new_data_source(pinfo, next_tvb, "Reassembled IPv6");
/* It's not fragmented. */
pinfo->fragmented = FALSE;

View File

@ -4,7 +4,7 @@
*
* RFC 2865, RFC 2866, RFC 2867, RFC 2868, RFC 2869
*
* $Id: packet-radius.c,v 1.62 2002/05/24 03:21:23 guy Exp $
* $Id: packet-radius.c,v 1.63 2002/06/04 07:03:45 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -2611,7 +2611,7 @@ dissect_attribute_value_pairs(tvbuff_t *tvb, int offset,proto_tree *tree,
tvb_set_child_real_data_tvbuff(tvb, next_tvb);
/* Add the defragmented data to the data source list. */
add_new_data_source(pinfo->fd, next_tvb, "Reassembled EAP");
add_new_data_source(pinfo, next_tvb, "Reassembled EAP");
/* Now dissect it. */
call_dissector(eap_fragment_handle, next_tvb, pinfo, eap_tree);

View File

@ -2,7 +2,7 @@
* Routines for rpc dissection
* Copyright 1999, Uwe Girlich <Uwe.Girlich@philosys.de>
*
* $Id: packet-rpc.c,v 1.94 2002/05/21 10:17:30 sahlberg Exp $
* $Id: packet-rpc.c,v 1.95 2002/06/04 07:03:45 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -2675,7 +2675,7 @@ dissect_rpc_fragment(tvbuff_t *tvb, int offset, packet_info *pinfo,
/*
* Add defragmented data to the data source list.
*/
add_new_data_source(pinfo->fd, rec_tvb, "Defragmented");
add_new_data_source(pinfo, rec_tvb, "Defragmented");
}
/*

View File

@ -8,7 +8,7 @@ XXX Fixme : shouldnt show [malformed frame] for long packets
* significant rewrite to tvbuffify the dissector, Ronnie Sahlberg and
* Guy Harris 2001
*
* $Id: packet-smb-pipe.c,v 1.77 2002/05/24 10:57:37 guy Exp $
* $Id: packet-smb-pipe.c,v 1.78 2002/06/04 07:03:45 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -3170,7 +3170,7 @@ dissect_pipe_dcerpc(tvbuff_t *d_tvb, packet_info *pinfo, proto_tree *parent_tree
new_tvb = tvb_new_real_data(fd_head->data,
fd_head->datalen, fd_head->datalen);
tvb_set_child_real_data_tvbuff(d_tvb, new_tvb);
add_new_data_source(pinfo->fd, new_tvb,
add_new_data_source(pinfo, new_tvb,
"DCERPC over SMB");
pinfo->fragmented=FALSE;

View File

@ -3,7 +3,7 @@
* Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
* 2001 Rewrite by Ronnie Sahlberg and Guy Harris
*
* $Id: packet-smb.c,v 1.267 2002/06/02 12:32:10 sahlberg Exp $
* $Id: packet-smb.c,v 1.268 2002/06/04 07:03:45 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -8304,7 +8304,7 @@ dissect_nt_transaction_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre
pd_tvb = tvb_new_real_data(r_fd->data, r_fd->datalen,
r_fd->datalen);
tvb_set_child_real_data_tvbuff(tvb, pd_tvb);
add_new_data_source(pinfo->fd, pd_tvb, "Reassembled SMB");
add_new_data_source(pinfo, pd_tvb, "Reassembled SMB");
pinfo->fragmented = FALSE;
it = proto_tree_add_text(tree, pd_tvb, 0, -1, "Fragments");
@ -12837,7 +12837,7 @@ dissect_transaction_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *
pd_tvb = tvb_new_real_data(r_fd->data, r_fd->datalen,
r_fd->datalen);
tvb_set_child_real_data_tvbuff(tvb, pd_tvb);
add_new_data_source(pinfo->fd, pd_tvb, "Reassembled SMB");
add_new_data_source(pinfo, pd_tvb, "Reassembled SMB");
pinfo->fragmented = FALSE;
it = proto_tree_add_text(tree, pd_tvb, 0, -1, "Fragments");

View File

@ -1,7 +1,7 @@
/* packet-tcp.c
* Routines for TCP packet disassembly
*
* $Id: packet-tcp.c,v 1.142 2002/05/05 22:25:14 guy Exp $
* $Id: packet-tcp.c,v 1.143 2002/06/04 07:03:46 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -401,8 +401,7 @@ desegment_tcp(tvbuff_t *tvb, packet_info *pinfo, int offset,
tvb_set_child_real_data_tvbuff(tvb, next_tvb);
/* add desegmented data to the data source list */
add_new_data_source(pinfo->fd, next_tvb,
"Desegmented");
add_new_data_source(pinfo, next_tvb, "Desegmented");
/*
* Supply the sequence number of the first of the

View File

@ -1,7 +1,7 @@
/* packet-vj.c
* Routines for Van Jacobson header decompression.
*
* $Id: packet-vj.c,v 1.11 2002/05/22 10:15:28 guy Exp $
* $Id: packet-vj.c,v 1.12 2002/06/04 07:03:47 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -383,7 +383,7 @@ dissect_vjuc(tvbuff_t *tvb, packet_info *pinfo, proto_tree * tree)
*/
next_tvb = tvb_new_real_data(buffer, isize, pntohs(&buffer[IP_FIELD_TOT_LEN]));
tvb_set_child_real_data_tvbuff(tvb, next_tvb);
add_new_data_source(pinfo->fd, next_tvb, "VJ Uncompressed");
add_new_data_source(pinfo, next_tvb, "VJ Uncompressed");
/*
* Call IP dissector.
@ -598,7 +598,7 @@ vjc_tvb_setup(tvbuff_t *src_tvb,
tvb_memcpy(src_tvb, pbuf + hdr_len, offset, buf_len - hdr_len);
*dst_tvb = tvb_new_real_data(pbuf, buf_len, ntohs(ip->tot_len));
tvb_set_child_real_data_tvbuff(src_tvb, *dst_tvb);
add_new_data_source(pinfo->fd, *dst_tvb, "VJ Decompressed");
add_new_data_source(pinfo, *dst_tvb, "VJ Decompressed");
return VJ_OK;
}

View File

@ -2,7 +2,7 @@
* Routines for Wellfleet Compression frame disassembly
* Copyright 2001, Jeffrey C. Foster <jfoste@woodward.com>
*
* $Id: packet-wcp.c,v 1.23 2002/04/11 09:38:03 guy Exp $
* $Id: packet-wcp.c,v 1.24 2002/06/04 07:03:47 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -602,7 +602,7 @@ static tvbuff_t *wcp_uncompress( tvbuff_t *src_tvb, int offset, packet_info *pin
tvb_set_child_real_data_tvbuff( src_tvb, tvb);
/* Add new data to the data source list */
add_new_data_source( pinfo->fd, tvb, "Uncompressed WCP");
add_new_data_source( pinfo, tvb, "Uncompressed WCP");
return tvb;
}

View File

@ -2,7 +2,7 @@
*
* Routines to dissect WTP component of WAP traffic.
*
* $Id: packet-wtp.c,v 1.33 2002/05/27 20:33:24 guy Exp $
* $Id: packet-wtp.c,v 1.34 2002/06/04 07:03:47 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -598,7 +598,7 @@ dissect_wtp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
fd_head->len,
fd_head->len);
tvb_set_child_real_data_tvbuff(tvb, wsp_tvb);
add_new_data_source(pinfo->fd, wsp_tvb,
add_new_data_source(pinfo, wsp_tvb,
"Reassembled WTP");
pinfo->fragmented = FALSE;

37
print.c
View File

@ -1,7 +1,7 @@
/* print.c
* Routines for printing packet analysis trees.
*
* $Id: print.c,v 1.46 2002/05/10 23:20:38 guy Exp $
* $Id: print.c,v 1.47 2002/06/04 07:03:47 guy Exp $
*
* Gilbert Ramirez <gram@alumni.rice.edu>
*
@ -35,11 +35,14 @@
# include <sys/types.h>
#endif
#include <epan/epan.h>
#include <epan/epan_dissect.h>
#include <epan/tvbuff.h>
#include <epan/packet.h>
#include "print.h"
#include "ps.h"
#include "util.h"
#include <epan/tvbuff.h>
#include "packet-data.h"
static void proto_tree_print_node_text(GNode *node, gpointer data);
@ -94,26 +97,26 @@ void print_finale(FILE *fh, gint format)
print_ps_finale(fh);
}
void proto_tree_print(print_args_t *print_args,
GNode *protocol_tree, frame_data *fd, FILE *fh)
void proto_tree_print(print_args_t *print_args, epan_dissect_t *edt,
FILE *fh)
{
print_data data;
/* Create the output */
data.level = 0;
data.fh = fh;
data.src_list = fd->data_src;
data.encoding = fd->flags.encoding;
data.src_list = edt->pi.data_src;
data.encoding = edt->pi.fd->flags.encoding;
data.print_all_levels = print_args->expand_all;
data.print_hex_for_data = !print_args->print_hex;
/* If we're printing the entire packet in hex, don't
print uninterpreted data fields in hex as well. */
if (print_args->format == PR_FMT_TEXT) {
g_node_children_foreach((GNode*) protocol_tree, G_TRAVERSE_ALL,
g_node_children_foreach((GNode*) edt->tree, G_TRAVERSE_ALL,
proto_tree_print_node_text, &data);
} else {
g_node_children_foreach((GNode*) protocol_tree, G_TRAVERSE_ALL,
g_node_children_foreach((GNode*) edt->tree, G_TRAVERSE_ALL,
proto_tree_print_node_ps, &data);
}
}
@ -210,7 +213,7 @@ void proto_tree_print_node_text(GNode *node, gpointer data)
}
}
void print_hex_data(FILE *fh, gint format, frame_data *fd)
void print_hex_data(FILE *fh, gint format, epan_dissect_t *edt)
{
gboolean multiple_sources;
GSList *src_le;
@ -227,9 +230,10 @@ void print_hex_data(FILE *fh, gint format, frame_data *fd)
* the data source before printing the data from the
* data source.
*/
multiple_sources = (fd->data_src->next != NULL);
multiple_sources = (edt->pi.data_src->next != NULL);
for (src_le = fd->data_src; src_le != NULL; src_le = src_le->next) {
for (src_le = edt->pi.data_src; src_le != NULL;
src_le = src_le->next) {
src = src_le->data;
tvb = src->tvb;
if (multiple_sources) {
@ -243,10 +247,13 @@ void print_hex_data(FILE *fh, gint format, frame_data *fd)
}
length = tvb_length(tvb);
cp = tvb_get_ptr(tvb, 0, length);
if (format == PR_FMT_PS)
print_hex_data_ps(fh, cp, length, fd->flags.encoding);
else
print_hex_data_text(fh, cp, length, fd->flags.encoding);
if (format == PR_FMT_PS) {
print_hex_data_ps(fh, cp, length,
edt->pi.fd->flags.encoding);
} else {
print_hex_data_text(fh, cp, length,
edt->pi.fd->flags.encoding);
}
}
}

View File

@ -1,7 +1,7 @@
/* print.h
* Definitions for printing packet analysis trees.
*
* $Id: print.h,v 1.26 2002/03/31 20:56:59 guy Exp $
* $Id: print.h,v 1.27 2002/06/04 07:03:47 guy Exp $
*
* Gilbert Ramirez <gram@alumni.rice.edu>
*
@ -56,9 +56,9 @@ FILE *open_print_dest(int to_file, const char *dest);
void close_print_dest(int to_file, FILE *fh);
void print_preamble(FILE *fh, gint format);
void print_finale(FILE *fh, gint format);
void proto_tree_print(print_args_t *print_args,
GNode *protocol_tree, frame_data *fd, FILE *fh);
void print_hex_data(FILE *fh, gint format, frame_data *fd);
void proto_tree_print(print_args_t *print_args, epan_dissect_t *edt,
FILE *fh);
void print_hex_data(FILE *fh, gint format, epan_dissect_t *edt);
void print_line(FILE *fh, gint format, char *line);
#endif /* print.h */

View File

@ -1,6 +1,6 @@
/* tethereal.c
*
* $Id: tethereal.c,v 1.138 2002/05/22 23:22:55 guy Exp $
* $Id: tethereal.c,v 1.139 2002/06/04 07:03:47 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -1251,7 +1251,6 @@ fill_in_fdata(frame_data *fdata, capture_file *cf,
fdata->next = NULL;
fdata->prev = NULL;
fdata->pfd = NULL;
fdata->data_src = NULL;
fdata->num = cf->count;
fdata->pkt_len = phdr->len;
fdata->cap_len = phdr->caplen;
@ -1308,7 +1307,6 @@ clear_fdata(frame_data *fdata)
{
if (fdata->pfd)
g_slist_free(fdata->pfd);
free_data_sources(fdata); /* release data source list */
}
static void
@ -1450,8 +1448,7 @@ wtap_dispatch_cb_print(u_char *user, const struct wtap_pkthdr *phdr,
print_args.print_hex = print_hex;
print_args.expand_all = TRUE;
print_args.suppress_unmarked = FALSE;
proto_tree_print(&print_args, (GNode *)edt->tree,
&fdata, stdout);
proto_tree_print(&print_args, edt, stdout);
if (!print_hex) {
/* "print_hex_data()" will put out a leading blank line, as well
as a trailing one; print one here, to separate the packets,
@ -1642,7 +1639,7 @@ wtap_dispatch_cb_print(u_char *user, const struct wtap_pkthdr *phdr,
putchar('\n');
}
if (print_hex) {
print_hex_data(stdout, print_args.format, &fdata);
print_hex_data(stdout, print_args.format, edt);
putchar('\n');
}
}