Move the parts of a capture_file used by libwireshark to a new structure.

Embed one of those structures in a capture_file, and have a struct
epan_session point to that structure rather than to a capture_file.
Pass that structure to the routines that fetch data that libwireshark
uses when dissecting.

That separates the stuff that libwireshark expects from the stuff that
it doesn't look at.

Change-Id: Ia3cd28efb9622476437a2ce32204597fae720877
Reviewed-on: https://code.wireshark.org/review/24692
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2017-12-03 21:01:18 -08:00
parent 02944c412b
commit 1834dca365
29 changed files with 450 additions and 417 deletions

View File

@ -16,6 +16,7 @@
#include <epan/dfilter/dfilter.h>
#include <epan/frame_data.h>
#include <epan/frame_data_sequence.h>
#include <epan/frame_set.h>
#include <wiretap/wtap.h>
#ifdef __cplusplus
@ -47,7 +48,6 @@ struct _capture_file {
guint32 drops; /* Dropped packets */
nstime_t elapsed_time; /* Elapsed time */
int snap; /* Maximum captured packet length; 0 if unknown */
wtap *wth; /* Wiretap session */
dfilter_t *rfcode; /* Compiled read filter program */
dfilter_t *dfcode; /* Compiled display filter program */
gchar *dfilter; /* Display filter string */
@ -70,7 +70,7 @@ struct _capture_file {
struct wtap_pkthdr phdr; /* Packet header */
Buffer buf; /* Packet data */
/* frames */
frame_data_sequence *frames; /* Sequence of frames, if we're keeping that information */
frame_set frame_set_info; /* fjfff */
guint32 first_displayed; /* Frame number of first frame displayed */
guint32 last_displayed; /* Frame number of last frame displayed */
column_info cinfo; /* Column formatting information */
@ -80,13 +80,9 @@ struct _capture_file {
epan_dissect_t *edt; /* Protocol dissection for currently selected packet */
field_info *finfo_selected; /* Field info for currently selected field */
gpointer window; /* Top-level window associated with file */
GTree *frames_user_comments; /* BST with user comments for frames (key = frame_data) */
gulong computed_elapsed; /* Elapsed time to load the file (in msec). */
guint32 cum_bytes;
const frame_data *ref;
frame_data *prev_dis;
frame_data *prev_cap;
};
#ifdef __cplusplus

44
cfile.c
View File

@ -19,50 +19,6 @@
#include "cfile.h"
#include "cfile-int.h"
const char *
cap_file_get_interface_name(capture_file *cf, guint32 interface_id)
{
wtapng_iface_descriptions_t *idb_info;
wtap_block_t wtapng_if_descr = NULL;
char* interface_name;
idb_info = wtap_file_get_idb_info(cf->wth);
if (interface_id < idb_info->interface_data->len)
wtapng_if_descr = g_array_index(idb_info->interface_data, wtap_block_t, interface_id);
g_free(idb_info);
if (wtapng_if_descr) {
if (wtap_block_get_string_option_value(wtapng_if_descr, OPT_IDB_NAME, &interface_name) == WTAP_OPTTYPE_SUCCESS)
return interface_name;
if (wtap_block_get_string_option_value(wtapng_if_descr, OPT_IDB_DESCR, &interface_name) == WTAP_OPTTYPE_SUCCESS)
return interface_name;
}
return "unknown";
}
const char *
cap_file_get_interface_description(capture_file *cf, guint32 interface_id)
{
wtapng_iface_descriptions_t *idb_info;
wtap_block_t wtapng_if_descr = NULL;
char* interface_name;
idb_info = wtap_file_get_idb_info(cf->wth);
if (interface_id < idb_info->interface_data->len)
wtapng_if_descr = g_array_index(idb_info->interface_data, wtap_block_t, interface_id);
g_free(idb_info);
if (wtapng_if_descr) {
if (wtap_block_get_string_option_value(wtapng_if_descr, OPT_IDB_DESCR, &interface_name) == WTAP_OPTTYPE_SUCCESS)
return interface_name;
}
return NULL;
}
void
cap_file_init(capture_file *cf)
{

View File

@ -43,9 +43,6 @@ typedef struct _capture_file capture_file;
extern void cap_file_init(capture_file *cf);
extern const char *cap_file_get_interface_name(capture_file *cf, guint32 interface_id);
extern const char *cap_file_get_interface_description(capture_file *cf, guint32 interface_id);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -99,11 +99,11 @@ set(LIBWIRESHARK_PUBLIC_HEADERS
expert.h
export_object.h
exported_pdu.h
plugin_if.h
filter_expressions.h
follow.h
frame_data.h
frame_data_sequence.h
frame_set.h
funnel.h
garrayfix.h
geoip_db.h
@ -127,6 +127,7 @@ set(LIBWIRESHARK_PUBLIC_HEADERS
packet.h
packet_info.h
params.h
plugin_if.h
ppptypes.h
print.h
print_stream.h
@ -203,11 +204,11 @@ set(LIBWIRESHARK_FILES
expert.c
export_object.c
exported_pdu.c
plugin_if.c
filter_expressions.c
follow.c
frame_data.c
frame_data_sequence.c
frame_set.c
funnel.c
geoip_db.c
golay.c
@ -220,6 +221,7 @@ set(LIBWIRESHARK_FILES
oids.c
osi-utils.c
packet.c
plugin_if.c
print.c
print_stream.c
prefs.c

View File

@ -67,11 +67,11 @@ LIBWIRESHARK_SRC = \
expert.c \
export_object.c \
exported_pdu.c \
plugin_if.c \
filter_expressions.c \
follow.c \
frame_data.c \
frame_data_sequence.c \
frame_set.c \
funnel.c \
geoip_db.c \
golay.c \
@ -84,6 +84,7 @@ LIBWIRESHARK_SRC = \
oids.c \
osi-utils.c \
packet.c \
plugin_if.c \
prefs.c \
print.c \
print_stream.c \
@ -207,11 +208,11 @@ LIBWIRESHARK_INCLUDES_PUBLIC = \
expert.h \
export_object.h \
exported_pdu.h \
plugin_if.h \
filter_expressions.h \
follow.h \
frame_data.h \
frame_data_sequence.h \
frame_set.h \
funnel.h \
garrayfix.h \
geoip_db.h \
@ -235,6 +236,7 @@ LIBWIRESHARK_INCLUDES_PUBLIC = \
packet.h \
packet_info.h \
params.h \
plugin_if.h \
ppptypes.h \
print.h \
print_stream.h \

View File

@ -23,25 +23,16 @@
#define __EPAN_INT_H__
#include <epan/frame_data.h>
#include <epan/frame_set.h>
#include <wsutil/nstime.h>
/*
* XXX - this isn't part of libwireshark; using it in the API indicates
* that perhaps it should be, in some fashion.
*
* Whether the structure definition of a capture_file should be part
* of libwireshark, or part of the code that uses libwireshark, is
* another matter.
*/
#include "cfile.h"
struct epan_session {
capture_file *cf;
frame_set *fs;
const nstime_t *(*get_frame_ts)(capture_file *cf, guint32 frame_num);
const char *(*get_interface_name)(capture_file *cf, guint32 interface_id);
const char *(*get_interface_description)(capture_file *cf, guint32 interface_id);
const char *(*get_user_comment)(capture_file *cf, const frame_data *fd);
const nstime_t *(*get_frame_ts)(frame_set *cf, guint32 frame_num);
const char *(*get_interface_name)(frame_set *fs, guint32 interface_id);
const char *(*get_interface_description)(frame_set *fs, guint32 interface_id);
const char *(*get_user_comment)(frame_set *fs, const frame_data *fd);
};
#endif

View File

@ -298,7 +298,7 @@ const char *
epan_get_user_comment(const epan_t *session, const frame_data *fd)
{
if (session->get_user_comment)
return session->get_user_comment(session->cf, fd);
return session->get_user_comment(session->fs, fd);
return NULL;
}
@ -307,7 +307,7 @@ const char *
epan_get_interface_name(const epan_t *session, guint32 interface_id)
{
if (session->get_interface_name)
return session->get_interface_name(session->cf, interface_id);
return session->get_interface_name(session->fs, interface_id);
return NULL;
}
@ -316,7 +316,7 @@ const char *
epan_get_interface_description(const epan_t *session, guint32 interface_id)
{
if (session->get_interface_description)
return session->get_interface_description(session->cf, interface_id);
return session->get_interface_description(session->fs, interface_id);
return NULL;
}
@ -327,7 +327,7 @@ epan_get_frame_ts(const epan_t *session, guint32 frame_num)
const nstime_t *abs_ts = NULL;
if (session->get_frame_ts)
abs_ts = session->get_frame_ts(session->cf, frame_num);
abs_ts = session->get_frame_ts(session->fs, frame_num);
if (!abs_ts)
ws_g_warning("!!! couldn't get frame ts for %u !!!\n", frame_num);

57
epan/frame_set.c Normal file
View File

@ -0,0 +1,57 @@
/* frame_set.c
* fdfdkfslf;ajkdf
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <glib.h>
#include <epan/frame_set.h>
const char *
frame_set_get_interface_name(frame_set *fs, guint32 interface_id)
{
wtapng_iface_descriptions_t *idb_info;
wtap_block_t wtapng_if_descr = NULL;
char* interface_name;
idb_info = wtap_file_get_idb_info(fs->wth);
if (interface_id < idb_info->interface_data->len)
wtapng_if_descr = g_array_index(idb_info->interface_data, wtap_block_t, interface_id);
g_free(idb_info);
if (wtapng_if_descr) {
if (wtap_block_get_string_option_value(wtapng_if_descr, OPT_IDB_NAME, &interface_name) == WTAP_OPTTYPE_SUCCESS)
return interface_name;
if (wtap_block_get_string_option_value(wtapng_if_descr, OPT_IDB_DESCR, &interface_name) == WTAP_OPTTYPE_SUCCESS)
return interface_name;
}
return "unknown";
}
const char *
frame_set_get_interface_description(frame_set *fs, guint32 interface_id)
{
wtapng_iface_descriptions_t *idb_info;
wtap_block_t wtapng_if_descr = NULL;
char* interface_name;
idb_info = wtap_file_get_idb_info(fs->wth);
if (interface_id < idb_info->interface_data->len)
wtapng_if_descr = g_array_index(idb_info->interface_data, wtap_block_t, interface_id);
g_free(idb_info);
if (wtapng_if_descr) {
if (wtap_block_get_string_option_value(wtapng_if_descr, OPT_IDB_DESCR, &interface_name) == WTAP_OPTTYPE_SUCCESS)
return interface_name;
}
return NULL;
}

32
epan/frame_set.h Normal file
View File

@ -0,0 +1,32 @@
/* frame_set.h
* Definition of frame_set structure. It holds information about a
* fdfdkfslf;ajkdf
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef __EPAN_FRAME_SET_H__
#define __EPAN_FRAME_SET_H__
#include <epan/frame_data.h>
#include <epan/frame_data_sequence.h>
#include "ws_symbol_export.h"
typedef struct {
wtap *wth; /* Wiretap session */
const frame_data *ref;
frame_data *prev_dis;
frame_data *prev_cap;
frame_data_sequence *frames; /* Sequence of frames, if we're keeping that information */
GTree *frames_user_comments; /* BST with user comments for frames (key = frame_data) */
} frame_set;
WS_DLL_PUBLIC const char *frame_set_get_interface_name(frame_set *fs, guint32 interface_id);
WS_DLL_PUBLIC const char *frame_set_get_interface_description(frame_set *fs, guint32 interface_id);
#endif /* frame_set.h */

228
file.c
View File

@ -112,7 +112,7 @@ static gboolean find_packet(capture_file *cf,
match_result (*match_function)(capture_file *, frame_data *, void *),
void *criterion, search_direction dir);
static const char *cf_get_user_packet_comment(capture_file *cf, const frame_data *fd);
static const char *cf_get_user_packet_comment(frame_set *fs, const frame_data *fd);
static void cf_rename_failure_alert_box(const char *filename, int err);
static void ref_time_packets(capture_file *cf);
@ -226,16 +226,16 @@ static void compute_elapsed(capture_file *cf, GTimeVal *start_time)
}
static const nstime_t *
ws_get_frame_ts(capture_file *cf, guint32 frame_num)
ws_get_frame_ts(frame_set *fs, guint32 frame_num)
{
if (cf->prev_dis && cf->prev_dis->num == frame_num)
return &cf->prev_dis->abs_ts;
if (fs->prev_dis && fs->prev_dis->num == frame_num)
return &fs->prev_dis->abs_ts;
if (cf->prev_cap && cf->prev_cap->num == frame_num)
return &cf->prev_cap->abs_ts;
if (fs->prev_cap && fs->prev_cap->num == frame_num)
return &fs->prev_cap->abs_ts;
if (cf->frames) {
frame_data *fd = frame_data_sequence_find(cf->frames, frame_num);
if (fs->frames) {
frame_data *fd = frame_data_sequence_find(fs->frames, frame_num);
return (fd) ? &fd->abs_ts : NULL;
}
@ -244,9 +244,9 @@ ws_get_frame_ts(capture_file *cf, guint32 frame_num)
}
static const char *
ws_get_user_comment(capture_file *cf, const frame_data *fd)
ws_get_user_comment(frame_set *fs, const frame_data *fd)
{
return cf_get_user_packet_comment(cf, fd);
return cf_get_user_packet_comment(fs, fd);
}
static epan_t *
@ -254,10 +254,10 @@ ws_epan_new(capture_file *cf)
{
epan_t *epan = epan_new();
epan->cf = cf;
epan->fs = &cf->frame_set_info;
epan->get_frame_ts = ws_get_frame_ts;
epan->get_interface_name = cap_file_get_interface_name;
epan->get_interface_description = cap_file_get_interface_description;
epan->get_interface_name = frame_set_get_interface_name;
epan->get_interface_description = frame_set_get_interface_description;
epan->get_user_comment = ws_get_user_comment;
return epan;
@ -292,7 +292,7 @@ cf_open(capture_file *cf, const char *fname, unsigned int type, gboolean is_temp
/* We're about to start reading the file. */
cf->state = FILE_READ_IN_PROGRESS;
cf->wth = wth;
cf->frame_set_info.wth = wth;
cf->f_datalen = 0;
/* Set the file name because we need it to set the follow stream filter.
@ -308,7 +308,7 @@ cf_open(capture_file *cf, const char *fname, unsigned int type, gboolean is_temp
cf->computed_elapsed = 0;
cf->cd_t = wtap_file_type_subtype(cf->wth);
cf->cd_t = wtap_file_type_subtype(cf->frame_set_info.wth);
cf->open_type = type;
cf->linktypes = g_array_sized_new(FALSE, FALSE, (guint) sizeof(int), 1);
cf->count = 0;
@ -319,15 +319,15 @@ cf_open(capture_file *cf, const char *fname, unsigned int type, gboolean is_temp
cf->ref_time_count = 0;
cf->drops_known = FALSE;
cf->drops = 0;
cf->snap = wtap_snapshot_length(cf->wth);
cf->snap = wtap_snapshot_length(cf->frame_set_info.wth);
/* Allocate a frame_data_sequence for the frames in this file */
cf->frames = new_frame_data_sequence();
cf->frame_set_info.frames = new_frame_data_sequence();
nstime_set_zero(&cf->elapsed_time);
cf->ref = NULL;
cf->prev_dis = NULL;
cf->prev_cap = NULL;
cf->frame_set_info.ref = NULL;
cf->frame_set_info.prev_dis = NULL;
cf->frame_set_info.prev_cap = NULL;
cf->cum_bytes = 0;
packet_list_queue_draw();
@ -338,8 +338,8 @@ cf_open(capture_file *cf, const char *fname, unsigned int type, gboolean is_temp
ber_set_filename(cf->filename);
}
wtap_set_cb_new_ipv4(cf->wth, add_ipv4_name);
wtap_set_cb_new_ipv6(cf->wth, (wtap_new_ipv6_callback_t) add_ipv6_name);
wtap_set_cb_new_ipv4(cf->frame_set_info.wth, add_ipv4_name);
wtap_set_cb_new_ipv6(cf->frame_set_info.wth, (wtap_new_ipv6_callback_t) add_ipv6_name);
return CF_OK;
@ -380,9 +380,9 @@ cf_close(capture_file *cf)
/* close things, if not already closed before */
color_filters_cleanup();
if (cf->wth) {
wtap_close(cf->wth);
cf->wth = NULL;
if (cf->frame_set_info.wth) {
wtap_close(cf->frame_set_info.wth);
cf->frame_set_info.wth = NULL;
}
/* We have no file open... */
if (cf->filename != NULL) {
@ -406,13 +406,13 @@ cf_close(capture_file *cf)
dfilter_free(cf->rfcode);
cf->rfcode = NULL;
if (cf->frames != NULL) {
free_frame_data_sequence(cf->frames);
cf->frames = NULL;
if (cf->frame_set_info.frames != NULL) {
free_frame_data_sequence(cf->frame_set_info.frames);
cf->frame_set_info.frames = NULL;
}
if (cf->frames_user_comments) {
g_tree_destroy(cf->frames_user_comments);
cf->frames_user_comments = NULL;
if (cf->frame_set_info.frames_user_comments) {
g_tree_destroy(cf->frame_set_info.frames_user_comments);
cf->frame_set_info.frames_user_comments = NULL;
}
cf_unselect_packet(cf); /* nothing to select */
cf->first_displayed = 0;
@ -478,7 +478,7 @@ calc_progbar_val(capture_file *cf, gint64 size, gint64 file_pos, gchar *status_s
/* The file probably grew while we were reading it.
* Update file size, and try again.
*/
size = wtap_file_size(cf->wth, NULL);
size = wtap_file_size(cf->frame_set_info.wth, NULL);
if (size >= 0)
progbar_val = (gfloat) file_pos / (gfloat) size;
@ -553,7 +553,7 @@ cf_read(capture_file *cf, gboolean reloading)
/* Record whether the file is compressed.
XXX - do we know this at open time? */
cf->iscompressed = wtap_iscompressed(cf->wth);
cf->iscompressed = wtap_iscompressed(cf->frame_set_info.wth);
/* The packet list window will be empty until the file is completly loaded */
packet_list_freeze();
@ -579,14 +579,14 @@ cf_read(capture_file *cf, gboolean reloading)
cinfo = (tap_flags & TL_REQUIRES_COLUMNS) ? &cf->cinfo : NULL;
/* Find the size of the file. */
size = wtap_file_size(cf->wth, NULL);
size = wtap_file_size(cf->frame_set_info.wth, NULL);
g_timer_start(prog_timer);
while ((wtap_read(cf->wth, &err, &err_info, &data_offset))) {
while ((wtap_read(cf->frame_set_info.wth, &err, &err_info, &data_offset))) {
if (size >= 0) {
count++;
file_pos = wtap_read_so_far(cf->wth);
file_pos = wtap_read_so_far(cf->frame_set_info.wth);
/* Create the progress bar if necessary. */
if (progress_is_slow(progbar, prog_timer, size, file_pos)) {
@ -666,7 +666,7 @@ cf_read(capture_file *cf, gboolean reloading)
cf->state = FILE_READ_DONE;
/* Close the sequential I/O side, to free up memory it requires. */
wtap_sequential_close(cf->wth);
wtap_sequential_close(cf->frame_set_info.wth);
/* Allow the protocol dissectors to free up memory that they
* don't need after the sequential run-through of the packets. */
@ -679,9 +679,9 @@ cf_read(capture_file *cf, gboolean reloading)
we've looked at all the packets, as we don't know until then whether
there's more than one type (and thus whether it's
WTAP_ENCAP_PER_PACKET). */
cf->lnk_t = wtap_file_encap(cf->wth);
cf->lnk_t = wtap_file_encap(cf->frame_set_info.wth);
cf->current_frame = frame_data_sequence_find(cf->frames, cf->first_displayed);
cf->current_frame = frame_data_sequence_find(cf->frame_set_info.frames, cf->first_displayed);
cf->current_row = 0;
packet_list_thaw();
@ -783,8 +783,8 @@ cf_continue_tail(capture_file *cf, volatile int to_read, int *err)
cinfo = (tap_flags & TL_REQUIRES_COLUMNS) ? &cf->cinfo : NULL;
while (to_read != 0) {
wtap_cleareof(cf->wth);
if (!wtap_read(cf->wth, err, &err_info, &data_offset)) {
wtap_cleareof(cf->frame_set_info.wth);
if (!wtap_read(cf->frame_set_info.wth, err, &err_info, &data_offset)) {
break;
}
if (cf->state == FILE_READ_ABORTED) {
@ -816,7 +816,7 @@ cf_continue_tail(capture_file *cf, volatile int to_read, int *err)
/* Update the file encapsulation; it might have changed based on the
packets we've read. */
cf->lnk_t = wtap_file_encap(cf->wth);
cf->lnk_t = wtap_file_encap(cf->frame_set_info.wth);
/* Cleanup and release all dfilter resources */
dfilter_free(dfcode);
@ -909,7 +909,7 @@ cf_finish_tail(capture_file *cf, int *err)
(dfcode != NULL || have_filtering_tap_listeners() ||
(tap_flags & TL_REQUIRES_PROTO_TREE) || postdissectors_want_hfids());
if (cf->wth == NULL) {
if (cf->frame_set_info.wth == NULL) {
cf_close(cf);
return CF_READ_ERROR;
}
@ -920,7 +920,7 @@ cf_finish_tail(capture_file *cf, int *err)
epan_dissect_init(&edt, cf->epan, create_proto_tree, FALSE);
while ((wtap_read(cf->wth, err, &err_info, &data_offset))) {
while ((wtap_read(cf->frame_set_info.wth, err, &err_info, &data_offset))) {
if (cf->state == FILE_READ_ABORTED) {
/* Well, the user decided to abort the read. Break out of the
loop, and let the code below (which is called even if there
@ -956,7 +956,7 @@ cf_finish_tail(capture_file *cf, int *err)
/* We're done reading sequentially through the file; close the
sequential I/O side, to free up memory it requires. */
wtap_sequential_close(cf->wth);
wtap_sequential_close(cf->frame_set_info.wth);
/* Allow the protocol dissectors to free up memory that they
* don't need after the sequential run-through of the packets. */
@ -964,7 +964,7 @@ cf_finish_tail(capture_file *cf, int *err)
/* Update the file encapsulation; it might have changed based on the
packets we've read. */
cf->lnk_t = wtap_file_encap(cf->wth);
cf->lnk_t = wtap_file_encap(cf->frame_set_info.wth);
/* Update the details in the file-set dialog, as the capture file
* has likely grown since we first stat-ed it */
@ -1091,8 +1091,8 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
gint row = -1;
frame_data_set_before_dissect(fdata, &cf->elapsed_time,
&cf->ref, cf->prev_dis);
cf->prev_cap = fdata;
&cf->frame_set_info.ref, cf->frame_set_info.prev_dis);
cf->frame_set_info.prev_cap = fdata;
if (dfcode != NULL) {
epan_dissect_prime_with_dfilter(edt, dfcode);
@ -1125,7 +1125,7 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
* (potentially not displayed) frames. Find those frames and mark them
* as depended upon.
*/
g_slist_foreach(edt->pi.dependent_frames, find_and_mark_frame_depended_upon, cf->frames);
g_slist_foreach(edt->pi.dependent_frames, find_and_mark_frame_depended_upon, cf->frame_set_info.frames);
}
} else
fdata->flags.passed_dfilter = 1;
@ -1141,7 +1141,7 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
if (fdata->flags.passed_dfilter || fdata->flags.ref_time)
{
frame_data_set_after_dissect(fdata, &cf->cum_bytes);
cf->prev_dis = fdata;
cf->frame_set_info.prev_dis = fdata;
/* If we haven't yet seen the first frame, this is it. */
if (cf->first_displayed == 0)
@ -1161,8 +1161,8 @@ static int
read_packet(capture_file *cf, dfilter_t *dfcode, epan_dissect_t *edt,
column_info *cinfo, gint64 offset)
{
struct wtap_pkthdr *phdr = wtap_phdr(cf->wth);
const guint8 *buf = wtap_buf_ptr(cf->wth);
struct wtap_pkthdr *phdr = wtap_phdr(cf->frame_set_info.wth);
const guint8 *buf = wtap_buf_ptr(cf->frame_set_info.wth);
frame_data fdlocal;
guint32 framenum;
frame_data *fdata;
@ -1195,7 +1195,7 @@ read_packet(capture_file *cf, dfilter_t *dfcode, epan_dissect_t *edt,
if (passed) {
/* This does a shallow copy of fdlocal, which is good enough. */
fdata = frame_data_sequence_add(cf->frames, &fdlocal);
fdata = frame_data_sequence_add(cf->frame_set_info.frames, &fdlocal);
cf->count++;
if (phdr->opt_comment != NULL)
@ -1488,7 +1488,7 @@ cf_read_record_r(capture_file *cf, const frame_data *fdata,
int err;
gchar *err_info;
if (!wtap_seek_read(cf->wth, fdata->file_off, phdr, buf, &err, &err_info)) {
if (!wtap_seek_read(cf->frame_set_info.wth, fdata->file_off, phdr, buf, &err, &err_info)) {
cfile_read_failure_alert_box(cf->filename, err, err_info);
return FALSE;
}
@ -1625,9 +1625,9 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item, gb
/* Iterate through the list of frames. Call a routine for each frame
to check whether it should be displayed and, if so, add it to
the display list. */
cf->ref = NULL;
cf->prev_dis = NULL;
cf->prev_cap = NULL;
cf->frame_set_info.ref = NULL;
cf->frame_set_info.prev_dis = NULL;
cf->frame_set_info.prev_cap = NULL;
cf->cum_bytes = 0;
cf_callback_invoke(cf_cb_file_rescan_started, cf);
@ -1657,7 +1657,7 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item, gb
epan_dissect_init(&edt, cf->epan, create_proto_tree, FALSE);
for (framenum = 1; framenum <= frames_count; framenum++) {
fdata = frame_data_sequence_find(cf->frames, framenum);
fdata = frame_data_sequence_find(cf->frame_set_info.frames, framenum);
/* Create the progress bar if necessary.
We check on every iteration of the loop, so that it takes no
@ -1775,7 +1775,7 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item, gb
would leave the user stuck with an Wireshark grinding on
until it finishes. Should we just stick them with that? */
for (; framenum <= frames_count; framenum++) {
fdata = frame_data_sequence_find(cf->frames, framenum);
fdata = frame_data_sequence_find(cf->frame_set_info.frames, framenum);
frame_data_reset(fdata);
}
}
@ -1873,12 +1873,12 @@ ref_time_packets(capture_file *cf)
frame_data *fdata;
nstime_t rel_ts;
cf->ref = NULL;
cf->prev_dis = NULL;
cf->frame_set_info.ref = NULL;
cf->frame_set_info.prev_dis = NULL;
cf->cum_bytes = 0;
for (framenum = 1; framenum <= cf->count; framenum++) {
fdata = frame_data_sequence_find(cf->frames, framenum);
fdata = frame_data_sequence_find(cf->frame_set_info.frames, framenum);
/* just add some value here until we know if it is being displayed or not */
fdata->cum_bytes = cf->cum_bytes + fdata->pkt_len;
@ -1890,24 +1890,24 @@ ref_time_packets(capture_file *cf)
/* If we don't have the time stamp of the first packet in the
capture, it's because this is the first packet. Save the time
stamp of this packet as the time stamp of the first packet. */
if (cf->ref == NULL)
cf->ref = fdata;
if (cf->frame_set_info.ref == NULL)
cf->frame_set_info.ref = fdata;
/* if this frames is marked as a reference time frame, reset
firstsec and firstusec to this frame */
if (fdata->flags.ref_time)
cf->ref = fdata;
cf->frame_set_info.ref = fdata;
/* If we don't have the time stamp of the previous displayed packet,
it's because this is the first displayed packet. Save the time
stamp of this packet as the time stamp of the previous displayed
packet. */
if (cf->prev_dis == NULL) {
cf->prev_dis = fdata;
if (cf->frame_set_info.prev_dis == NULL) {
cf->frame_set_info.prev_dis = fdata;
}
/* Get the time elapsed between the first packet and this packet. */
fdata->frame_ref_num = (fdata != cf->ref) ? cf->ref->num : 0;
nstime_delta(&rel_ts, &fdata->abs_ts, &cf->ref->abs_ts);
fdata->frame_ref_num = (fdata != cf->frame_set_info.ref) ? cf->frame_set_info.ref->num : 0;
nstime_delta(&rel_ts, &fdata->abs_ts, &cf->frame_set_info.ref->abs_ts);
/* If it's greater than the current elapsed time, set the elapsed time
to it (we check for "greater than" so as not to be confused by
@ -1920,8 +1920,8 @@ ref_time_packets(capture_file *cf)
/* If this frame is displayed, get the time elapsed between the
previous displayed packet and this packet. */
if ( fdata->flags.passed_dfilter ) {
fdata->prev_dis_num = cf->prev_dis->num;
cf->prev_dis = fdata;
fdata->prev_dis_num = cf->frame_set_info.prev_dis->num;
cf->frame_set_info.prev_dis = fdata;
}
/*
@ -1989,7 +1989,7 @@ process_specified_records(capture_file *cf, packet_range_t *range,
/* Iterate through all the packets, printing the packets that
were selected by the current display filter. */
for (framenum = 1; framenum <= cf->count; framenum++) {
fdata = frame_data_sequence_find(cf->frames, framenum);
fdata = frame_data_sequence_find(cf->frame_set_info.frames, framenum);
/* Create the progress bar if necessary.
We check on every iteration of the loop, so that it takes no
@ -3514,7 +3514,7 @@ find_packet(capture_file *cf,
} else
framenum++;
}
fdata = frame_data_sequence_find(cf->frames, framenum);
fdata = frame_data_sequence_find(cf->frame_set_info.frames, framenum);
count++;
@ -3574,13 +3574,13 @@ cf_goto_frame(capture_file *cf, guint fnumber)
{
frame_data *fdata;
if (cf == NULL || cf->frames == NULL) {
if (cf == NULL || cf->frame_set_info.frames == NULL) {
/* we don't have a loaded capture file - fix for bugs 11810 & 11989 */
statusbar_push_temporary_msg("There is no file loaded");
return FALSE; /* we failed to go to that packet */
}
fdata = frame_data_sequence_find(cf->frames, fnumber);
fdata = frame_data_sequence_find(cf->frame_set_info.frames, fnumber);
if (fdata == NULL) {
/* we didn't find a packet with that packet number */
@ -3763,7 +3763,7 @@ cf_read_section_comment(capture_file *cf)
/* Get the SHB. */
/* XXX - support multiple SHBs */
shb_inf = wtap_file_get_shb(cf->wth);
shb_inf = wtap_file_get_shb(cf->frame_set_info.wth);
/* Get the first comment from the SHB. */
/* XXX - support multiple comments */
@ -3783,7 +3783,7 @@ cf_update_section_comment(capture_file *cf, gchar *comment)
/* Get the SHB. */
/* XXX - support multiple SHBs */
shb_inf = wtap_file_get_shb(cf->wth);
shb_inf = wtap_file_get_shb(cf->frame_set_info.wth);
/* Get the first comment from the SHB. */
/* XXX - support multiple comments */
@ -3805,10 +3805,10 @@ cf_update_section_comment(capture_file *cf, gchar *comment)
}
static const char *
cf_get_user_packet_comment(capture_file *cf, const frame_data *fd)
cf_get_user_packet_comment(frame_set *fs, const frame_data *fd)
{
if (cf->frames_user_comments)
return (const char *)g_tree_lookup(cf->frames_user_comments, fd);
if (fs->frames_user_comments)
return (const char *)g_tree_lookup(fs->frames_user_comments, fd);
/* g_warning? */
return NULL;
@ -3826,7 +3826,7 @@ cf_get_packet_comment(capture_file *cf, const frame_data *fd)
/* fetch user comment */
if (fd->flags.has_user_comment)
return g_strdup(cf_get_user_packet_comment(cf, fd));
return g_strdup(cf_get_user_packet_comment(&cf->frame_set_info, fd));
/* fetch phdr comment */
if (fd->flags.has_phdr_comment) {
@ -3881,11 +3881,11 @@ cf_set_user_packet_comment(capture_file *cf, frame_data *fd, const gchar *new_co
fd->flags.has_user_comment = TRUE;
if (!cf->frames_user_comments)
cf->frames_user_comments = g_tree_new_full(frame_cmp, NULL, NULL, g_free);
if (!cf->frame_set_info.frames_user_comments)
cf->frame_set_info.frames_user_comments = g_tree_new_full(frame_cmp, NULL, NULL, g_free);
/* insert new packet comment */
g_tree_replace(cf->frames_user_comments, fd, g_strdup(new_comment));
g_tree_replace(cf->frame_set_info.frames_user_comments, fd, g_strdup(new_comment));
expert_update_comment_count(cf->packet_comment_count);
@ -3952,7 +3952,7 @@ save_record(capture_file *cf, frame_data *fdata,
const char *pkt_comment;
if (fdata->flags.has_user_comment)
pkt_comment = cf_get_user_packet_comment(cf, fdata);
pkt_comment = cf_get_user_packet_comment(&cf->frame_set_info, fdata);
else
pkt_comment = phdr->opt_comment;
@ -4132,7 +4132,7 @@ rescan_file(capture_file *cf, const char *fname, gboolean is_tempfile)
int count = 0;
/* Close the old handle. */
wtap_close(cf->wth);
wtap_close(cf->frame_set_info.wth);
/* Open the new file. */
/* XXX: this will go through all open_routines for a matching one. But right
@ -4140,8 +4140,8 @@ rescan_file(capture_file *cf, const char *fname, gboolean is_tempfile)
format than the original, and the user is not given a choice of which
reader to use (only which format to save it in), so doing this makes
sense for now. */
cf->wth = wtap_open_offline(fname, WTAP_TYPE_AUTO, &err, &err_info, TRUE);
if (cf->wth == NULL) {
cf->frame_set_info.wth = wtap_open_offline(fname, WTAP_TYPE_AUTO, &err, &err_info, TRUE);
if (cf->frame_set_info.wth == NULL) {
cfile_open_failure_alert_box(fname, err, err_info);
return CF_READ_ERROR;
}
@ -4161,10 +4161,10 @@ rescan_file(capture_file *cf, const char *fname, gboolean is_tempfile)
/* No user changes yet. */
cf->unsaved_changes = FALSE;
cf->cd_t = wtap_file_type_subtype(cf->wth);
cf->cd_t = wtap_file_type_subtype(cf->frame_set_info.wth);
cf->linktypes = g_array_sized_new(FALSE, FALSE, (guint) sizeof(int), 1);
cf->snap = wtap_snapshot_length(cf->wth);
cf->snap = wtap_snapshot_length(cf->frame_set_info.wth);
name_ptr = g_filename_display_basename(cf->filename);
@ -4172,10 +4172,10 @@ rescan_file(capture_file *cf, const char *fname, gboolean is_tempfile)
/* Record whether the file is compressed.
XXX - do we know this at open time? */
cf->iscompressed = wtap_iscompressed(cf->wth);
cf->iscompressed = wtap_iscompressed(cf->frame_set_info.wth);
/* Find the size of the file. */
size = wtap_file_size(cf->wth, NULL);
size = wtap_file_size(cf->frame_set_info.wth, NULL);
g_timer_start(prog_timer);
@ -4183,14 +4183,14 @@ rescan_file(capture_file *cf, const char *fname, gboolean is_tempfile)
g_get_current_time(&start_time);
framenum = 0;
phdr = wtap_phdr(cf->wth);
while ((wtap_read(cf->wth, &err, &err_info, &data_offset))) {
phdr = wtap_phdr(cf->frame_set_info.wth);
while ((wtap_read(cf->frame_set_info.wth, &err, &err_info, &data_offset))) {
framenum++;
fdata = frame_data_sequence_find(cf->frames, framenum);
fdata = frame_data_sequence_find(cf->frame_set_info.frames, framenum);
fdata->file_off = data_offset;
if (size >= 0) {
count++;
cf->f_datalen = wtap_read_so_far(cf->wth);
cf->f_datalen = wtap_read_so_far(cf->frame_set_info.wth);
/* Create the progress bar if necessary. */
if (progress_is_slow(progbar, prog_timer, size, cf->f_datalen)) {
@ -4243,7 +4243,7 @@ rescan_file(capture_file *cf, const char *fname, gboolean is_tempfile)
cf->state = FILE_READ_DONE;
/* Close the sequential I/O side, to free up memory it requires. */
wtap_sequential_close(cf->wth);
wtap_sequential_close(cf->frame_set_info.wth);
/* compute the time it took to load the file */
compute_elapsed(cf, &start_time);
@ -4252,7 +4252,7 @@ rescan_file(capture_file *cf, const char *fname, gboolean is_tempfile)
we've looked at all the packets, as we don't know until then whether
there's more than one type (and thus whether it's
WTAP_ENCAP_PER_PACKET). */
cf->lnk_t = wtap_file_encap(cf->wth);
cf->lnk_t = wtap_file_encap(cf->frame_set_info.wth);
cf_callback_invoke(cf_cb_file_rescan_finished, cf);
@ -4386,9 +4386,9 @@ cf_save_records(capture_file *cf, const char *fname, guint save_format,
int encap;
/* XXX: what free's this shb_hdr? */
shb_hdrs = wtap_file_get_shb_for_new_file(cf->wth);
idb_inf = wtap_file_get_idb_info(cf->wth);
nrb_hdrs = wtap_file_get_nrb_for_new_file(cf->wth);
shb_hdrs = wtap_file_get_shb_for_new_file(cf->frame_set_info.wth);
idb_inf = wtap_file_get_idb_info(cf->frame_set_info.wth);
nrb_hdrs = wtap_file_get_nrb_for_new_file(cf->frame_set_info.wth);
/* Determine what file encapsulation type we should use. */
encap = wtap_dump_file_encap_type(cf->linktypes);
@ -4466,7 +4466,7 @@ cf_save_records(capture_file *cf, const char *fname, guint save_format,
on Windows. However, on Windows, we first need to close whatever
file descriptors we have open for fname. */
#ifdef _WIN32
wtap_fdclose(cf->wth);
wtap_fdclose(cf->frame_set_info.wth);
#endif
/* Now do the rename. */
if (ws_rename(fname_new, fname) == -1) {
@ -4476,7 +4476,7 @@ cf_save_records(capture_file *cf, const char *fname, guint save_format,
/* Attempt to reopen the random file descriptor using the
current file's filename. (At this point, the sequential
file descriptor is closed.) */
if (!wtap_fdreopen(cf->wth, cf->filename, &err)) {
if (!wtap_fdreopen(cf->frame_set_info.wth, cf->filename, &err)) {
/* Oh, well, we're screwed. */
display_basename = g_filename_display_basename(cf->filename);
simple_error_message_box(
@ -4509,13 +4509,13 @@ cf_save_records(capture_file *cf, const char *fname, guint save_format,
/* We just copied the file, s all the information other than
the wtap structure, the filename, and the "is temporary"
status applies to the new file; just update that. */
wtap_close(cf->wth);
wtap_close(cf->frame_set_info.wth);
/* Although we're just "copying" and then opening the copy, it will
try all open_routine readers to open the copy, so we need to
reset the cfile's open_type. */
cf->open_type = WTAP_TYPE_AUTO;
cf->wth = wtap_open_offline(fname, WTAP_TYPE_AUTO, &err, &err_info, TRUE);
if (cf->wth == NULL) {
cf->frame_set_info.wth = wtap_open_offline(fname, WTAP_TYPE_AUTO, &err, &err_info, TRUE);
if (cf->frame_set_info.wth == NULL) {
cfile_open_failure_alert_box(fname, err, err_info);
cf_close(cf);
} else {
@ -4578,19 +4578,19 @@ cf_save_records(capture_file *cf, const char *fname, guint save_format,
/* If we were told to discard the comments, do so. */
if (discard_comments) {
/* Remove SHB comment, if any. */
wtap_write_shb_comment(cf->wth, NULL);
wtap_write_shb_comment(cf->frame_set_info.wth, NULL);
/* remove all user comments */
for (framenum = 1; framenum <= cf->count; framenum++) {
fdata = frame_data_sequence_find(cf->frames, framenum);
fdata = frame_data_sequence_find(cf->frame_set_info.frames, framenum);
fdata->flags.has_phdr_comment = FALSE;
fdata->flags.has_user_comment = FALSE;
}
if (cf->frames_user_comments) {
g_tree_destroy(cf->frames_user_comments);
cf->frames_user_comments = NULL;
if (cf->frame_set_info.frames_user_comments) {
g_tree_destroy(cf->frame_set_info.frames_user_comments);
cf->frame_set_info.frames_user_comments = NULL;
}
cf->packet_comment_count = 0;
@ -4637,9 +4637,9 @@ cf_export_specified_packets(capture_file *cf, const char *fname,
and then write it out if it's one of the specified ones. */
/* XXX: what free's this shb_hdr? */
shb_hdrs = wtap_file_get_shb_for_new_file(cf->wth);
idb_inf = wtap_file_get_idb_info(cf->wth);
nrb_hdrs = wtap_file_get_nrb_for_new_file(cf->wth);
shb_hdrs = wtap_file_get_shb_for_new_file(cf->frame_set_info.wth);
idb_inf = wtap_file_get_idb_info(cf->frame_set_info.wth);
nrb_hdrs = wtap_file_get_nrb_for_new_file(cf->frame_set_info.wth);
/* Determine what file encapsulation type we should use. */
encap = wtap_dump_file_encap_type(cf->linktypes);

View File

@ -39,7 +39,7 @@ frame_read(struct tvb_frame *frame_tvb, struct wtap_pkthdr *phdr, Buffer *buf)
gchar *err_info;
/* sanity check, capture file was closed? */
if (cfile.wth != frame_tvb->wth)
if (cfile.frame_set_info.wth != frame_tvb->wth)
return FALSE;
/* XXX, what if phdr->caplen isn't equal to
@ -208,8 +208,8 @@ frame_tvbuff_new(const frame_data *fd, const guint8 *buf)
frame_tvb = (struct tvb_frame *) tvb;
/* XXX, wtap_can_seek() */
if (cfile.wth && cfile.wth->random_fh) {
frame_tvb->wth = cfile.wth;
if (cfile.frame_set_info.wth && cfile.frame_set_info.wth->random_fh) {
frame_tvb->wth = cfile.frame_set_info.wth;
frame_tvb->file_off = fd->file_off;
frame_tvb->offset = 0;
} else
@ -309,8 +309,8 @@ file_tvbuff_new(const frame_data *fd, const guint8 *buf)
frame_tvb = (struct tvb_frame *) tvb;
/* XXX, wtap_can_seek() */
if (cfile.wth && cfile.wth->random_fh) {
frame_tvb->wth = cfile.wth;
if (cfile.frame_set_info.wth && cfile.frame_set_info.wth->random_fh) {
frame_tvb->wth = cfile.frame_set_info.wth;
frame_tvb->file_off = fd->file_off;
frame_tvb->offset = 0;
} else

View File

@ -1028,11 +1028,11 @@ process_packet(capture_file *cf, epan_dissect_t *edt, gint64 offset,
printf("%lu", (unsigned long int) cf->count);
frame_data_set_before_dissect(&fdata, &cf->elapsed_time,
&cf->ref, cf->prev_dis);
&cf->frame_set_info.ref, cf->frame_set_info.prev_dis);
if (cf->ref == &fdata) {
if (cf->frame_set_info.ref == &fdata) {
ref_frame = fdata;
cf->ref = &ref_frame;
cf->frame_set_info.ref = &ref_frame;
}
/* We only need the columns if we're printing packet info but we're
@ -1042,10 +1042,10 @@ process_packet(capture_file *cf, epan_dissect_t *edt, gint64 offset,
frame_data_set_after_dissect(&fdata, &cum_bytes);
prev_dis_frame = fdata;
cf->prev_dis = &prev_dis_frame;
cf->frame_set_info.prev_dis = &prev_dis_frame;
prev_cap_frame = fdata;
cf->prev_cap = &prev_cap_frame;
cf->frame_set_info.prev_cap = &prev_cap_frame;
for(i = 0; i < n_rfilters; i++) {
/* Run the read filter if we have one. */
@ -1464,16 +1464,16 @@ open_failure_message(const char *filename, int err, gboolean for_writing)
}
static const nstime_t *
raw_get_frame_ts(capture_file *cf, guint32 frame_num)
raw_get_frame_ts(frame_set *fs, guint32 frame_num)
{
if (cf->ref && cf->ref->num == frame_num)
return &cf->ref->abs_ts;
if (fs->ref && fs->ref->num == frame_num)
return &fs->ref->abs_ts;
if (cf->prev_dis && cf->prev_dis->num == frame_num)
return &cf->prev_dis->abs_ts;
if (fs->prev_dis && fs->prev_dis->num == frame_num)
return &fs->prev_dis->abs_ts;
if (cf->prev_cap && cf->prev_cap->num == frame_num)
return &cf->prev_cap->abs_ts;
if (fs->prev_cap && fs->prev_cap->num == frame_num)
return &fs->prev_cap->abs_ts;
return NULL;
}
@ -1483,10 +1483,10 @@ raw_epan_new(capture_file *cf)
{
epan_t *epan = epan_new();
epan->cf = cf;
epan->fs = &cf->frame_set_info;
epan->get_frame_ts = raw_get_frame_ts;
epan->get_interface_name = cap_file_get_interface_name;
epan->get_interface_description = cap_file_get_interface_description;
epan->get_interface_name = frame_set_get_interface_name;
epan->get_interface_description = frame_set_get_interface_description;
epan->get_user_comment = NULL;
return epan;
@ -1504,7 +1504,7 @@ raw_cf_open(capture_file *cf, const char *fname)
epan_free(cf->epan);
cf->epan = raw_epan_new(cf);
cf->wth = NULL;
cf->frame_set_info.wth = NULL;
cf->f_datalen = 0; /* not used, but set it anyway */
/* Set the file name because we need it to set the follow stream filter.
@ -1525,9 +1525,9 @@ raw_cf_open(capture_file *cf, const char *fname)
cf->drops = 0;
cf->snap = 0;
nstime_set_zero(&cf->elapsed_time);
cf->ref = NULL;
cf->prev_dis = NULL;
cf->prev_cap = NULL;
cf->frame_set_info.ref = NULL;
cf->frame_set_info.prev_dis = NULL;
cf->frame_set_info.prev_cap = NULL;
return CF_OK;
}

View File

@ -221,19 +221,19 @@ clean_exit:
}
static const nstime_t *
sharkd_get_frame_ts(capture_file *cf, guint32 frame_num)
sharkd_get_frame_ts(frame_set *fs, guint32 frame_num)
{
if (cf->ref && cf->ref->num == frame_num)
return &cf->ref->abs_ts;
if (fs->ref && fs->ref->num == frame_num)
return &fs->ref->abs_ts;
if (cf->prev_dis && cf->prev_dis->num == frame_num)
return &cf->prev_dis->abs_ts;
if (fs->prev_dis && fs->prev_dis->num == frame_num)
return &fs->prev_dis->abs_ts;
if (cf->prev_cap && cf->prev_cap->num == frame_num)
return &cf->prev_cap->abs_ts;
if (fs->prev_cap && fs->prev_cap->num == frame_num)
return &fs->prev_cap->abs_ts;
if (cf->frames) {
frame_data *fd = frame_data_sequence_find(cf->frames, frame_num);
if (fs->frames) {
frame_data *fd = frame_data_sequence_find(fs->frames, frame_num);
return (fd) ? &fd->abs_ts : NULL;
}
@ -246,10 +246,10 @@ sharkd_epan_new(capture_file *cf)
{
epan_t *epan = epan_new();
epan->cf = cf;
epan->fs = &cf->frame_set_info;
epan->get_frame_ts = sharkd_get_frame_ts;
epan->get_interface_name = cap_file_get_interface_name;
epan->get_interface_description = cap_file_get_interface_description;
epan->get_interface_name = frame_set_get_interface_name;
epan->get_interface_description = frame_set_get_interface_description;
epan->get_user_comment = NULL;
return epan;
@ -297,10 +297,10 @@ process_packet(capture_file *cf, epan_dissect_t *edt,
prime_epan_dissect_with_postdissector_wanted_hfids(edt);
frame_data_set_before_dissect(&fdlocal, &cf->elapsed_time,
&cf->ref, cf->prev_dis);
if (cf->ref == &fdlocal) {
&cf->frame_set_info.ref, cf->frame_set_info.prev_dis);
if (cf->frame_set_info.ref == &fdlocal) {
ref_frame = fdlocal;
cf->ref = &ref_frame;
cf->frame_set_info.ref = &ref_frame;
}
epan_dissect_run(edt, cf->cd_t, whdr, frame_tvbuff_new(&fdlocal, pd), &fdlocal, NULL);
@ -312,7 +312,7 @@ process_packet(capture_file *cf, epan_dissect_t *edt,
if (passed) {
frame_data_set_after_dissect(&fdlocal, &cum_bytes);
cf->prev_cap = cf->prev_dis = frame_data_sequence_add(cf->frames, &fdlocal);
cf->frame_set_info.prev_cap = cf->frame_set_info.prev_dis = frame_data_sequence_add(cf->frame_set_info.frames, &fdlocal);
/* If we're not doing dissection then there won't be any dependent frames.
* More importantly, edt.pi.dependent_frames won't be initialized because
@ -322,7 +322,7 @@ process_packet(capture_file *cf, epan_dissect_t *edt,
*/
if (edt && cf->dfcode) {
if (dfilter_apply_edt(cf->dfcode, edt)) {
g_slist_foreach(edt->pi.dependent_frames, find_and_mark_frame_depended_upon, cf->frames);
g_slist_foreach(edt->pi.dependent_frames, find_and_mark_frame_depended_upon, cf->frame_set_info.frames);
}
}
@ -350,7 +350,7 @@ load_cap_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
{
/* Allocate a frame_data_sequence for all the frames. */
cf->frames = new_frame_data_sequence();
cf->frame_set_info.frames = new_frame_data_sequence();
{
gboolean create_proto_tree;
@ -374,9 +374,9 @@ load_cap_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
edt = epan_dissect_new(cf->epan, create_proto_tree, FALSE);
}
while (wtap_read(cf->wth, &err, &err_info, &data_offset)) {
if (process_packet(cf, edt, data_offset, wtap_phdr(cf->wth),
wtap_buf_ptr(cf->wth))) {
while (wtap_read(cf->frame_set_info.wth, &err, &err_info, &data_offset)) {
if (process_packet(cf, edt, data_offset, wtap_phdr(cf->frame_set_info.wth),
wtap_buf_ptr(cf->frame_set_info.wth))) {
/* Stop reading if we have the maximum number of packets;
* When the -c option has not been used, max_packet_count
* starts at 0, which practically means, never stop reading.
@ -395,14 +395,14 @@ load_cap_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
}
/* Close the sequential I/O side, to free up memory it requires. */
wtap_sequential_close(cf->wth);
wtap_sequential_close(cf->frame_set_info.wth);
/* Allow the protocol dissectors to free up memory that they
* don't need after the sequential run-through of the packets. */
postseq_cleanup_all_protocols();
cf->prev_dis = NULL;
cf->prev_cap = NULL;
cf->frame_set_info.prev_dis = NULL;
cf->frame_set_info.prev_cap = NULL;
}
if (err != 0) {
@ -428,7 +428,7 @@ cf_open(capture_file *cf, const char *fname, unsigned int type, gboolean is_temp
epan_free(cf->epan);
cf->epan = sharkd_epan_new(cf);
cf->wth = wth;
cf->frame_set_info.wth = wth;
cf->f_datalen = 0; /* not used, but set it anyway */
/* Set the file name because we need it to set the follow stream filter.
@ -442,21 +442,21 @@ cf_open(capture_file *cf, const char *fname, unsigned int type, gboolean is_temp
/* No user changes yet. */
cf->unsaved_changes = FALSE;
cf->cd_t = wtap_file_type_subtype(cf->wth);
cf->cd_t = wtap_file_type_subtype(cf->frame_set_info.wth);
cf->open_type = type;
cf->count = 0;
cf->drops_known = FALSE;
cf->drops = 0;
cf->snap = wtap_snapshot_length(cf->wth);
cf->snap = wtap_snapshot_length(cf->frame_set_info.wth);
nstime_set_zero(&cf->elapsed_time);
cf->ref = NULL;
cf->prev_dis = NULL;
cf->prev_cap = NULL;
cf->frame_set_info.ref = NULL;
cf->frame_set_info.prev_dis = NULL;
cf->frame_set_info.prev_cap = NULL;
cf->state = FILE_READ_IN_PROGRESS;
wtap_set_cb_new_ipv4(cf->wth, add_ipv4_name);
wtap_set_cb_new_ipv6(cf->wth, (wtap_new_ipv6_callback_t) add_ipv6_name);
wtap_set_cb_new_ipv4(cf->frame_set_info.wth, add_ipv4_name);
wtap_set_cb_new_ipv6(cf->frame_set_info.wth, (wtap_new_ipv6_callback_t) add_ipv6_name);
return CF_OK;
@ -543,14 +543,14 @@ sharkd_dissect_request(unsigned int framenum, void (*cb)(epan_dissect_t *, proto
int err;
char *err_info = NULL;
fdata = frame_data_sequence_find(cfile.frames, framenum);
fdata = frame_data_sequence_find(cfile.frame_set_info.frames, framenum);
if (fdata == NULL)
return -1;
wtap_phdr_init(&phdr);
ws_buffer_init(&buf, 1500);
if (!wtap_seek_read(cfile.wth, fdata->file_off, &phdr, &buf, &err, &err_info)) {
if (!wtap_seek_read(cfile.frame_set_info.wth, fdata->file_off, &phdr, &buf, &err, &err_info)) {
ws_buffer_free(&buf);
return -1; /* error reading the record */
}
@ -593,7 +593,7 @@ sharkd_dissect_columns(int framenum, column_info *cinfo, gboolean dissect_color)
int err;
char *err_info = NULL;
fdata = frame_data_sequence_find(cfile.frames, framenum);
fdata = frame_data_sequence_find(cfile.frame_set_info.frames, framenum);
if (fdata == NULL) {
col_fill_in_error(cinfo, fdata, FALSE, TRUE/* fill_fd_columns */);
return -1; /* error reading the record */
@ -602,7 +602,7 @@ sharkd_dissect_columns(int framenum, column_info *cinfo, gboolean dissect_color)
wtap_phdr_init(&phdr);
ws_buffer_init(&buf, 1500);
if (!wtap_seek_read(cfile.wth, fdata->file_off, &phdr, &buf, &err, &err_info)) {
if (!wtap_seek_read(cfile.frame_set_info.wth, fdata->file_off, &phdr, &buf, &err, &err_info)) {
col_fill_in_error(cinfo, fdata, FALSE, FALSE /* fill_fd_columns */);
ws_buffer_free(&buf);
return -1; /* error reading the record */
@ -676,9 +676,9 @@ sharkd_retap(void)
reset_tap_listeners();
for (framenum = 1; framenum <= cfile.count; framenum++) {
fdata = frame_data_sequence_find(cfile.frames, framenum);
fdata = frame_data_sequence_find(cfile.frame_set_info.frames, framenum);
if (!wtap_seek_read(cfile.wth, fdata->file_off, &phdr, &buf, &err, &err_info))
if (!wtap_seek_read(cfile.frame_set_info.wth, fdata->file_off, &phdr, &buf, &err, &err_info))
break;
epan_dissect_run_with_taps(&edt, cfile.cd_t, &phdr, frame_tvbuff_new(fdata, ws_buffer_start_ptr(&buf)), fdata, cinfo);
@ -726,14 +726,14 @@ sharkd_filter(const char *dftext, guint8 **result)
result_bits = (guint8 *) g_malloc(2 + (frames_count / 8));
for (framenum = 1; framenum <= frames_count; framenum++) {
frame_data *fdata = frame_data_sequence_find(cfile.frames, framenum);
frame_data *fdata = frame_data_sequence_find(cfile.frame_set_info.frames, framenum);
if ((framenum & 7) == 0) {
result_bits[(framenum / 8) - 1] = passed_bits;
passed_bits = 0;
}
if (!wtap_seek_read(cfile.wth, fdata->file_off, &phdr, &buf, &err, &err_info))
if (!wtap_seek_read(cfile.frame_set_info.wth, fdata->file_off, &phdr, &buf, &err, &err_info))
break;
/* frame_data_set_before_dissect */

View File

@ -607,9 +607,9 @@ sharkd_session_process_status(void)
g_free(name);
}
if (cfile.wth)
if (cfile.frame_set_info.wth)
{
gint64 file_size = wtap_file_size(cfile.wth, NULL);
gint64 file_size = wtap_file_size(cfile.frame_set_info.wth, NULL);
if (file_size > 0)
printf(",\"filesize\":%" G_GINT64_FORMAT, file_size);
@ -845,7 +845,7 @@ sharkd_session_process_frames(const char *buf, const jsmntok_t *tokens, int coun
printf("[");
for (framenum = 1; framenum <= cfile.count; framenum++)
{
frame_data *fdata = frame_data_sequence_find(cfile.frames, framenum);
frame_data *fdata = frame_data_sequence_find(cfile.frame_set_info.frames, framenum);
if (filter_data && !(filter_data[framenum / 8] & (1 << (framenum % 8))))
continue;
@ -2967,7 +2967,7 @@ sharkd_session_process_intervals(char *buf, const jsmntok_t *tokens, int count)
for (framenum = 1; framenum <= cfile.count; framenum++)
{
frame_data *fdata = frame_data_sequence_find(cfile.frames, framenum);
frame_data *fdata = frame_data_sequence_find(cfile.frame_set_info.frames, framenum);
gint64 msec_rel;
gint64 new_idx;

View File

@ -120,12 +120,12 @@ summary_fill_in(capture_file *cf, summary_tally *st)
/* initialize the tally */
if (cf->count != 0) {
first_frame = frame_data_sequence_find(cf->frames, 1);
first_frame = frame_data_sequence_find(cf->frame_set_info.frames, 1);
st->start_time = nstime_to_sec(&first_frame->abs_ts);
st->stop_time = nstime_to_sec(&first_frame->abs_ts);
for (framenum = 1; framenum <= cf->count; framenum++) {
cur_frame = frame_data_sequence_find(cf->frames, framenum);
cur_frame = frame_data_sequence_find(cf->frame_set_info.frames, framenum);
tally_frame_data(cur_frame, st);
}
}
@ -145,7 +145,7 @@ summary_fill_in(capture_file *cf, summary_tally *st)
st->dfilter = cf->dfilter;
st->ifaces = g_array_new(FALSE, FALSE, sizeof(iface_options));
idb_info = wtap_file_get_idb_info(cf->wth);
idb_info = wtap_file_get_idb_info(cf->frame_set_info.wth);
for (i = 0; i < idb_info->interface_data->len; i++) {
wtapng_if_descr = g_array_index(idb_info->interface_data, wtap_block_t, i);
wtapng_if_descr_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(wtapng_if_descr);

View File

@ -998,9 +998,9 @@ main(int argc, char *argv[])
g_free(cf_name);
if (cfile.frames != NULL) {
free_frame_data_sequence(cfile.frames);
cfile.frames = NULL;
if (cfile.frame_set_info.frames != NULL) {
free_frame_data_sequence(cfile.frame_set_info.frames);
cfile.frame_set_info.frames = NULL;
}
draw_tap_listeners(TRUE);
@ -1023,19 +1023,19 @@ clean_exit:
}
static const nstime_t *
tfshark_get_frame_ts(capture_file *cf, guint32 frame_num)
tfshark_get_frame_ts(frame_set *fs, guint32 frame_num)
{
if (cf->ref && cf->ref->num == frame_num)
return &cf->ref->abs_ts;
if (fs->ref && fs->ref->num == frame_num)
return &fs->ref->abs_ts;
if (cf->prev_dis && cf->prev_dis->num == frame_num)
return &cf->prev_dis->abs_ts;
if (fs->prev_dis && fs->prev_dis->num == frame_num)
return &fs->prev_dis->abs_ts;
if (cf->prev_cap && cf->prev_cap->num == frame_num)
return &cf->prev_cap->abs_ts;
if (fs->prev_cap && fs->prev_cap->num == frame_num)
return &fs->prev_cap->abs_ts;
if (cf->frames) {
frame_data *fd = frame_data_sequence_find(cf->frames, frame_num);
if (fs->frames) {
frame_data *fd = frame_data_sequence_find(fs->frames, frame_num);
return (fd) ? &fd->abs_ts : NULL;
}
@ -1044,7 +1044,7 @@ tfshark_get_frame_ts(capture_file *cf, guint32 frame_num)
}
static const char *
no_interface_name(capture_file *cf _U_, guint32 interface_id _U_)
no_interface_name(frame_set *fs _U_, guint32 interface_id _U_)
{
return "";
}
@ -1054,7 +1054,7 @@ tfshark_epan_new(capture_file *cf)
{
epan_t *epan = epan_new();
epan->cf = cf;
epan->fs = &cf->frame_set_info;
epan->get_frame_ts = tfshark_get_frame_ts;
epan->get_interface_name = no_interface_name;
epan->get_user_comment = NULL;
@ -1096,10 +1096,10 @@ process_packet_first_pass(capture_file *cf, epan_dissect_t *edt,
prime_epan_dissect_with_postdissector_wanted_hfids(edt);
frame_data_set_before_dissect(&fdlocal, &cf->elapsed_time,
&cf->ref, cf->prev_dis);
if (cf->ref == &fdlocal) {
&cf->frame_set_info.ref, cf->frame_set_info.prev_dis);
if (cf->frame_set_info.ref == &fdlocal) {
ref_frame = fdlocal;
cf->ref = &ref_frame;
cf->frame_set_info.ref = &ref_frame;
}
epan_dissect_file_run(edt, whdr, file_tvbuff_new(&fdlocal, pd), &fdlocal, NULL);
@ -1111,14 +1111,14 @@ process_packet_first_pass(capture_file *cf, epan_dissect_t *edt,
if (passed) {
frame_data_set_after_dissect(&fdlocal, &cum_bytes);
cf->prev_cap = cf->prev_dis = frame_data_sequence_add(cf->frames, &fdlocal);
cf->frame_set_info.prev_cap = cf->frame_set_info.prev_dis = frame_data_sequence_add(cf->frame_set_info.frames, &fdlocal);
/* If we're not doing dissection then there won't be any dependent frames.
* More importantly, edt.pi.dependent_frames won't be initialized because
* epan hasn't been initialized.
*/
if (edt) {
g_slist_foreach(edt->pi.dependent_frames, find_and_mark_frame_depended_upon, cf->frames);
g_slist_foreach(edt->pi.dependent_frames, find_and_mark_frame_depended_upon, cf->frame_set_info.frames);
}
cf->count++;
@ -1175,10 +1175,10 @@ process_packet_second_pass(capture_file *cf, epan_dissect_t *edt,
cinfo = NULL;
frame_data_set_before_dissect(fdata, &cf->elapsed_time,
&cf->ref, cf->prev_dis);
if (cf->ref == fdata) {
&cf->frame_set_info.ref, cf->frame_set_info.prev_dis);
if (cf->frame_set_info.ref == fdata) {
ref_frame = *fdata;
cf->ref = &ref_frame;
cf->frame_set_info.ref = &ref_frame;
}
epan_dissect_file_run_with_taps(edt, phdr, file_tvbuff_new_buffer(fdata, buf), fdata, cinfo);
@ -1207,9 +1207,9 @@ process_packet_second_pass(capture_file *cf, epan_dissect_t *edt,
return FALSE;
}
}
cf->prev_dis = fdata;
cf->frame_set_info.prev_dis = fdata;
}
cf->prev_cap = fdata;
cf->frame_set_info.prev_cap = fdata;
if (edt) {
epan_dissect_reset(edt);
@ -1221,14 +1221,14 @@ static gboolean
local_wtap_read(capture_file *cf, struct wtap_pkthdr* file_phdr _U_, int *err, gchar **err_info _U_, gint64 *data_offset _U_, guint8** data_buffer)
{
/* int bytes_read; */
gint64 packet_size = wtap_file_size(cf->wth, err);
gint64 packet_size = wtap_file_size(cf->frame_set_info.wth, err);
*data_buffer = (guint8*)g_malloc((gsize)packet_size);
/* bytes_read =*/ file_read(*data_buffer, (unsigned int)packet_size, cf->wth->fh);
/* bytes_read =*/ file_read(*data_buffer, (unsigned int)packet_size, cf->frame_set_info.wth->fh);
#if 0 /* no more filetap */
if (bytes_read < 0) {
*err = file_error(cf->wth->fh, err_info);
*err = file_error(cf->frame_set_info.wth->fh, err_info);
if (*err == 0)
*err = FTAP_ERR_SHORT_READ;
return FALSE;
@ -1323,7 +1323,7 @@ process_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
frame_data *fdata;
/* Allocate a frame_data_sequence for all the frames. */
cf->frames = new_frame_data_sequence();
cf->frame_set_info.frames = new_frame_data_sequence();
if (do_dissection) {
gboolean create_proto_tree;
@ -1345,8 +1345,8 @@ process_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
edt = epan_dissect_new(cf->epan, create_proto_tree, FALSE);
}
while (local_wtap_read(cf, &file_phdr, &err, &err_info, &data_offset, &raw_data)) {
if (process_packet_first_pass(cf, edt, data_offset, &file_phdr/*wtap_phdr(cf->wth)*/,
wtap_buf_ptr(cf->wth))) {
if (process_packet_first_pass(cf, edt, data_offset, &file_phdr/*wtap_phdr(cf->frame_set_info.wth)*/,
wtap_buf_ptr(cf->frame_set_info.wth))) {
/* Stop reading if we have the maximum number of packets;
* When the -c option has not been used, max_packet_count
@ -1367,15 +1367,15 @@ process_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
#if 0
/* Close the sequential I/O side, to free up memory it requires. */
wtap_sequential_close(cf->wth);
wtap_sequential_close(cf->frame_set_info.wth);
#endif
/* Allow the protocol dissectors to free up memory that they
* don't need after the sequential run-through of the packets. */
postseq_cleanup_all_protocols();
cf->prev_dis = NULL;
cf->prev_cap = NULL;
cf->frame_set_info.prev_dis = NULL;
cf->frame_set_info.prev_cap = NULL;
ws_buffer_init(&buf, 1500);
if (do_dissection) {
@ -1406,9 +1406,9 @@ process_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
}
for (framenum = 1; err == 0 && framenum <= cf->count; framenum++) {
fdata = frame_data_sequence_find(cf->frames, framenum);
fdata = frame_data_sequence_find(cf->frame_set_info.frames, framenum);
#if 0
if (wtap_seek_read(cf->wth, fdata->file_off,
if (wtap_seek_read(cf->frame_set_info.wth, fdata->file_off,
&buf, fdata->cap_len, &err, &err_info)) {
process_packet_second_pass(cf, edt, fdata, &cf->phdr, &buf, tap_flags);
}
@ -1469,7 +1469,7 @@ process_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
framenum++;
if (!process_packet_single_pass(cf, edt, data_offset,
&file_phdr/*wtap_phdr(cf->wth)*/,
&file_phdr/*wtap_phdr(cf->frame_set_info.wth)*/,
raw_data, tap_flags))
return FALSE;
@ -1569,8 +1569,8 @@ process_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
}
out:
wtap_close(cf->wth);
cf->wth = NULL;
wtap_close(cf->frame_set_info.wth);
cf->frame_set_info.wth = NULL;
return (err != 0);
}
@ -1618,10 +1618,10 @@ process_packet_single_pass(capture_file *cf, epan_dissect_t *edt, gint64 offset,
cinfo = NULL;
frame_data_set_before_dissect(&fdata, &cf->elapsed_time,
&cf->ref, cf->prev_dis);
if (cf->ref == &fdata) {
&cf->frame_set_info.ref, cf->frame_set_info.prev_dis);
if (cf->frame_set_info.ref == &fdata) {
ref_frame = fdata;
cf->ref = &ref_frame;
cf->frame_set_info.ref = &ref_frame;
}
epan_dissect_file_run_with_taps(edt, whdr, frame_tvbuff_new(&fdata, pd), &fdata, cinfo);
@ -1654,11 +1654,11 @@ process_packet_single_pass(capture_file *cf, epan_dissect_t *edt, gint64 offset,
/* this must be set after print_packet() [bug #8160] */
prev_dis_frame = fdata;
cf->prev_dis = &prev_dis_frame;
cf->frame_set_info.prev_dis = &prev_dis_frame;
}
prev_cap_frame = fdata;
cf->prev_cap = &prev_cap_frame;
cf->frame_set_info.prev_cap = &prev_cap_frame;
if (edt) {
epan_dissect_reset(edt);
@ -2066,7 +2066,7 @@ cf_open(capture_file *cf, const char *fname, unsigned int type, gboolean is_temp
epan_free(cf->epan);
cf->epan = tfshark_epan_new(cf);
cf->wth = NULL; /**** XXX - DOESN'T WORK RIGHT NOW!!!! */
cf->frame_set_info.wth = NULL; /**** XXX - DOESN'T WORK RIGHT NOW!!!! */
cf->f_datalen = 0; /* not used, but set it anyway */
/* Set the file name because we need it to set the follow stream filter.
@ -2087,9 +2087,9 @@ cf_open(capture_file *cf, const char *fname, unsigned int type, gboolean is_temp
cf->drops = 0;
cf->snap = 0; /**** XXX - DOESN'T WORK RIGHT NOW!!!! */
nstime_set_zero(&cf->elapsed_time);
cf->ref = NULL;
cf->prev_dis = NULL;
cf->prev_cap = NULL;
cf->frame_set_info.ref = NULL;
cf->frame_set_info.prev_dis = NULL;
cf->frame_set_info.prev_cap = NULL;
cf->state = FILE_READ_IN_PROGRESS;

142
tshark.c
View File

@ -2199,9 +2199,9 @@ main(int argc, char *argv[])
g_free(cf_name);
if (cfile.frames != NULL) {
free_frame_data_sequence(cfile.frames);
cfile.frames = NULL;
if (cfile.frame_set_info.frames != NULL) {
free_frame_data_sequence(cfile.frame_set_info.frames);
cfile.frame_set_info.frames = NULL;
}
draw_tap_listeners(TRUE);
@ -2343,19 +2343,19 @@ pipe_input_set_handler(gint source, gpointer user_data, ws_process_id *child_pro
}
static const nstime_t *
tshark_get_frame_ts(capture_file *cf, guint32 frame_num)
tshark_get_frame_ts(frame_set *fs, guint32 frame_num)
{
if (cf->ref && cf->ref->num == frame_num)
return &cf->ref->abs_ts;
if (fs->ref && fs->ref->num == frame_num)
return &fs->ref->abs_ts;
if (cf->prev_dis && cf->prev_dis->num == frame_num)
return &cf->prev_dis->abs_ts;
if (fs->prev_dis && fs->prev_dis->num == frame_num)
return &fs->prev_dis->abs_ts;
if (cf->prev_cap && cf->prev_cap->num == frame_num)
return &cf->prev_cap->abs_ts;
if (fs->prev_cap && fs->prev_cap->num == frame_num)
return &fs->prev_cap->abs_ts;
if (cf->frames) {
frame_data *fd = frame_data_sequence_find(cf->frames, frame_num);
if (fs->frames) {
frame_data *fd = frame_data_sequence_find(fs->frames, frame_num);
return (fd) ? &fd->abs_ts : NULL;
}
@ -2368,10 +2368,10 @@ tshark_epan_new(capture_file *cf)
{
epan_t *epan = epan_new();
epan->cf = cf;
epan->fs = &cf->frame_set_info;
epan->get_frame_ts = tshark_get_frame_ts;
epan->get_interface_name = cap_file_get_interface_name;
epan->get_interface_description = cap_file_get_interface_description;
epan->get_interface_name = frame_set_get_interface_name;
epan->get_interface_description = frame_set_get_interface_description;
epan->get_user_comment = NULL;
return epan;
@ -2578,9 +2578,9 @@ capture_input_new_file(capture_session *cap_session, gchar *new_file)
/* we start a new capture file, close the old one (if we had one before) */
if (cf->state != FILE_CLOSED) {
if (cf->wth != NULL) {
wtap_close(cf->wth);
cf->wth = NULL;
if (cf->frame_set_info.wth != NULL) {
wtap_close(cf->frame_set_info.wth);
cf->frame_set_info.wth = NULL;
}
cf->state = FILE_CLOSED;
}
@ -2683,19 +2683,19 @@ capture_input_new_packets(capture_session *cap_session, int to_read)
("packet_details" is true). */
edt = epan_dissect_new(cf->epan, create_proto_tree, print_packet_info && print_details);
while (to_read-- && cf->wth) {
wtap_cleareof(cf->wth);
ret = wtap_read(cf->wth, &err, &err_info, &data_offset);
while (to_read-- && cf->frame_set_info.wth) {
wtap_cleareof(cf->frame_set_info.wth);
ret = wtap_read(cf->frame_set_info.wth, &err, &err_info, &data_offset);
reset_epan_mem(cf, edt, create_proto_tree, print_packet_info && print_details);
if (ret == FALSE) {
/* read from file failed, tell the capture child to stop */
sync_pipe_stop(cap_session);
wtap_close(cf->wth);
cf->wth = NULL;
wtap_close(cf->frame_set_info.wth);
cf->frame_set_info.wth = NULL;
} else {
ret = process_packet_single_pass(cf, edt, data_offset,
wtap_phdr(cf->wth),
wtap_buf_ptr(cf->wth), tap_flags);
wtap_phdr(cf->frame_set_info.wth),
wtap_buf_ptr(cf->frame_set_info.wth), tap_flags);
}
if (ret != FALSE) {
/* packet successfully read and gone through the "Read Filter" */
@ -2799,8 +2799,8 @@ capture_input_closed(capture_session *cap_session, gchar *msg)
report_counts();
if (cf != NULL && cf->wth != NULL) {
wtap_close(cf->wth);
if (cf != NULL && cf->frame_set_info.wth != NULL) {
wtap_close(cf->frame_set_info.wth);
if (cf->is_tempfile) {
ws_unlink(cf->filename);
}
@ -2908,10 +2908,10 @@ process_packet_first_pass(capture_file *cf, epan_dissect_t *edt,
prime_epan_dissect_with_postdissector_wanted_hfids(edt);
frame_data_set_before_dissect(&fdlocal, &cf->elapsed_time,
&cf->ref, cf->prev_dis);
if (cf->ref == &fdlocal) {
&cf->frame_set_info.ref, cf->frame_set_info.prev_dis);
if (cf->frame_set_info.ref == &fdlocal) {
ref_frame = fdlocal;
cf->ref = &ref_frame;
cf->frame_set_info.ref = &ref_frame;
}
epan_dissect_run(edt, cf->cd_t, whdr, frame_tvbuff_new(&fdlocal, pd), &fdlocal, NULL);
@ -2923,7 +2923,7 @@ process_packet_first_pass(capture_file *cf, epan_dissect_t *edt,
if (passed) {
frame_data_set_after_dissect(&fdlocal, &cum_bytes);
cf->prev_cap = cf->prev_dis = frame_data_sequence_add(cf->frames, &fdlocal);
cf->frame_set_info.prev_cap = cf->frame_set_info.prev_dis = frame_data_sequence_add(cf->frame_set_info.frames, &fdlocal);
/* If we're not doing dissection then there won't be any dependent frames.
* More importantly, edt.pi.dependent_frames won't be initialized because
@ -2933,7 +2933,7 @@ process_packet_first_pass(capture_file *cf, epan_dissect_t *edt,
*/
if (edt && cf->dfcode) {
if (dfilter_apply_edt(cf->dfcode, edt)) {
g_slist_foreach(edt->pi.dependent_frames, find_and_mark_frame_depended_upon, cf->frames);
g_slist_foreach(edt->pi.dependent_frames, find_and_mark_frame_depended_upon, cf->frame_set_info.frames);
}
}
@ -2993,10 +2993,10 @@ process_packet_second_pass(capture_file *cf, epan_dissect_t *edt,
cinfo = NULL;
frame_data_set_before_dissect(fdata, &cf->elapsed_time,
&cf->ref, cf->prev_dis);
if (cf->ref == fdata) {
&cf->frame_set_info.ref, cf->frame_set_info.prev_dis);
if (cf->frame_set_info.ref == fdata) {
ref_frame = *fdata;
cf->ref = &ref_frame;
cf->frame_set_info.ref = &ref_frame;
}
if (dissect_color) {
@ -3030,9 +3030,9 @@ process_packet_second_pass(capture_file *cf, epan_dissect_t *edt,
exit(2);
}
}
cf->prev_dis = fdata;
cf->frame_set_info.prev_dis = fdata;
}
cf->prev_cap = fdata;
cf->frame_set_info.prev_cap = fdata;
if (edt) {
epan_dissect_reset(edt);
@ -3064,27 +3064,27 @@ process_cap_file(capture_file *cf, char *save_file, int out_file_type,
wtap_phdr_init(&phdr);
idb_inf = wtap_file_get_idb_info(cf->wth);
idb_inf = wtap_file_get_idb_info(cf->frame_set_info.wth);
#ifdef PCAP_NG_DEFAULT
if (idb_inf->interface_data->len > 1) {
linktype = WTAP_ENCAP_PER_PACKET;
} else {
linktype = wtap_file_encap(cf->wth);
linktype = wtap_file_encap(cf->frame_set_info.wth);
}
#else
linktype = wtap_file_encap(cf->wth);
linktype = wtap_file_encap(cf->frame_set_info.wth);
#endif
if (save_file != NULL) {
/* Set up to write to the capture file. */
snapshot_length = wtap_snapshot_length(cf->wth);
snapshot_length = wtap_snapshot_length(cf->frame_set_info.wth);
if (snapshot_length == 0) {
/* Snapshot length of input file not known. */
snapshot_length = WTAP_MAX_PACKET_SIZE_STANDARD;
}
tshark_debug("tshark: snapshot_length = %d", snapshot_length);
shb_hdrs = wtap_file_get_shb_for_new_file(cf->wth);
nrb_hdrs = wtap_file_get_nrb_for_new_file(cf->wth);
shb_hdrs = wtap_file_get_shb_for_new_file(cf->frame_set_info.wth);
nrb_hdrs = wtap_file_get_nrb_for_new_file(cf->frame_set_info.wth);
/* If we don't have an application name add Tshark */
if (wtap_block_get_string_option_value(g_array_index(shb_hdrs, wtap_block_t, 0), OPT_SHB_USERAPPL, &shb_user_appl) != WTAP_OPTTYPE_SUCCESS) {
@ -3151,7 +3151,7 @@ process_cap_file(capture_file *cf, char *save_file, int out_file_type,
tshark_debug("tshark: perform_two_pass_analysis, do_dissection=%s", do_dissection ? "TRUE" : "FALSE");
/* Allocate a frame_data_sequence for all the frames. */
cf->frames = new_frame_data_sequence();
cf->frame_set_info.frames = new_frame_data_sequence();
if (do_dissection) {
gboolean create_proto_tree;
@ -3178,9 +3178,9 @@ process_cap_file(capture_file *cf, char *save_file, int out_file_type,
}
tshark_debug("tshark: reading records for first pass");
while (wtap_read(cf->wth, &err, &err_info, &data_offset)) {
if (process_packet_first_pass(cf, edt, data_offset, wtap_phdr(cf->wth),
wtap_buf_ptr(cf->wth))) {
while (wtap_read(cf->frame_set_info.wth, &err, &err_info, &data_offset)) {
if (process_packet_first_pass(cf, edt, data_offset, wtap_phdr(cf->frame_set_info.wth),
wtap_buf_ptr(cf->frame_set_info.wth))) {
/* Stop reading if we have the maximum number of packets;
* When the -c option has not been used, max_packet_count
* starts at 0, which practically means, never stop reading.
@ -3215,14 +3215,14 @@ process_cap_file(capture_file *cf, char *save_file, int out_file_type,
}
/* Close the sequential I/O side, to free up memory it requires. */
wtap_sequential_close(cf->wth);
wtap_sequential_close(cf->frame_set_info.wth);
/* Allow the protocol dissectors to free up memory that they
* don't need after the sequential run-through of the packets. */
postseq_cleanup_all_protocols();
cf->prev_dis = NULL;
cf->prev_cap = NULL;
cf->frame_set_info.prev_dis = NULL;
cf->frame_set_info.prev_cap = NULL;
ws_buffer_init(&buf, 1500);
tshark_debug("tshark: done with first pass");
@ -3257,8 +3257,8 @@ process_cap_file(capture_file *cf, char *save_file, int out_file_type,
}
for (framenum = 1; err == 0 && framenum <= cf->count; framenum++) {
fdata = frame_data_sequence_find(cf->frames, framenum);
if (wtap_seek_read(cf->wth, fdata->file_off, &phdr, &buf, &err,
fdata = frame_data_sequence_find(cf->frame_set_info.frames, framenum);
if (wtap_seek_read(cf->frame_set_info.wth, fdata->file_off, &phdr, &buf, &err,
&err_info)) {
tshark_debug("tshark: invoking process_packet_second_pass() for frame #%d", framenum);
if (process_packet_second_pass(cf, edt, fdata, &phdr, &buf,
@ -3338,21 +3338,21 @@ process_cap_file(capture_file *cf, char *save_file, int out_file_type,
edt = epan_dissect_new(cf->epan, create_proto_tree, print_packet_info && print_details);
}
while (wtap_read(cf->wth, &err, &err_info, &data_offset)) {
while (wtap_read(cf->frame_set_info.wth, &err, &err_info, &data_offset)) {
framenum++;
tshark_debug("tshark: processing packet #%d", framenum);
reset_epan_mem(cf, edt, create_proto_tree, print_packet_info && print_details);
if (process_packet_single_pass(cf, edt, data_offset, wtap_phdr(cf->wth),
wtap_buf_ptr(cf->wth), tap_flags)) {
if (process_packet_single_pass(cf, edt, data_offset, wtap_phdr(cf->frame_set_info.wth),
wtap_buf_ptr(cf->frame_set_info.wth), tap_flags)) {
/* Either there's no read filtering or this packet passed the
filter, so, if we're writing to a capture file, write
this packet out. */
if (pdh != NULL) {
tshark_debug("tshark: writing packet #%d to outfile", framenum);
if (!wtap_dump(pdh, wtap_phdr(cf->wth), wtap_buf_ptr(cf->wth), &err, &err_info)) {
if (!wtap_dump(pdh, wtap_phdr(cf->frame_set_info.wth), wtap_buf_ptr(cf->frame_set_info.wth), &err, &err_info)) {
/* Error writing to a capture file */
tshark_debug("tshark: error writing to a capture file (%d)", err);
cfile_write_failure_message("TShark", cf->filename, save_file,
@ -3445,8 +3445,8 @@ process_cap_file(capture_file *cf, char *save_file, int out_file_type,
}
out:
wtap_close(cf->wth);
cf->wth = NULL;
wtap_close(cf->frame_set_info.wth);
cf->frame_set_info.wth = NULL;
wtap_block_array_free(shb_hdrs);
wtap_block_array_free(nrb_hdrs);
@ -3508,10 +3508,10 @@ process_packet_single_pass(capture_file *cf, epan_dissect_t *edt, gint64 offset,
cinfo = NULL;
frame_data_set_before_dissect(&fdata, &cf->elapsed_time,
&cf->ref, cf->prev_dis);
if (cf->ref == &fdata) {
&cf->frame_set_info.ref, cf->frame_set_info.prev_dis);
if (cf->frame_set_info.ref == &fdata) {
ref_frame = fdata;
cf->ref = &ref_frame;
cf->frame_set_info.ref = &ref_frame;
}
if (dissect_color) {
@ -3550,11 +3550,11 @@ process_packet_single_pass(capture_file *cf, epan_dissect_t *edt, gint64 offset,
/* this must be set after print_packet() [bug #8160] */
prev_dis_frame = fdata;
cf->prev_dis = &prev_dis_frame;
cf->frame_set_info.prev_dis = &prev_dis_frame;
}
prev_cap_frame = fdata;
cf->prev_cap = &prev_cap_frame;
cf->frame_set_info.prev_cap = &prev_cap_frame;
if (edt) {
epan_dissect_reset(edt);
@ -4031,7 +4031,7 @@ cf_open(capture_file *cf, const char *fname, unsigned int type, gboolean is_temp
epan_free(cf->epan);
cf->epan = tshark_epan_new(cf);
cf->wth = wth;
cf->frame_set_info.wth = wth;
cf->f_datalen = 0; /* not used, but set it anyway */
/* Set the file name because we need it to set the follow stream filter.
@ -4045,21 +4045,21 @@ cf_open(capture_file *cf, const char *fname, unsigned int type, gboolean is_temp
/* No user changes yet. */
cf->unsaved_changes = FALSE;
cf->cd_t = wtap_file_type_subtype(cf->wth);
cf->cd_t = wtap_file_type_subtype(cf->frame_set_info.wth);
cf->open_type = type;
cf->count = 0;
cf->drops_known = FALSE;
cf->drops = 0;
cf->snap = wtap_snapshot_length(cf->wth);
cf->snap = wtap_snapshot_length(cf->frame_set_info.wth);
nstime_set_zero(&cf->elapsed_time);
cf->ref = NULL;
cf->prev_dis = NULL;
cf->prev_cap = NULL;
cf->frame_set_info.ref = NULL;
cf->frame_set_info.prev_dis = NULL;
cf->frame_set_info.prev_cap = NULL;
cf->state = FILE_READ_IN_PROGRESS;
wtap_set_cb_new_ipv4(cf->wth, add_ipv4_name);
wtap_set_cb_new_ipv6(cf->wth, (wtap_new_ipv6_callback_t) add_ipv6_name);
wtap_set_cb_new_ipv4(cf->frame_set_info.wth, add_ipv4_name);
wtap_set_cb_new_ipv6(cf->frame_set_info.wth, (wtap_new_ipv6_callback_t) add_ipv6_name);
return CF_OK;

View File

@ -1344,7 +1344,7 @@ mark_all_displayed_frames(gboolean set)
guint32 framenum;
frame_data *fdata;
for (framenum = 1; framenum <= cfile.count; framenum++) {
fdata = frame_data_sequence_find(cfile.frames, framenum);
fdata = frame_data_sequence_find(cfile.frame_set_info.frames, framenum);
if( fdata->flags.passed_dfilter )
set_frame_mark(set, fdata);
}
@ -1371,7 +1371,7 @@ toggle_mark_all_displayed_frames(void)
guint32 framenum;
frame_data *fdata;
for (framenum = 1; framenum <= cfile.count; framenum++) {
fdata = frame_data_sequence_find(cfile.frames, framenum);
fdata = frame_data_sequence_find(cfile.frame_set_info.frames, framenum);
if( fdata->flags.passed_dfilter )
set_frame_mark(!fdata->flags.marked, fdata);
}
@ -1420,7 +1420,7 @@ ignore_all_displayed_frames(gboolean set)
/* XXX: we might need a progressbar here */
for (framenum = 1; framenum <= cfile.count; framenum++) {
fdata = frame_data_sequence_find(cfile.frames, framenum);
fdata = frame_data_sequence_find(cfile.frame_set_info.frames, framenum);
if( fdata->flags.passed_dfilter )
set_frame_ignore(set, fdata);
}
@ -1435,7 +1435,7 @@ packet_list_ignore_all_displayed_frames_cb(GtkWidget *w _U_, gpointer data _U_)
/* Due to performance impact with large captures, don't check the filtered list for
an ignored frame; just check the first. If a ignored frame exists but isn't first and
the user wants to unignore all the displayed frames, they will just re-exec the shortcut. */
fdata = frame_data_sequence_find(cfile.frames, cfile.first_displayed);
fdata = frame_data_sequence_find(cfile.frame_set_info.frames, cfile.first_displayed);
if (fdata->flags.ignored==TRUE) {
ignore_all_displayed_frames(FALSE);
} else {
@ -1452,7 +1452,7 @@ unignore_all_frames(void)
/* XXX: we might need a progressbar here */
for (framenum = 1; framenum <= cfile.count; framenum++) {
fdata = frame_data_sequence_find(cfile.frames, framenum);
fdata = frame_data_sequence_find(cfile.frame_set_info.frames, framenum);
set_frame_ignore(FALSE, fdata);
}
redissect_packets();
@ -1472,7 +1472,7 @@ untime_reference_all_frames(void)
guint32 framenum;
frame_data *fdata;
for (framenum = 1; framenum <= cfile.count && cfile.ref_time_count > 0; framenum++) {
fdata = frame_data_sequence_find(cfile.frames, framenum);
fdata = frame_data_sequence_find(cfile.frame_set_info.frames, framenum);
if (fdata->flags.ref_time == 1) {
set_frame_reftime(FALSE, fdata, cfile.current_row);
}
@ -1570,7 +1570,7 @@ packet_list_return_all_comments(GtkTextBuffer *buffer)
for (framenum = 1; framenum <= cfile.count ; framenum++) {
char *pkt_comment;
fdata = frame_data_sequence_find(cfile.frames, framenum);
fdata = frame_data_sequence_find(cfile.frame_set_info.frames, framenum);
pkt_comment = cf_get_packet_comment(&cfile, fdata);
if (pkt_comment) {
buf_str = g_strdup_printf("Frame %u: %s \n\n",framenum, pkt_comment);

View File

@ -198,7 +198,7 @@ void new_packet_window(GtkWidget *w _U_, gboolean reference, gboolean editable _
return;
}
fd = frame_data_sequence_find(cfile.frames, framenum);
fd = frame_data_sequence_find(cfile.frame_set_info.frames, framenum);
}
else {
fd = cfile.current_frame;

View File

@ -274,7 +274,7 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
add_string_to_grid(grid, &row, "Packet size limit:", string_buff);
}
shb_inf = wtap_file_get_shb(cfile.wth);
shb_inf = wtap_file_get_shb(cfile.frame_set_info.wth);
/* Capture file comment area */
if (wtap_dump_can_write(cfile.linktypes, WTAP_COMMENT_PER_SECTION)) {
@ -761,7 +761,7 @@ summary_to_texbuff(GtkTextBuffer *buffer)
g_snprintf(string_buff, SUM_STR_MAX, "Capture:\n");
gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1);
shb_inf = wtap_file_get_shb(cfile.wth);
shb_inf = wtap_file_get_shb(cfile.frame_set_info.wth);
if (shb_inf != NULL) {
char *str;
@ -896,7 +896,7 @@ summary_to_texbuff(GtkTextBuffer *buffer)
gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1);
/* Trace file comments from SHB */
shb_inf = wtap_file_get_shb(cfile.wth);
shb_inf = wtap_file_get_shb(cfile.frame_set_info.wth);
if (shb_inf != NULL) {
char *opt_comment;

View File

@ -80,7 +80,7 @@ static void packet_range_calc(packet_range_t *range) {
* the capture_file structure, updating them whenever we
* filter the display, etc..
*/
if (range->cf->frames != NULL) {
if (range->cf->frame_set_info.frames != NULL) {
/* The next for-loop is used to obtain the amount of packets
* to be processed and is used to present the information in
* the Save/Print As widget.
@ -91,7 +91,7 @@ static void packet_range_calc(packet_range_t *range) {
*/
for(framenum = 1; framenum <= range->cf->count; framenum++) {
packet = frame_data_sequence_find(range->cf->frames, framenum);
packet = frame_data_sequence_find(range->cf->frame_set_info.frames, framenum);
if (range->cf->current_frame == packet) {
range->selected_packet = framenum;
@ -136,7 +136,7 @@ static void packet_range_calc(packet_range_t *range) {
}
for(framenum = 1; framenum <= range->cf->count; framenum++) {
packet = frame_data_sequence_find(range->cf->frames, framenum);
packet = frame_data_sequence_find(range->cf->frame_set_info.frames, framenum);
if (framenum >= mark_low &&
framenum <= mark_high)
@ -205,9 +205,9 @@ static void packet_range_calc_user(packet_range_t *range) {
* help, but if the user specified about *half* the packets in
* the range, that won't help, either.
*/
if (range->cf->frames != NULL) {
if (range->cf->frame_set_info.frames != NULL) {
for(framenum = 1; framenum <= range->cf->count; framenum++) {
packet = frame_data_sequence_find(range->cf->frames, framenum);
packet = frame_data_sequence_find(range->cf->frame_set_info.frames, framenum);
if (value_is_in_range(range->user_range, framenum)) {
range->user_range_cnt++;

View File

@ -233,7 +233,7 @@ ph_stats_new(capture_file *cf)
tot_bytes = 0;
for (framenum = 1; framenum <= cf->count; framenum++) {
frame = frame_data_sequence_find(cf->frames, framenum);
frame = frame_data_sequence_find(cf->frame_set_info.frames, framenum);
/* Create the progress bar if necessary.
We check on every iteration of the loop, so that

View File

@ -101,8 +101,8 @@ struct _packet_info *CaptureFile::packetInfo()
int CaptureFile::timestampPrecision()
{
if (capFile() && capFile()->wth) {
return wtap_file_tsprec(capFile()->wth);
if (capFile() && capFile()->frame_set_info.wth) {
return wtap_file_tsprec(capFile()->frame_set_info.wth);
}
return WTAP_TSPREC_UNKNOWN;
}

View File

@ -250,7 +250,7 @@ QString CaptureFilePropertiesDialog::summaryToHtml()
out << section_tmpl_.arg(tr("Capture"));
out << table_begin;
wtap_block_t shb_inf = wtap_file_get_shb(cap_file_.capFile()->wth);
wtap_block_t shb_inf = wtap_file_get_shb(cap_file_.capFile()->frame_set_info.wth);
char *str;
if (shb_inf != NULL) {
@ -531,7 +531,7 @@ void CaptureFilePropertiesDialog::fillDetails()
cursor.insertHtml(section_tmpl_.arg(tr("Packet Comments")));
for (guint32 framenum = 1; framenum <= cap_file_.capFile()->count ; framenum++) {
frame_data *fdata = frame_data_sequence_find(cap_file_.capFile()->frames, framenum);
frame_data *fdata = frame_data_sequence_find(cap_file_.capFile()->frame_set_info.frames, framenum);
char *pkt_comment = cf_get_packet_comment(cap_file_.capFile(), fdata);
if (pkt_comment) {

View File

@ -2635,7 +2635,7 @@ void MainWindow::openPacketDialog(bool from_reference)
if (framenum == 0)
return;
fdata = frame_data_sequence_find(capture_file_.capFile()->frames, framenum);
fdata = frame_data_sequence_find(capture_file_.capFile()->frame_set_info.frames, framenum);
} else {
fdata = capture_file_.capFile()->current_frame;
}

View File

@ -1125,7 +1125,7 @@ QString PacketList::allPacketComments()
if (!cap_file_) return buf_str;
for (framenum = 1; framenum <= cap_file_->count ; framenum++) {
fdata = frame_data_sequence_find(cap_file_->frames, framenum);
fdata = frame_data_sequence_find(cap_file_->frame_set_info.frames, framenum);
char *pkt_comment = cf_get_packet_comment(cap_file_, fdata);
@ -1152,7 +1152,7 @@ void PacketList::deleteAllPacketComments()
return;
for (framenum = 1; framenum <= cap_file_->count ; framenum++) {
fdata = frame_data_sequence_find(cap_file_->frames, framenum);
fdata = frame_data_sequence_find(cap_file_->frame_set_info.frames, framenum);
cf_set_user_packet_comment(cap_file_, fdata, NULL);
}

View File

@ -195,7 +195,7 @@ ResolvedAddressesDialog::ResolvedAddressesDialog(QWidget *parent, CaptureFile *c
ui->plainTextEdit->setTabStopWidth(ui->plainTextEdit->fontMetrics().averageCharWidth() * 8);
if (capture_file->isValid()) {
wtap* wth = capture_file->capFile()->wth;
wtap* wth = capture_file->capFile()->frame_set_info.wth;
if (wth) {
// might return null
wtap_block_t nrb_hdr;

View File

@ -174,7 +174,7 @@ void WirelessTimeline::mouseReleaseEvent(QMouseEvent *event)
if (num == 0)
return;
frame_data *fdata = frame_data_sequence_find(cfile.frames, num);
frame_data *fdata = frame_data_sequence_find(cfile.frame_set_info.frames, num);
if (!fdata->flags.passed_dfilter && fdata->prev_dis_num > 0)
num = fdata->prev_dis_num;
@ -528,7 +528,7 @@ WirelessTimeline::paintEvent(QPaintEvent *qpe)
QGraphicsScene qs;
for (packet = find_packet_tsf(start_tsf + left/zoom - RENDER_EARLY); packet <= cfile.count; packet++) {
frame_data *fdata = frame_data_sequence_find(cfile.frames, packet);
frame_data *fdata = frame_data_sequence_find(cfile.frame_set_info.frames, packet);
struct wlan_radio *ri = get_wlan_radio(fdata->num);
float x, width, red, green, blue;

View File

@ -298,11 +298,11 @@ time_shift_all(capture_file *cf, const gchar *offset_text)
offset_float -= offset.secs;
offset.nsecs = (int)(offset_float * 1000000000);
if (!frame_data_sequence_find(cf->frames, 1))
if (!frame_data_sequence_find(cf->frame_set_info.frames, 1))
return "No frames found."; /* Shouldn't happen */
for (i = 1; i <= cf->count; i++) {
if ((fd = frame_data_sequence_find(cf->frames, i)) == NULL)
if ((fd = frame_data_sequence_find(cf->frame_set_info.frames, i)) == NULL)
continue; /* Shouldn't happen */
modify_time_perform(fd, neg ? SHIFT_NEG : SHIFT_POS, &offset, SHIFT_KEEPOFFSET);
}
@ -329,7 +329,7 @@ time_shift_settime(capture_file *cf, guint packet_num, const gchar *time_text)
* Get a copy of the real time (abs_ts - shift_offset) do we can find out the
* difference between the specified time and the original packet
*/
if ((packetfd = frame_data_sequence_find(cf->frames, packet_num)) == NULL)
if ((packetfd = frame_data_sequence_find(cf->frame_set_info.frames, packet_num)) == NULL)
return "No packets found.";
nstime_delta(&packet_time, &(packetfd->abs_ts), &(packetfd->shift_offset));
@ -341,12 +341,12 @@ time_shift_settime(capture_file *cf, guint packet_num, const gchar *time_text)
/* Up to here nothing is changed */
if (!frame_data_sequence_find(cf->frames, 1))
if (!frame_data_sequence_find(cf->frame_set_info.frames, 1))
return "No frames found."; /* Shouldn't happen */
/* Set everything back to the original time */
for (i = 1; i <= cf->count; i++) {
if ((fd = frame_data_sequence_find(cf->frames, i)) == NULL)
if ((fd = frame_data_sequence_find(cf->frame_set_info.frames, i)) == NULL)
continue; /* Shouldn't happen */
modify_time_perform(fd, SHIFT_POS, &diff_time, SHIFT_SETTOZERO);
}
@ -387,7 +387,7 @@ time_shift_adjtime(capture_file *cf, guint packet1_num, const gchar *time1_text,
* Get a copy of the real time (abs_ts - shift_offset) do we can find out the
* difference between the specified time and the original packet
*/
if ((packet1fd = frame_data_sequence_find(cf->frames, packet1_num)) == NULL)
if ((packet1fd = frame_data_sequence_find(cf->frame_set_info.frames, packet1_num)) == NULL)
return "No frames found.";
nstime_copy(&ot1, &(packet1fd->abs_ts));
nstime_subtract(&ot1, &(packet1fd->shift_offset));
@ -399,7 +399,7 @@ time_shift_adjtime(capture_file *cf, guint packet1_num, const gchar *time1_text,
* Get a copy of the real time (abs_ts - shift_offset) do we can find out the
* difference between the specified time and the original packet
*/
if ((packet2fd = frame_data_sequence_find(cf->frames, packet2_num)) == NULL)
if ((packet2fd = frame_data_sequence_find(cf->frame_set_info.frames, packet2_num)) == NULL)
return "No frames found.";
nstime_copy(&ot2, &(packet2fd->abs_ts));
nstime_subtract(&ot2, &(packet2fd->shift_offset));
@ -414,11 +414,11 @@ time_shift_adjtime(capture_file *cf, guint packet1_num, const gchar *time1_text,
nstime_subtract(&dnt, &nt1);
/* Up to here nothing is changed */
if (!frame_data_sequence_find(cf->frames, 1))
if (!frame_data_sequence_find(cf->frame_set_info.frames, 1))
return "No frames found."; /* Shouldn't happen */
for (i = 1; i <= cf->count; i++) {
if ((fd = frame_data_sequence_find(cf->frames, i)) == NULL)
if ((fd = frame_data_sequence_find(cf->frame_set_info.frames, i)) == NULL)
continue; /* Shouldn't happen */
/* Set everything back to the original time */
@ -450,11 +450,11 @@ time_shift_undo(capture_file *cf)
nulltime.secs = nulltime.nsecs = 0;
if (!frame_data_sequence_find(cf->frames, 1))
if (!frame_data_sequence_find(cf->frame_set_info.frames, 1))
return "No frames found."; /* Shouldn't happen */
for (i = 1; i <= cf->count; i++) {
if ((fd = frame_data_sequence_find(cf->frames, i)) == NULL)
if ((fd = frame_data_sequence_find(cf->frame_set_info.frames, i)) == NULL)
continue; /* Shouldn't happen */
modify_time_perform(fd, SHIFT_NEG, &nulltime, SHIFT_SETTOZERO);
}