git.samba.org
/
obnox
/
wireshark
/
wip.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update some links.
[obnox/wireshark/wip.git]
/
proto_hier_stats.c
diff --git
a/proto_hier_stats.c
b/proto_hier_stats.c
index 548ce7137760ad41c6d509ecfa3e968bcf72b477..4f95d9837cde954999d9f8a883ce905d0fb1f922 100644
(file)
--- a/
proto_hier_stats.c
+++ b/
proto_hier_stats.c
@@
-26,10
+26,11
@@
# include "config.h"
#endif
# include "config.h"
#endif
+#include <stdio.h>
+
#include "globals.h"
#include "proto_hier_stats.h"
#include "progress_dlg.h"
#include "globals.h"
#include "proto_hier_stats.h"
#include "progress_dlg.h"
-#include "simple_dialog.h"
#include <epan/epan_dissect.h>
#include <wtap.h>
#include <epan/epan_dissect.h>
#include <wtap.h>
@@
-85,8
+86,9
@@
process_node(proto_node *ptree_node, GNode *parent_stat_node, ph_stats_t *ps, gu
proto_node *proto_sibling_node;
GNode *stat_node;
proto_node *proto_sibling_node;
GNode *stat_node;
- finfo = PITEM_FINFO(ptree_node);
- g_assert(finfo);
+ finfo = PNODE_FINFO(ptree_node);
+ /* We don't fake protocol nodes we expect them to have a field_info */
+ g_assert(finfo && "dissection with faked proto tree?");
/* If the field info isn't related to a protocol but to a field,
* don't count them, as they don't belong to any protocol.
/* If the field info isn't related to a protocol but to a field,
* don't count them, as they don't belong to any protocol.
@@
-110,7
+112,7
@@
process_node(proto_node *ptree_node, GNode *parent_stat_node, ph_stats_t *ps, gu
* not a normal protocol in the top-level tree. It was instead
* added as a normal tree such as IPv6's Hop-by-hop Option Header and
* should be skipped when creating the protocol hierarchy display. */
* not a normal protocol in the top-level tree. It was instead
* added as a normal tree such as IPv6's Hop-by-hop Option Header and
* should be skipped when creating the protocol hierarchy display. */
- if(strlen(
proto_sibling_node->finfo
->hfinfo->name) == 0 && ptree_node->next)
+ if(strlen(
PNODE_FINFO(proto_sibling_node)
->hfinfo->name) == 0 && ptree_node->next)
proto_sibling_node = proto_sibling_node->next;
process_node(proto_sibling_node, stat_node, ps, pkt_len);
proto_sibling_node = proto_sibling_node->next;
process_node(proto_sibling_node, stat_node, ps, pkt_len);
@@
-138,27
+140,23
@@
process_tree(proto_tree *protocol_tree, ph_stats_t* ps, guint pkt_len)
static gboolean
process_frame(frame_data *frame, column_info *cinfo, ph_stats_t* ps)
{
static gboolean
process_frame(frame_data *frame, column_info *cinfo, ph_stats_t* ps)
{
- epan_dissect_t
*
edt;
+ epan_dissect_t edt;
union wtap_pseudo_header phdr;
guint8 pd[WTAP_MAX_PACKET_SIZE];
union wtap_pseudo_header phdr;
guint8 pd[WTAP_MAX_PACKET_SIZE];
- int err;
- gchar *err_info;
double cur_time;
/* Load the frame from the capture file */
double cur_time;
/* Load the frame from the capture file */
- if (!wtap_seek_read(cfile.wth, frame->file_off, &phdr, pd,
- frame->cap_len, &err, &err_info)) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
- cf_read_error_message(err, err_info), cfile.filename);
+ if (!cf_read_frame_r(&cfile, frame, &phdr, pd))
return FALSE; /* failure */
return FALSE; /* failure */
- }
/* Dissect the frame tree not visible */
/* Dissect the frame tree not visible */
- edt = epan_dissect_new(TRUE, FALSE);
- epan_dissect_run(edt, &phdr, pd, frame, cinfo);
+ epan_dissect_init(&edt, TRUE, FALSE);
+ /* Don't fake protocols. We need them for the protocol hierarchy */
+ epan_dissect_fake_protocols(&edt, FALSE);
+ epan_dissect_run(&edt, &phdr, pd, frame, cinfo);
/* Get stats from this protocol tree */
/* Get stats from this protocol tree */
- process_tree(edt
->
tree, ps, frame->pkt_len);
+ process_tree(edt
.
tree, ps, frame->pkt_len);
/* Update times */
cur_time = nstime_to_sec(&frame->abs_ts);
/* Update times */
cur_time = nstime_to_sec(&frame->abs_ts);
@@
-170,7
+168,7
@@
process_frame(frame_data *frame, column_info *cinfo, ph_stats_t* ps)
}
/* Free our memory. */
}
/* Free our memory. */
- epan_dissect_
free(
edt);
+ epan_dissect_
cleanup(&
edt);
return TRUE; /* success */
}
return TRUE; /* success */
}
@@
-197,7
+195,6
@@
ph_stats_new(void)
ps->stats_tree = g_node_new(NULL);
ps->first_time = 0.0;
ps->last_time = 0.0;
ps->stats_tree = g_node_new(NULL);
ps->first_time = 0.0;
ps->last_time = 0.0;
- ps->dfilter = cfile.dfilter;
/* Update the progress bar when it gets to this value. */
progbar_nextstep = 0;
/* Update the progress bar when it gets to this value. */
progbar_nextstep = 0;
@@
-207,7
+204,7
@@
ph_stats_new(void)
/* Count of packets at which we've looked. */
count = 0;
/* Progress so far. */
/* Count of packets at which we've looked. */
count = 0;
/* Progress so far. */
- progbar_val = 0.0;
+ progbar_val = 0.0
f
;
stop_flag = FALSE;
g_get_current_time(&start_time);
stop_flag = FALSE;
g_get_current_time(&start_time);
@@
-215,7
+212,7
@@
ph_stats_new(void)
tot_packets = 0;
tot_bytes = 0;
tot_packets = 0;
tot_bytes = 0;
- for (frame = cfile.plist; frame != NULL; frame = frame->next) {
+ for (frame = cfile.plist
_start
; frame != NULL; frame = frame->next) {
/* Create the progress bar if necessary.
We check on every iteration of the loop, so that
it takes no longer than the standard time to create
/* Create the progress bar if necessary.
We check on every iteration of the loop, so that
it takes no longer than the standard time to create
@@
-224,7
+221,7
@@
ph_stats_new(void)
to get to the next progress bar step). */
if (progbar == NULL)
progbar = delayed_create_progress_dlg(
to get to the next progress bar step). */
if (progbar == NULL)
progbar = delayed_create_progress_dlg(
- "Computing", "protocol hierarchy statistics",
+ "Computing", "protocol hierarchy statistics",
TRUE, &stop_flag, &start_time, progbar_val);
/* Update the progress bar, but do it only N_PROGBAR_UPDATES
TRUE, &stop_flag, &start_time, progbar_val);
/* Update the progress bar, but do it only N_PROGBAR_UPDATES
@@
-268,7
+265,7
@@
ph_stats_new(void)
ps->first_time = cur_time;
ps->last_time = cur_time;
}
ps->first_time = cur_time;
ps->last_time = cur_time;
}
-
+
/* we don't care about colinfo */
if (!process_frame(frame, NULL, ps)) {
/*
/* we don't care about colinfo */
if (!process_frame(frame, NULL, ps)) {
/*
@@
-311,7
+308,7
@@
ph_stats_new(void)
static gboolean
stat_node_free(GNode *node, gpointer data _U_)
{
static gboolean
stat_node_free(GNode *node, gpointer data _U_)
{
- ph_stats_node_t *stats = node->data;
+ ph_stats_node_t *stats =
(ph_stats_node_t *)
node->data;
if (stats) {
g_free(stats);
if (stats) {
g_free(stats);