forked from osmocom/wireshark
Move the frame_set stuff back into the capture_file structure.
libwireshark now expects an epan_t to be created with a pointer to a "packet provider" structure; that structure is opaque within libwireshark, and a pointer to it is passed to the callbacks that provide interface names, interface, descriptions, user comments, and packet time stamps, and that set user comments. The code that calls epan_new() is expected to provide those callbacks, and to define the structure, which can be used by the providers. If none of the callbacks need that extra information, the "packet provider" structure can be null. Have a "file" packet provider for all the programs that provide packets from a file. Change-Id: I4b5709a3dd7b098ebd7d2a7d95bcdd7b5903c1a0 Reviewed-on: https://code.wireshark.org/review/24731 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
0baa4458c5
commit
797d2f6a87
|
@ -1562,6 +1562,7 @@ endif()
|
|||
# sources common for wireshark, tshark, rawshark and sharkd
|
||||
set(SHARK_COMMON_SRC
|
||||
cfile.c
|
||||
file_packet_provider.c
|
||||
frame_tvbuff.c
|
||||
sync_pipe_write.c
|
||||
version_info.c
|
||||
|
|
|
@ -379,6 +379,7 @@ EXTCAP_COMMON_SRC = \
|
|||
# sources common for wireshark, tshark, and rawshark
|
||||
SHARK_COMMON_SRC = \
|
||||
cfile.c \
|
||||
file_packet_provider.c \
|
||||
frame_tvbuff.c \
|
||||
sync_pipe_write.c
|
||||
|
||||
|
|
21
cfile.h
21
cfile.h
|
@ -16,7 +16,6 @@
|
|||
#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
|
||||
|
@ -44,6 +43,18 @@ typedef enum {
|
|||
SD_BACKWARD
|
||||
} search_direction;
|
||||
|
||||
/*
|
||||
* Packet provider for programs using a capture file.
|
||||
*/
|
||||
struct packet_provider {
|
||||
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) */
|
||||
};
|
||||
|
||||
typedef struct _capture_file {
|
||||
epan_t *epan;
|
||||
file_state state; /* Current state of capture file */
|
||||
|
@ -90,8 +101,9 @@ typedef struct _capture_file {
|
|||
/* packet data */
|
||||
struct wtap_pkthdr phdr; /* Packet header */
|
||||
Buffer buf; /* Packet data */
|
||||
/* packet provider */
|
||||
struct packet_provider provider;
|
||||
/* frames */
|
||||
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 */
|
||||
|
@ -108,6 +120,11 @@ typedef struct _capture_file {
|
|||
|
||||
extern void cap_file_init(capture_file *cf);
|
||||
|
||||
const char *cap_file_provider_get_interface_name(struct packet_provider *prov, guint32 interface_id);
|
||||
const char *cap_file_provider_get_interface_description(struct packet_provider *prov, guint32 interface_id);
|
||||
const char *cap_file_provider_get_user_comment(struct packet_provider *prov, const frame_data *fd);
|
||||
void cap_file_provider_set_user_comment(struct packet_provider *prov, frame_data *fd, const char *new_comment);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
|
|
@ -103,7 +103,6 @@ set(LIBWIRESHARK_PUBLIC_HEADERS
|
|||
follow.h
|
||||
frame_data.h
|
||||
frame_data_sequence.h
|
||||
frame_set.h
|
||||
funnel.h
|
||||
garrayfix.h
|
||||
geoip_db.h
|
||||
|
@ -208,7 +207,6 @@ set(LIBWIRESHARK_FILES
|
|||
follow.c
|
||||
frame_data.c
|
||||
frame_data_sequence.c
|
||||
frame_set.c
|
||||
funnel.c
|
||||
geoip_db.c
|
||||
golay.c
|
||||
|
|
|
@ -71,7 +71,6 @@ LIBWIRESHARK_SRC = \
|
|||
follow.c \
|
||||
frame_data.c \
|
||||
frame_data_sequence.c \
|
||||
frame_set.c \
|
||||
funnel.c \
|
||||
geoip_db.c \
|
||||
golay.c \
|
||||
|
@ -212,7 +211,6 @@ LIBWIRESHARK_INCLUDES_PUBLIC = \
|
|||
follow.h \
|
||||
frame_data.h \
|
||||
frame_data_sequence.h \
|
||||
frame_set.h \
|
||||
funnel.h \
|
||||
garrayfix.h \
|
||||
geoip_db.h \
|
||||
|
|
|
@ -23,16 +23,15 @@
|
|||
#define __EPAN_INT_H__
|
||||
|
||||
#include <epan/frame_data.h>
|
||||
#include <epan/frame_set.h>
|
||||
#include <wsutil/nstime.h>
|
||||
|
||||
struct epan_session {
|
||||
frame_set *fs;
|
||||
struct packet_provider *prov; /* packet provider for this session */
|
||||
|
||||
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);
|
||||
const nstime_t *(*get_frame_ts)(struct packet_provider *prov, guint32 frame_num);
|
||||
const char *(*get_interface_name)(struct packet_provider *prov, guint32 interface_id);
|
||||
const char *(*get_interface_description)(struct packet_provider *prov, guint32 interface_id);
|
||||
const char *(*get_user_comment)(struct packet_provider *prov, const frame_data *fd);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
14
epan/epan.c
14
epan/epan.c
|
@ -37,8 +37,8 @@
|
|||
|
||||
#include <epan/exceptions.h>
|
||||
|
||||
#include "epan-int.h"
|
||||
#include "epan.h"
|
||||
#include "epan-int.h"
|
||||
#include "dfilter/dfilter.h"
|
||||
#include "epan_dissect.h"
|
||||
|
||||
|
@ -284,10 +284,12 @@ epan_cleanup(void)
|
|||
}
|
||||
|
||||
epan_t *
|
||||
epan_new(void)
|
||||
epan_new(struct packet_provider *prov)
|
||||
{
|
||||
epan_t *session = g_slice_new0(epan_t);
|
||||
|
||||
session->prov = prov;
|
||||
|
||||
/* XXX, it should take session as param */
|
||||
init_dissection();
|
||||
|
||||
|
@ -298,7 +300,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->fs, fd);
|
||||
return session->get_user_comment(session->prov, fd);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -307,7 +309,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->fs, interface_id);
|
||||
return session->get_interface_name(session->prov, interface_id);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -316,7 +318,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->fs, interface_id);
|
||||
return session->get_interface_description(session->prov, interface_id);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -327,7 +329,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->fs, frame_num);
|
||||
abs_ts = session->get_frame_ts(session->prov, frame_num);
|
||||
|
||||
if (!abs_ts)
|
||||
ws_g_warning("!!! couldn't get frame ts for %u !!!\n", frame_num);
|
||||
|
|
10
epan/epan.h
10
epan/epan.h
|
@ -38,6 +38,14 @@ typedef struct epan_dissect epan_dissect_t;
|
|||
struct epan_dfilter;
|
||||
struct epan_column_info;
|
||||
|
||||
/*
|
||||
* Opaque structure provided when an epan_t is created; it contains
|
||||
* information needed to allow the user of libwireshark to provide
|
||||
* time stamps, comments, and other information outside the packet
|
||||
* data itself.
|
||||
*/
|
||||
struct packet_provider;
|
||||
|
||||
/**
|
||||
@mainpage Wireshark EPAN the packet analyzing engine. Source code can be found in the epan directory
|
||||
|
||||
|
@ -130,7 +138,7 @@ void epan_conversation_init(void);
|
|||
*/
|
||||
typedef struct epan_session epan_t;
|
||||
|
||||
WS_DLL_PUBLIC epan_t *epan_new(void);
|
||||
WS_DLL_PUBLIC epan_t *epan_new(struct packet_provider *prov);
|
||||
|
||||
WS_DLL_PUBLIC const char *epan_get_user_comment(const epan_t *session, const frame_data *fd);
|
||||
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
/* 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);
|
||||
WS_DLL_PUBLIC const char *frame_set_get_user_comment(frame_set *fs, const frame_data *fd);
|
||||
WS_DLL_PUBLIC void frame_set_set_user_comment(frame_set *fs, frame_data *fd, const char *new_comment);
|
||||
|
||||
#endif /* frame_set.h */
|
215
file.c
215
file.c
|
@ -223,16 +223,16 @@ static void compute_elapsed(capture_file *cf, GTimeVal *start_time)
|
|||
}
|
||||
|
||||
static const nstime_t *
|
||||
ws_get_frame_ts(frame_set *fs, guint32 frame_num)
|
||||
ws_get_frame_ts(struct packet_provider *prov, guint32 frame_num)
|
||||
{
|
||||
if (fs->prev_dis && fs->prev_dis->num == frame_num)
|
||||
return &fs->prev_dis->abs_ts;
|
||||
if (prov->prev_dis && prov->prev_dis->num == frame_num)
|
||||
return &prov->prev_dis->abs_ts;
|
||||
|
||||
if (fs->prev_cap && fs->prev_cap->num == frame_num)
|
||||
return &fs->prev_cap->abs_ts;
|
||||
if (prov->prev_cap && prov->prev_cap->num == frame_num)
|
||||
return &prov->prev_cap->abs_ts;
|
||||
|
||||
if (fs->frames) {
|
||||
frame_data *fd = frame_data_sequence_find(fs->frames, frame_num);
|
||||
if (prov->frames) {
|
||||
frame_data *fd = frame_data_sequence_find(prov->frames, frame_num);
|
||||
|
||||
return (fd) ? &fd->abs_ts : NULL;
|
||||
}
|
||||
|
@ -243,13 +243,12 @@ ws_get_frame_ts(frame_set *fs, guint32 frame_num)
|
|||
static epan_t *
|
||||
ws_epan_new(capture_file *cf)
|
||||
{
|
||||
epan_t *epan = epan_new();
|
||||
epan_t *epan = epan_new(&cf->provider);
|
||||
|
||||
epan->fs = &cf->frame_set_info;
|
||||
epan->get_frame_ts = ws_get_frame_ts;
|
||||
epan->get_interface_name = frame_set_get_interface_name;
|
||||
epan->get_interface_description = frame_set_get_interface_description;
|
||||
epan->get_user_comment = frame_set_get_user_comment;
|
||||
epan->get_interface_name = cap_file_provider_get_interface_name;
|
||||
epan->get_interface_description = cap_file_provider_get_interface_description;
|
||||
epan->get_user_comment = cap_file_provider_get_user_comment;
|
||||
|
||||
return epan;
|
||||
}
|
||||
|
@ -283,7 +282,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->frame_set_info.wth = wth;
|
||||
cf->provider.wth = wth;
|
||||
cf->f_datalen = 0;
|
||||
|
||||
/* Set the file name because we need it to set the follow stream filter.
|
||||
|
@ -299,7 +298,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->frame_set_info.wth);
|
||||
cf->cd_t = wtap_file_type_subtype(cf->provider.wth);
|
||||
cf->open_type = type;
|
||||
cf->linktypes = g_array_sized_new(FALSE, FALSE, (guint) sizeof(int), 1);
|
||||
cf->count = 0;
|
||||
|
@ -310,15 +309,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->frame_set_info.wth);
|
||||
cf->snap = wtap_snapshot_length(cf->provider.wth);
|
||||
|
||||
/* Allocate a frame_data_sequence for the frames in this file */
|
||||
cf->frame_set_info.frames = new_frame_data_sequence();
|
||||
cf->provider.frames = new_frame_data_sequence();
|
||||
|
||||
nstime_set_zero(&cf->elapsed_time);
|
||||
cf->frame_set_info.ref = NULL;
|
||||
cf->frame_set_info.prev_dis = NULL;
|
||||
cf->frame_set_info.prev_cap = NULL;
|
||||
cf->provider.ref = NULL;
|
||||
cf->provider.prev_dis = NULL;
|
||||
cf->provider.prev_cap = NULL;
|
||||
cf->cum_bytes = 0;
|
||||
|
||||
packet_list_queue_draw();
|
||||
|
@ -329,8 +328,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->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);
|
||||
wtap_set_cb_new_ipv4(cf->provider.wth, add_ipv4_name);
|
||||
wtap_set_cb_new_ipv6(cf->provider.wth, (wtap_new_ipv6_callback_t) add_ipv6_name);
|
||||
|
||||
return CF_OK;
|
||||
|
||||
|
@ -371,9 +370,9 @@ cf_close(capture_file *cf)
|
|||
/* close things, if not already closed before */
|
||||
color_filters_cleanup();
|
||||
|
||||
if (cf->frame_set_info.wth) {
|
||||
wtap_close(cf->frame_set_info.wth);
|
||||
cf->frame_set_info.wth = NULL;
|
||||
if (cf->provider.wth) {
|
||||
wtap_close(cf->provider.wth);
|
||||
cf->provider.wth = NULL;
|
||||
}
|
||||
/* We have no file open... */
|
||||
if (cf->filename != NULL) {
|
||||
|
@ -397,13 +396,13 @@ cf_close(capture_file *cf)
|
|||
|
||||
dfilter_free(cf->rfcode);
|
||||
cf->rfcode = 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->provider.frames != NULL) {
|
||||
free_frame_data_sequence(cf->provider.frames);
|
||||
cf->provider.frames = 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;
|
||||
if (cf->provider.frames_user_comments) {
|
||||
g_tree_destroy(cf->provider.frames_user_comments);
|
||||
cf->provider.frames_user_comments = NULL;
|
||||
}
|
||||
cf_unselect_packet(cf); /* nothing to select */
|
||||
cf->first_displayed = 0;
|
||||
|
@ -469,7 +468,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->frame_set_info.wth, NULL);
|
||||
size = wtap_file_size(cf->provider.wth, NULL);
|
||||
|
||||
if (size >= 0)
|
||||
progbar_val = (gfloat) file_pos / (gfloat) size;
|
||||
|
@ -544,7 +543,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->frame_set_info.wth);
|
||||
cf->iscompressed = wtap_iscompressed(cf->provider.wth);
|
||||
|
||||
/* The packet list window will be empty until the file is completly loaded */
|
||||
packet_list_freeze();
|
||||
|
@ -570,14 +569,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->frame_set_info.wth, NULL);
|
||||
size = wtap_file_size(cf->provider.wth, NULL);
|
||||
|
||||
g_timer_start(prog_timer);
|
||||
|
||||
while ((wtap_read(cf->frame_set_info.wth, &err, &err_info, &data_offset))) {
|
||||
while ((wtap_read(cf->provider.wth, &err, &err_info, &data_offset))) {
|
||||
if (size >= 0) {
|
||||
count++;
|
||||
file_pos = wtap_read_so_far(cf->frame_set_info.wth);
|
||||
file_pos = wtap_read_so_far(cf->provider.wth);
|
||||
|
||||
/* Create the progress bar if necessary. */
|
||||
if (progress_is_slow(progbar, prog_timer, size, file_pos)) {
|
||||
|
@ -657,7 +656,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->frame_set_info.wth);
|
||||
wtap_sequential_close(cf->provider.wth);
|
||||
|
||||
/* Allow the protocol dissectors to free up memory that they
|
||||
* don't need after the sequential run-through of the packets. */
|
||||
|
@ -670,9 +669,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->frame_set_info.wth);
|
||||
cf->lnk_t = wtap_file_encap(cf->provider.wth);
|
||||
|
||||
cf->current_frame = frame_data_sequence_find(cf->frame_set_info.frames, cf->first_displayed);
|
||||
cf->current_frame = frame_data_sequence_find(cf->provider.frames, cf->first_displayed);
|
||||
cf->current_row = 0;
|
||||
|
||||
packet_list_thaw();
|
||||
|
@ -774,8 +773,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->frame_set_info.wth);
|
||||
if (!wtap_read(cf->frame_set_info.wth, err, &err_info, &data_offset)) {
|
||||
wtap_cleareof(cf->provider.wth);
|
||||
if (!wtap_read(cf->provider.wth, err, &err_info, &data_offset)) {
|
||||
break;
|
||||
}
|
||||
if (cf->state == FILE_READ_ABORTED) {
|
||||
|
@ -807,7 +806,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->frame_set_info.wth);
|
||||
cf->lnk_t = wtap_file_encap(cf->provider.wth);
|
||||
|
||||
/* Cleanup and release all dfilter resources */
|
||||
dfilter_free(dfcode);
|
||||
|
@ -900,7 +899,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->frame_set_info.wth == NULL) {
|
||||
if (cf->provider.wth == NULL) {
|
||||
cf_close(cf);
|
||||
return CF_READ_ERROR;
|
||||
}
|
||||
|
@ -911,7 +910,7 @@ cf_finish_tail(capture_file *cf, int *err)
|
|||
|
||||
epan_dissect_init(&edt, cf->epan, create_proto_tree, FALSE);
|
||||
|
||||
while ((wtap_read(cf->frame_set_info.wth, err, &err_info, &data_offset))) {
|
||||
while ((wtap_read(cf->provider.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
|
||||
|
@ -947,7 +946,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->frame_set_info.wth);
|
||||
wtap_sequential_close(cf->provider.wth);
|
||||
|
||||
/* Allow the protocol dissectors to free up memory that they
|
||||
* don't need after the sequential run-through of the packets. */
|
||||
|
@ -955,7 +954,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->frame_set_info.wth);
|
||||
cf->lnk_t = wtap_file_encap(cf->provider.wth);
|
||||
|
||||
/* Update the details in the file-set dialog, as the capture file
|
||||
* has likely grown since we first stat-ed it */
|
||||
|
@ -1082,8 +1081,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->frame_set_info.ref, cf->frame_set_info.prev_dis);
|
||||
cf->frame_set_info.prev_cap = fdata;
|
||||
&cf->provider.ref, cf->provider.prev_dis);
|
||||
cf->provider.prev_cap = fdata;
|
||||
|
||||
if (dfcode != NULL) {
|
||||
epan_dissect_prime_with_dfilter(edt, dfcode);
|
||||
|
@ -1116,7 +1115,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->frame_set_info.frames);
|
||||
g_slist_foreach(edt->pi.dependent_frames, find_and_mark_frame_depended_upon, cf->provider.frames);
|
||||
}
|
||||
} else
|
||||
fdata->flags.passed_dfilter = 1;
|
||||
|
@ -1132,7 +1131,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->frame_set_info.prev_dis = fdata;
|
||||
cf->provider.prev_dis = fdata;
|
||||
|
||||
/* If we haven't yet seen the first frame, this is it. */
|
||||
if (cf->first_displayed == 0)
|
||||
|
@ -1152,8 +1151,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->frame_set_info.wth);
|
||||
const guint8 *buf = wtap_buf_ptr(cf->frame_set_info.wth);
|
||||
struct wtap_pkthdr *phdr = wtap_phdr(cf->provider.wth);
|
||||
const guint8 *buf = wtap_buf_ptr(cf->provider.wth);
|
||||
frame_data fdlocal;
|
||||
guint32 framenum;
|
||||
frame_data *fdata;
|
||||
|
@ -1186,7 +1185,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->frame_set_info.frames, &fdlocal);
|
||||
fdata = frame_data_sequence_add(cf->provider.frames, &fdlocal);
|
||||
|
||||
cf->count++;
|
||||
if (phdr->opt_comment != NULL)
|
||||
|
@ -1479,7 +1478,7 @@ cf_read_record_r(capture_file *cf, const frame_data *fdata,
|
|||
int err;
|
||||
gchar *err_info;
|
||||
|
||||
if (!wtap_seek_read(cf->frame_set_info.wth, fdata->file_off, phdr, buf, &err, &err_info)) {
|
||||
if (!wtap_seek_read(cf->provider.wth, fdata->file_off, phdr, buf, &err, &err_info)) {
|
||||
cfile_read_failure_alert_box(cf->filename, err, err_info);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1616,9 +1615,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->frame_set_info.ref = NULL;
|
||||
cf->frame_set_info.prev_dis = NULL;
|
||||
cf->frame_set_info.prev_cap = NULL;
|
||||
cf->provider.ref = NULL;
|
||||
cf->provider.prev_dis = NULL;
|
||||
cf->provider.prev_cap = NULL;
|
||||
cf->cum_bytes = 0;
|
||||
|
||||
cf_callback_invoke(cf_cb_file_rescan_started, cf);
|
||||
|
@ -1648,7 +1647,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->frame_set_info.frames, framenum);
|
||||
fdata = frame_data_sequence_find(cf->provider.frames, framenum);
|
||||
|
||||
/* Create the progress bar if necessary.
|
||||
We check on every iteration of the loop, so that it takes no
|
||||
|
@ -1766,7 +1765,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->frame_set_info.frames, framenum);
|
||||
fdata = frame_data_sequence_find(cf->provider.frames, framenum);
|
||||
frame_data_reset(fdata);
|
||||
}
|
||||
}
|
||||
|
@ -1864,12 +1863,12 @@ ref_time_packets(capture_file *cf)
|
|||
frame_data *fdata;
|
||||
nstime_t rel_ts;
|
||||
|
||||
cf->frame_set_info.ref = NULL;
|
||||
cf->frame_set_info.prev_dis = NULL;
|
||||
cf->provider.ref = NULL;
|
||||
cf->provider.prev_dis = NULL;
|
||||
cf->cum_bytes = 0;
|
||||
|
||||
for (framenum = 1; framenum <= cf->count; framenum++) {
|
||||
fdata = frame_data_sequence_find(cf->frame_set_info.frames, framenum);
|
||||
fdata = frame_data_sequence_find(cf->provider.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;
|
||||
|
@ -1881,24 +1880,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->frame_set_info.ref == NULL)
|
||||
cf->frame_set_info.ref = fdata;
|
||||
if (cf->provider.ref == NULL)
|
||||
cf->provider.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->frame_set_info.ref = fdata;
|
||||
cf->provider.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->frame_set_info.prev_dis == NULL) {
|
||||
cf->frame_set_info.prev_dis = fdata;
|
||||
if (cf->provider.prev_dis == NULL) {
|
||||
cf->provider.prev_dis = fdata;
|
||||
}
|
||||
|
||||
/* Get the time elapsed between the first packet and this packet. */
|
||||
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);
|
||||
fdata->frame_ref_num = (fdata != cf->provider.ref) ? cf->provider.ref->num : 0;
|
||||
nstime_delta(&rel_ts, &fdata->abs_ts, &cf->provider.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
|
||||
|
@ -1911,8 +1910,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->frame_set_info.prev_dis->num;
|
||||
cf->frame_set_info.prev_dis = fdata;
|
||||
fdata->prev_dis_num = cf->provider.prev_dis->num;
|
||||
cf->provider.prev_dis = fdata;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1980,7 +1979,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->frame_set_info.frames, framenum);
|
||||
fdata = frame_data_sequence_find(cf->provider.frames, framenum);
|
||||
|
||||
/* Create the progress bar if necessary.
|
||||
We check on every iteration of the loop, so that it takes no
|
||||
|
@ -3505,7 +3504,7 @@ find_packet(capture_file *cf,
|
|||
} else
|
||||
framenum++;
|
||||
}
|
||||
fdata = frame_data_sequence_find(cf->frame_set_info.frames, framenum);
|
||||
fdata = frame_data_sequence_find(cf->provider.frames, framenum);
|
||||
|
||||
count++;
|
||||
|
||||
|
@ -3565,13 +3564,13 @@ cf_goto_frame(capture_file *cf, guint fnumber)
|
|||
{
|
||||
frame_data *fdata;
|
||||
|
||||
if (cf == NULL || cf->frame_set_info.frames == NULL) {
|
||||
if (cf == NULL || cf->provider.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->frame_set_info.frames, fnumber);
|
||||
fdata = frame_data_sequence_find(cf->provider.frames, fnumber);
|
||||
|
||||
if (fdata == NULL) {
|
||||
/* we didn't find a packet with that packet number */
|
||||
|
@ -3754,7 +3753,7 @@ cf_read_section_comment(capture_file *cf)
|
|||
|
||||
/* Get the SHB. */
|
||||
/* XXX - support multiple SHBs */
|
||||
shb_inf = wtap_file_get_shb(cf->frame_set_info.wth);
|
||||
shb_inf = wtap_file_get_shb(cf->provider.wth);
|
||||
|
||||
/* Get the first comment from the SHB. */
|
||||
/* XXX - support multiple comments */
|
||||
|
@ -3774,7 +3773,7 @@ cf_update_section_comment(capture_file *cf, gchar *comment)
|
|||
|
||||
/* Get the SHB. */
|
||||
/* XXX - support multiple SHBs */
|
||||
shb_inf = wtap_file_get_shb(cf->frame_set_info.wth);
|
||||
shb_inf = wtap_file_get_shb(cf->provider.wth);
|
||||
|
||||
/* Get the first comment from the SHB. */
|
||||
/* XXX - support multiple comments */
|
||||
|
@ -3807,7 +3806,7 @@ cf_get_packet_comment(capture_file *cf, const frame_data *fd)
|
|||
|
||||
/* fetch user comment */
|
||||
if (fd->flags.has_user_comment)
|
||||
return g_strdup(frame_set_get_user_comment(&cf->frame_set_info, fd));
|
||||
return g_strdup(cap_file_provider_get_user_comment(&cf->provider, fd));
|
||||
|
||||
/* fetch phdr comment */
|
||||
if (fd->flags.has_phdr_comment) {
|
||||
|
@ -3849,7 +3848,7 @@ cf_set_user_packet_comment(capture_file *cf, frame_data *fd, const gchar *new_co
|
|||
if (new_comment)
|
||||
cf->packet_comment_count++;
|
||||
|
||||
frame_set_set_user_comment(&cf->frame_set_info, fd, new_comment);
|
||||
cap_file_provider_set_user_comment(&cf->provider, fd, new_comment);
|
||||
|
||||
expert_update_comment_count(cf->packet_comment_count);
|
||||
|
||||
|
@ -3916,7 +3915,7 @@ save_record(capture_file *cf, frame_data *fdata,
|
|||
const char *pkt_comment;
|
||||
|
||||
if (fdata->flags.has_user_comment)
|
||||
pkt_comment = frame_set_get_user_comment(&cf->frame_set_info, fdata);
|
||||
pkt_comment = cap_file_provider_get_user_comment(&cf->provider, fdata);
|
||||
else
|
||||
pkt_comment = phdr->opt_comment;
|
||||
|
||||
|
@ -4096,7 +4095,7 @@ rescan_file(capture_file *cf, const char *fname, gboolean is_tempfile)
|
|||
int count = 0;
|
||||
|
||||
/* Close the old handle. */
|
||||
wtap_close(cf->frame_set_info.wth);
|
||||
wtap_close(cf->provider.wth);
|
||||
|
||||
/* Open the new file. */
|
||||
/* XXX: this will go through all open_routines for a matching one. But right
|
||||
|
@ -4104,8 +4103,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->frame_set_info.wth = wtap_open_offline(fname, WTAP_TYPE_AUTO, &err, &err_info, TRUE);
|
||||
if (cf->frame_set_info.wth == NULL) {
|
||||
cf->provider.wth = wtap_open_offline(fname, WTAP_TYPE_AUTO, &err, &err_info, TRUE);
|
||||
if (cf->provider.wth == NULL) {
|
||||
cfile_open_failure_alert_box(fname, err, err_info);
|
||||
return CF_READ_ERROR;
|
||||
}
|
||||
|
@ -4125,10 +4124,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->frame_set_info.wth);
|
||||
cf->cd_t = wtap_file_type_subtype(cf->provider.wth);
|
||||
cf->linktypes = g_array_sized_new(FALSE, FALSE, (guint) sizeof(int), 1);
|
||||
|
||||
cf->snap = wtap_snapshot_length(cf->frame_set_info.wth);
|
||||
cf->snap = wtap_snapshot_length(cf->provider.wth);
|
||||
|
||||
name_ptr = g_filename_display_basename(cf->filename);
|
||||
|
||||
|
@ -4136,10 +4135,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->frame_set_info.wth);
|
||||
cf->iscompressed = wtap_iscompressed(cf->provider.wth);
|
||||
|
||||
/* Find the size of the file. */
|
||||
size = wtap_file_size(cf->frame_set_info.wth, NULL);
|
||||
size = wtap_file_size(cf->provider.wth, NULL);
|
||||
|
||||
g_timer_start(prog_timer);
|
||||
|
||||
|
@ -4147,14 +4146,14 @@ rescan_file(capture_file *cf, const char *fname, gboolean is_tempfile)
|
|||
g_get_current_time(&start_time);
|
||||
|
||||
framenum = 0;
|
||||
phdr = wtap_phdr(cf->frame_set_info.wth);
|
||||
while ((wtap_read(cf->frame_set_info.wth, &err, &err_info, &data_offset))) {
|
||||
phdr = wtap_phdr(cf->provider.wth);
|
||||
while ((wtap_read(cf->provider.wth, &err, &err_info, &data_offset))) {
|
||||
framenum++;
|
||||
fdata = frame_data_sequence_find(cf->frame_set_info.frames, framenum);
|
||||
fdata = frame_data_sequence_find(cf->provider.frames, framenum);
|
||||
fdata->file_off = data_offset;
|
||||
if (size >= 0) {
|
||||
count++;
|
||||
cf->f_datalen = wtap_read_so_far(cf->frame_set_info.wth);
|
||||
cf->f_datalen = wtap_read_so_far(cf->provider.wth);
|
||||
|
||||
/* Create the progress bar if necessary. */
|
||||
if (progress_is_slow(progbar, prog_timer, size, cf->f_datalen)) {
|
||||
|
@ -4207,7 +4206,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->frame_set_info.wth);
|
||||
wtap_sequential_close(cf->provider.wth);
|
||||
|
||||
/* compute the time it took to load the file */
|
||||
compute_elapsed(cf, &start_time);
|
||||
|
@ -4216,7 +4215,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->frame_set_info.wth);
|
||||
cf->lnk_t = wtap_file_encap(cf->provider.wth);
|
||||
|
||||
cf_callback_invoke(cf_cb_file_rescan_finished, cf);
|
||||
|
||||
|
@ -4350,9 +4349,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->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);
|
||||
shb_hdrs = wtap_file_get_shb_for_new_file(cf->provider.wth);
|
||||
idb_inf = wtap_file_get_idb_info(cf->provider.wth);
|
||||
nrb_hdrs = wtap_file_get_nrb_for_new_file(cf->provider.wth);
|
||||
|
||||
/* Determine what file encapsulation type we should use. */
|
||||
encap = wtap_dump_file_encap_type(cf->linktypes);
|
||||
|
@ -4430,7 +4429,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->frame_set_info.wth);
|
||||
wtap_fdclose(cf->provider.wth);
|
||||
#endif
|
||||
/* Now do the rename. */
|
||||
if (ws_rename(fname_new, fname) == -1) {
|
||||
|
@ -4440,7 +4439,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->frame_set_info.wth, cf->filename, &err)) {
|
||||
if (!wtap_fdreopen(cf->provider.wth, cf->filename, &err)) {
|
||||
/* Oh, well, we're screwed. */
|
||||
display_basename = g_filename_display_basename(cf->filename);
|
||||
simple_error_message_box(
|
||||
|
@ -4473,13 +4472,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->frame_set_info.wth);
|
||||
wtap_close(cf->provider.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->frame_set_info.wth = wtap_open_offline(fname, WTAP_TYPE_AUTO, &err, &err_info, TRUE);
|
||||
if (cf->frame_set_info.wth == NULL) {
|
||||
cf->provider.wth = wtap_open_offline(fname, WTAP_TYPE_AUTO, &err, &err_info, TRUE);
|
||||
if (cf->provider.wth == NULL) {
|
||||
cfile_open_failure_alert_box(fname, err, err_info);
|
||||
cf_close(cf);
|
||||
} else {
|
||||
|
@ -4542,19 +4541,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->frame_set_info.wth, NULL);
|
||||
wtap_write_shb_comment(cf->provider.wth, NULL);
|
||||
|
||||
/* remove all user comments */
|
||||
for (framenum = 1; framenum <= cf->count; framenum++) {
|
||||
fdata = frame_data_sequence_find(cf->frame_set_info.frames, framenum);
|
||||
fdata = frame_data_sequence_find(cf->provider.frames, framenum);
|
||||
|
||||
fdata->flags.has_phdr_comment = FALSE;
|
||||
fdata->flags.has_user_comment = FALSE;
|
||||
}
|
||||
|
||||
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;
|
||||
if (cf->provider.frames_user_comments) {
|
||||
g_tree_destroy(cf->provider.frames_user_comments);
|
||||
cf->provider.frames_user_comments = NULL;
|
||||
}
|
||||
|
||||
cf->packet_comment_count = 0;
|
||||
|
@ -4601,9 +4600,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->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);
|
||||
shb_hdrs = wtap_file_get_shb_for_new_file(cf->provider.wth);
|
||||
idb_inf = wtap_file_get_idb_info(cf->provider.wth);
|
||||
nrb_hdrs = wtap_file_get_nrb_for_new_file(cf->provider.wth);
|
||||
|
||||
/* Determine what file encapsulation type we should use. */
|
||||
encap = wtap_dump_file_encap_type(cf->linktypes);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* frame_set.c
|
||||
* fdfdkfslf;ajkdf
|
||||
/* file_packet_provider.c
|
||||
* Routines for a packet_provider for packets from a file.
|
||||
*
|
||||
* Wireshark - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@wireshark.org>
|
||||
|
@ -10,7 +10,7 @@
|
|||
|
||||
#include <glib.h>
|
||||
|
||||
#include <epan/frame_set.h>
|
||||
#include "cfile.h"
|
||||
|
||||
static int
|
||||
frame_cmp(gconstpointer a, gconstpointer b, gpointer user_data _U_)
|
||||
|
@ -24,13 +24,13 @@ frame_cmp(gconstpointer a, gconstpointer b, gpointer user_data _U_)
|
|||
}
|
||||
|
||||
const char *
|
||||
frame_set_get_interface_name(frame_set *fs, guint32 interface_id)
|
||||
cap_file_provider_get_interface_name(struct packet_provider *prov, 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);
|
||||
idb_info = wtap_file_get_idb_info(prov->wth);
|
||||
|
||||
if (interface_id < idb_info->interface_data->len)
|
||||
wtapng_if_descr = g_array_index(idb_info->interface_data, wtap_block_t, interface_id);
|
||||
|
@ -47,13 +47,13 @@ frame_set_get_interface_name(frame_set *fs, guint32 interface_id)
|
|||
}
|
||||
|
||||
const char *
|
||||
frame_set_get_interface_description(frame_set *fs, guint32 interface_id)
|
||||
cap_file_provider_get_interface_description(struct packet_provider *prov, 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);
|
||||
idb_info = wtap_file_get_idb_info(prov->wth);
|
||||
|
||||
if (interface_id < idb_info->interface_data->len)
|
||||
wtapng_if_descr = g_array_index(idb_info->interface_data, wtap_block_t, interface_id);
|
||||
|
@ -68,23 +68,23 @@ frame_set_get_interface_description(frame_set *fs, guint32 interface_id)
|
|||
}
|
||||
|
||||
const char *
|
||||
frame_set_get_user_comment(frame_set *fs, const frame_data *fd)
|
||||
cap_file_provider_get_user_comment(struct packet_provider *prov, const frame_data *fd)
|
||||
{
|
||||
if (fs->frames_user_comments)
|
||||
return (const char *)g_tree_lookup(fs->frames_user_comments, fd);
|
||||
if (prov->frames_user_comments)
|
||||
return (const char *)g_tree_lookup(prov->frames_user_comments, fd);
|
||||
|
||||
/* g_warning? */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
frame_set_set_user_comment(frame_set *fs, frame_data *fd, const char *new_comment)
|
||||
cap_file_provider_set_user_comment(struct packet_provider *prov, frame_data *fd, const char *new_comment)
|
||||
{
|
||||
if (!fs->frames_user_comments)
|
||||
fs->frames_user_comments = g_tree_new_full(frame_cmp, NULL, NULL, g_free);
|
||||
if (!prov->frames_user_comments)
|
||||
prov->frames_user_comments = g_tree_new_full(frame_cmp, NULL, NULL, g_free);
|
||||
|
||||
/* insert new packet comment */
|
||||
g_tree_replace(fs->frames_user_comments, fd, g_strdup(new_comment));
|
||||
g_tree_replace(prov->frames_user_comments, fd, g_strdup(new_comment));
|
||||
|
||||
fd->flags.has_user_comment = TRUE;
|
||||
}
|
|
@ -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.frame_set_info.wth != frame_tvb->wth)
|
||||
if (cfile.provider.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.frame_set_info.wth && cfile.frame_set_info.wth->random_fh) {
|
||||
frame_tvb->wth = cfile.frame_set_info.wth;
|
||||
if (cfile.provider.wth && cfile.provider.wth->random_fh) {
|
||||
frame_tvb->wth = cfile.provider.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.frame_set_info.wth && cfile.frame_set_info.wth->random_fh) {
|
||||
frame_tvb->wth = cfile.frame_set_info.wth;
|
||||
if (cfile.provider.wth && cfile.provider.wth->random_fh) {
|
||||
frame_tvb->wth = cfile.provider.wth;
|
||||
frame_tvb->file_off = fd->file_off;
|
||||
frame_tvb->offset = 0;
|
||||
} else
|
||||
|
|
39
rawshark.c
39
rawshark.c
|
@ -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->frame_set_info.ref, cf->frame_set_info.prev_dis);
|
||||
&cf->provider.ref, cf->provider.prev_dis);
|
||||
|
||||
if (cf->frame_set_info.ref == &fdata) {
|
||||
if (cf->provider.ref == &fdata) {
|
||||
ref_frame = fdata;
|
||||
cf->frame_set_info.ref = &ref_frame;
|
||||
cf->provider.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->frame_set_info.prev_dis = &prev_dis_frame;
|
||||
cf->provider.prev_dis = &prev_dis_frame;
|
||||
|
||||
prev_cap_frame = fdata;
|
||||
cf->frame_set_info.prev_cap = &prev_cap_frame;
|
||||
cf->provider.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(frame_set *fs, guint32 frame_num)
|
||||
raw_get_frame_ts(struct packet_provider *prov, guint32 frame_num)
|
||||
{
|
||||
if (fs->ref && fs->ref->num == frame_num)
|
||||
return &fs->ref->abs_ts;
|
||||
if (prov->ref && prov->ref->num == frame_num)
|
||||
return &prov->ref->abs_ts;
|
||||
|
||||
if (fs->prev_dis && fs->prev_dis->num == frame_num)
|
||||
return &fs->prev_dis->abs_ts;
|
||||
if (prov->prev_dis && prov->prev_dis->num == frame_num)
|
||||
return &prov->prev_dis->abs_ts;
|
||||
|
||||
if (fs->prev_cap && fs->prev_cap->num == frame_num)
|
||||
return &fs->prev_cap->abs_ts;
|
||||
if (prov->prev_cap && prov->prev_cap->num == frame_num)
|
||||
return &prov->prev_cap->abs_ts;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1481,12 +1481,11 @@ raw_get_frame_ts(frame_set *fs, guint32 frame_num)
|
|||
static epan_t *
|
||||
raw_epan_new(capture_file *cf)
|
||||
{
|
||||
epan_t *epan = epan_new();
|
||||
epan_t *epan = epan_new(&cf->provider);
|
||||
|
||||
epan->fs = &cf->frame_set_info;
|
||||
epan->get_frame_ts = raw_get_frame_ts;
|
||||
epan->get_interface_name = frame_set_get_interface_name;
|
||||
epan->get_interface_description = frame_set_get_interface_description;
|
||||
epan->get_interface_name = cap_file_provider_get_interface_name;
|
||||
epan->get_interface_description = cap_file_provider_get_interface_description;
|
||||
epan->get_user_comment = NULL;
|
||||
|
||||
return epan;
|
||||
|
@ -1504,7 +1503,7 @@ raw_cf_open(capture_file *cf, const char *fname)
|
|||
epan_free(cf->epan);
|
||||
cf->epan = raw_epan_new(cf);
|
||||
|
||||
cf->frame_set_info.wth = NULL;
|
||||
cf->provider.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 +1524,9 @@ raw_cf_open(capture_file *cf, const char *fname)
|
|||
cf->drops = 0;
|
||||
cf->snap = 0;
|
||||
nstime_set_zero(&cf->elapsed_time);
|
||||
cf->frame_set_info.ref = NULL;
|
||||
cf->frame_set_info.prev_dis = NULL;
|
||||
cf->frame_set_info.prev_cap = NULL;
|
||||
cf->provider.ref = NULL;
|
||||
cf->provider.prev_dis = NULL;
|
||||
cf->provider.prev_cap = NULL;
|
||||
|
||||
return CF_OK;
|
||||
}
|
||||
|
|
81
sharkd.c
81
sharkd.c
|
@ -221,19 +221,19 @@ clean_exit:
|
|||
}
|
||||
|
||||
static const nstime_t *
|
||||
sharkd_get_frame_ts(frame_set *fs, guint32 frame_num)
|
||||
sharkd_get_frame_ts(struct packet_provider *prov, guint32 frame_num)
|
||||
{
|
||||
if (fs->ref && fs->ref->num == frame_num)
|
||||
return &fs->ref->abs_ts;
|
||||
if (prov->ref && prov->ref->num == frame_num)
|
||||
return &prov->ref->abs_ts;
|
||||
|
||||
if (fs->prev_dis && fs->prev_dis->num == frame_num)
|
||||
return &fs->prev_dis->abs_ts;
|
||||
if (prov->prev_dis && prov->prev_dis->num == frame_num)
|
||||
return &prov->prev_dis->abs_ts;
|
||||
|
||||
if (fs->prev_cap && fs->prev_cap->num == frame_num)
|
||||
return &fs->prev_cap->abs_ts;
|
||||
if (prov->prev_cap && prov->prev_cap->num == frame_num)
|
||||
return &prov->prev_cap->abs_ts;
|
||||
|
||||
if (fs->frames) {
|
||||
frame_data *fd = frame_data_sequence_find(fs->frames, frame_num);
|
||||
if (prov->frames) {
|
||||
frame_data *fd = frame_data_sequence_find(prov->frames, frame_num);
|
||||
|
||||
return (fd) ? &fd->abs_ts : NULL;
|
||||
}
|
||||
|
@ -244,13 +244,12 @@ sharkd_get_frame_ts(frame_set *fs, guint32 frame_num)
|
|||
static epan_t *
|
||||
sharkd_epan_new(capture_file *cf)
|
||||
{
|
||||
epan_t *epan = epan_new();
|
||||
epan_t *epan = epan_new(&cf->provider);
|
||||
|
||||
epan->fs = &cf->frame_set_info;
|
||||
epan->get_frame_ts = sharkd_get_frame_ts;
|
||||
epan->get_interface_name = frame_set_get_interface_name;
|
||||
epan->get_interface_description = frame_set_get_interface_description;
|
||||
epan->get_user_comment = frame_set_get_user_comment;
|
||||
epan->get_interface_name = cap_file_provider_get_interface_name;
|
||||
epan->get_interface_description = cap_file_provider_get_interface_description;
|
||||
epan->get_user_comment = cap_file_provider_get_user_comment;
|
||||
|
||||
return epan;
|
||||
}
|
||||
|
@ -297,10 +296,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->frame_set_info.ref, cf->frame_set_info.prev_dis);
|
||||
if (cf->frame_set_info.ref == &fdlocal) {
|
||||
&cf->provider.ref, cf->provider.prev_dis);
|
||||
if (cf->provider.ref == &fdlocal) {
|
||||
ref_frame = fdlocal;
|
||||
cf->frame_set_info.ref = &ref_frame;
|
||||
cf->provider.ref = &ref_frame;
|
||||
}
|
||||
|
||||
epan_dissect_run(edt, cf->cd_t, whdr, frame_tvbuff_new(&fdlocal, pd), &fdlocal, NULL);
|
||||
|
@ -312,7 +311,7 @@ process_packet(capture_file *cf, epan_dissect_t *edt,
|
|||
|
||||
if (passed) {
|
||||
frame_data_set_after_dissect(&fdlocal, &cum_bytes);
|
||||
cf->frame_set_info.prev_cap = cf->frame_set_info.prev_dis = frame_data_sequence_add(cf->frame_set_info.frames, &fdlocal);
|
||||
cf->provider.prev_cap = cf->provider.prev_dis = frame_data_sequence_add(cf->provider.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 +321,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->frame_set_info.frames);
|
||||
g_slist_foreach(edt->pi.dependent_frames, find_and_mark_frame_depended_upon, cf->provider.frames);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -350,7 +349,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->frame_set_info.frames = new_frame_data_sequence();
|
||||
cf->provider.frames = new_frame_data_sequence();
|
||||
|
||||
{
|
||||
gboolean create_proto_tree;
|
||||
|
@ -374,9 +373,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->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))) {
|
||||
while (wtap_read(cf->provider.wth, &err, &err_info, &data_offset)) {
|
||||
if (process_packet(cf, edt, data_offset, wtap_phdr(cf->provider.wth),
|
||||
wtap_buf_ptr(cf->provider.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 +394,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->frame_set_info.wth);
|
||||
wtap_sequential_close(cf->provider.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->frame_set_info.prev_dis = NULL;
|
||||
cf->frame_set_info.prev_cap = NULL;
|
||||
cf->provider.prev_dis = NULL;
|
||||
cf->provider.prev_cap = NULL;
|
||||
}
|
||||
|
||||
if (err != 0) {
|
||||
|
@ -428,7 +427,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->frame_set_info.wth = wth;
|
||||
cf->provider.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 +441,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->frame_set_info.wth);
|
||||
cf->cd_t = wtap_file_type_subtype(cf->provider.wth);
|
||||
cf->open_type = type;
|
||||
cf->count = 0;
|
||||
cf->drops_known = FALSE;
|
||||
cf->drops = 0;
|
||||
cf->snap = wtap_snapshot_length(cf->frame_set_info.wth);
|
||||
cf->snap = wtap_snapshot_length(cf->provider.wth);
|
||||
nstime_set_zero(&cf->elapsed_time);
|
||||
cf->frame_set_info.ref = NULL;
|
||||
cf->frame_set_info.prev_dis = NULL;
|
||||
cf->frame_set_info.prev_cap = NULL;
|
||||
cf->provider.ref = NULL;
|
||||
cf->provider.prev_dis = NULL;
|
||||
cf->provider.prev_cap = NULL;
|
||||
|
||||
cf->state = FILE_READ_IN_PROGRESS;
|
||||
|
||||
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);
|
||||
wtap_set_cb_new_ipv4(cf->provider.wth, add_ipv4_name);
|
||||
wtap_set_cb_new_ipv6(cf->provider.wth, (wtap_new_ipv6_callback_t) add_ipv6_name);
|
||||
|
||||
return CF_OK;
|
||||
|
||||
|
@ -533,7 +532,7 @@ sharkd_load_cap_file(void)
|
|||
frame_data *
|
||||
sharkd_get_frame(guint32 framenum)
|
||||
{
|
||||
return frame_data_sequence_find(cfile.frame_set_info.frames, framenum);
|
||||
return frame_data_sequence_find(cfile.provider.frames, framenum);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -556,7 +555,7 @@ sharkd_dissect_request(unsigned int framenum, void (*cb)(epan_dissect_t *, proto
|
|||
wtap_phdr_init(&phdr);
|
||||
ws_buffer_init(&buf, 1500);
|
||||
|
||||
if (!wtap_seek_read(cfile.frame_set_info.wth, fdata->file_off, &phdr, &buf, &err, &err_info)) {
|
||||
if (!wtap_seek_read(cfile.provider.wth, fdata->file_off, &phdr, &buf, &err, &err_info)) {
|
||||
ws_buffer_free(&buf);
|
||||
return -1; /* error reading the record */
|
||||
}
|
||||
|
@ -601,7 +600,7 @@ sharkd_dissect_columns(frame_data *fdata, column_info *cinfo, gboolean dissect_c
|
|||
wtap_phdr_init(&phdr);
|
||||
ws_buffer_init(&buf, 1500);
|
||||
|
||||
if (!wtap_seek_read(cfile.frame_set_info.wth, fdata->file_off, &phdr, &buf, &err, &err_info)) {
|
||||
if (!wtap_seek_read(cfile.provider.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 */
|
||||
|
@ -677,7 +676,7 @@ sharkd_retap(void)
|
|||
for (framenum = 1; framenum <= cfile.count; framenum++) {
|
||||
fdata = sharkd_get_frame(framenum);
|
||||
|
||||
if (!wtap_seek_read(cfile.frame_set_info.wth, fdata->file_off, &phdr, &buf, &err, &err_info))
|
||||
if (!wtap_seek_read(cfile.provider.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);
|
||||
|
@ -732,7 +731,7 @@ sharkd_filter(const char *dftext, guint8 **result)
|
|||
passed_bits = 0;
|
||||
}
|
||||
|
||||
if (!wtap_seek_read(cfile.frame_set_info.wth, fdata->file_off, &phdr, &buf, &err, &err_info))
|
||||
if (!wtap_seek_read(cfile.provider.wth, fdata->file_off, &phdr, &buf, &err, &err_info))
|
||||
break;
|
||||
|
||||
/* frame_data_set_before_dissect */
|
||||
|
@ -766,13 +765,13 @@ sharkd_filter(const char *dftext, guint8 **result)
|
|||
const char *
|
||||
sharkd_get_user_comment(const frame_data *fd)
|
||||
{
|
||||
return frame_set_get_user_comment(&cfile.frame_set_info, fd);
|
||||
return cap_file_provider_get_user_comment(&cfile.provider, fd);
|
||||
}
|
||||
|
||||
int
|
||||
sharkd_set_user_comment(frame_data *fd, const gchar *new_comment)
|
||||
{
|
||||
frame_set_set_user_comment(&cfile.frame_set_info, fd, new_comment);
|
||||
cap_file_provider_set_user_comment(&cfile.provider, fd, new_comment);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -607,9 +607,9 @@ sharkd_session_process_status(void)
|
|||
g_free(name);
|
||||
}
|
||||
|
||||
if (cfile.frame_set_info.wth)
|
||||
if (cfile.provider.wth)
|
||||
{
|
||||
gint64 file_size = wtap_file_size(cfile.frame_set_info.wth, NULL);
|
||||
gint64 file_size = wtap_file_size(cfile.provider.wth, NULL);
|
||||
|
||||
if (file_size > 0)
|
||||
printf(",\"filesize\":%" G_GINT64_FORMAT, file_size);
|
||||
|
|
|
@ -119,12 +119,12 @@ summary_fill_in(capture_file *cf, summary_tally *st)
|
|||
|
||||
/* initialize the tally */
|
||||
if (cf->count != 0) {
|
||||
first_frame = frame_data_sequence_find(cf->frame_set_info.frames, 1);
|
||||
first_frame = frame_data_sequence_find(cf->provider.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->frame_set_info.frames, framenum);
|
||||
cur_frame = frame_data_sequence_find(cf->provider.frames, framenum);
|
||||
tally_frame_data(cur_frame, st);
|
||||
}
|
||||
}
|
||||
|
@ -144,7 +144,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->frame_set_info.wth);
|
||||
idb_info = wtap_file_get_idb_info(cf->provider.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);
|
||||
|
|
95
tfshark.c
95
tfshark.c
|
@ -998,9 +998,9 @@ main(int argc, char *argv[])
|
|||
|
||||
g_free(cf_name);
|
||||
|
||||
if (cfile.frame_set_info.frames != NULL) {
|
||||
free_frame_data_sequence(cfile.frame_set_info.frames);
|
||||
cfile.frame_set_info.frames = NULL;
|
||||
if (cfile.provider.frames != NULL) {
|
||||
free_frame_data_sequence(cfile.provider.frames);
|
||||
cfile.provider.frames = NULL;
|
||||
}
|
||||
|
||||
draw_tap_listeners(TRUE);
|
||||
|
@ -1023,19 +1023,19 @@ clean_exit:
|
|||
}
|
||||
|
||||
static const nstime_t *
|
||||
tfshark_get_frame_ts(frame_set *fs, guint32 frame_num)
|
||||
tfshark_get_frame_ts(struct packet_provider *prov, guint32 frame_num)
|
||||
{
|
||||
if (fs->ref && fs->ref->num == frame_num)
|
||||
return &fs->ref->abs_ts;
|
||||
if (prov->ref && prov->ref->num == frame_num)
|
||||
return &prov->ref->abs_ts;
|
||||
|
||||
if (fs->prev_dis && fs->prev_dis->num == frame_num)
|
||||
return &fs->prev_dis->abs_ts;
|
||||
if (prov->prev_dis && prov->prev_dis->num == frame_num)
|
||||
return &prov->prev_dis->abs_ts;
|
||||
|
||||
if (fs->prev_cap && fs->prev_cap->num == frame_num)
|
||||
return &fs->prev_cap->abs_ts;
|
||||
if (prov->prev_cap && prov->prev_cap->num == frame_num)
|
||||
return &prov->prev_cap->abs_ts;
|
||||
|
||||
if (fs->frames) {
|
||||
frame_data *fd = frame_data_sequence_find(fs->frames, frame_num);
|
||||
if (prov->frames) {
|
||||
frame_data *fd = frame_data_sequence_find(prov->frames, frame_num);
|
||||
|
||||
return (fd) ? &fd->abs_ts : NULL;
|
||||
}
|
||||
|
@ -1044,7 +1044,7 @@ tfshark_get_frame_ts(frame_set *fs, guint32 frame_num)
|
|||
}
|
||||
|
||||
static const char *
|
||||
no_interface_name(frame_set *fs _U_, guint32 interface_id _U_)
|
||||
no_interface_name(struct packet_provider *prov _U_, guint32 interface_id _U_)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
@ -1052,9 +1052,8 @@ no_interface_name(frame_set *fs _U_, guint32 interface_id _U_)
|
|||
static epan_t *
|
||||
tfshark_epan_new(capture_file *cf)
|
||||
{
|
||||
epan_t *epan = epan_new();
|
||||
epan_t *epan = epan_new(&cf->provider);
|
||||
|
||||
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 +1095,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->frame_set_info.ref, cf->frame_set_info.prev_dis);
|
||||
if (cf->frame_set_info.ref == &fdlocal) {
|
||||
&cf->provider.ref, cf->provider.prev_dis);
|
||||
if (cf->provider.ref == &fdlocal) {
|
||||
ref_frame = fdlocal;
|
||||
cf->frame_set_info.ref = &ref_frame;
|
||||
cf->provider.ref = &ref_frame;
|
||||
}
|
||||
|
||||
epan_dissect_file_run(edt, whdr, file_tvbuff_new(&fdlocal, pd), &fdlocal, NULL);
|
||||
|
@ -1111,14 +1110,14 @@ process_packet_first_pass(capture_file *cf, epan_dissect_t *edt,
|
|||
|
||||
if (passed) {
|
||||
frame_data_set_after_dissect(&fdlocal, &cum_bytes);
|
||||
cf->frame_set_info.prev_cap = cf->frame_set_info.prev_dis = frame_data_sequence_add(cf->frame_set_info.frames, &fdlocal);
|
||||
cf->provider.prev_cap = cf->provider.prev_dis = frame_data_sequence_add(cf->provider.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->frame_set_info.frames);
|
||||
g_slist_foreach(edt->pi.dependent_frames, find_and_mark_frame_depended_upon, cf->provider.frames);
|
||||
}
|
||||
|
||||
cf->count++;
|
||||
|
@ -1175,10 +1174,10 @@ process_packet_second_pass(capture_file *cf, epan_dissect_t *edt,
|
|||
cinfo = NULL;
|
||||
|
||||
frame_data_set_before_dissect(fdata, &cf->elapsed_time,
|
||||
&cf->frame_set_info.ref, cf->frame_set_info.prev_dis);
|
||||
if (cf->frame_set_info.ref == fdata) {
|
||||
&cf->provider.ref, cf->provider.prev_dis);
|
||||
if (cf->provider.ref == fdata) {
|
||||
ref_frame = *fdata;
|
||||
cf->frame_set_info.ref = &ref_frame;
|
||||
cf->provider.ref = &ref_frame;
|
||||
}
|
||||
|
||||
epan_dissect_file_run_with_taps(edt, phdr, file_tvbuff_new_buffer(fdata, buf), fdata, cinfo);
|
||||
|
@ -1207,9 +1206,9 @@ process_packet_second_pass(capture_file *cf, epan_dissect_t *edt,
|
|||
return FALSE;
|
||||
}
|
||||
}
|
||||
cf->frame_set_info.prev_dis = fdata;
|
||||
cf->provider.prev_dis = fdata;
|
||||
}
|
||||
cf->frame_set_info.prev_cap = fdata;
|
||||
cf->provider.prev_cap = fdata;
|
||||
|
||||
if (edt) {
|
||||
epan_dissect_reset(edt);
|
||||
|
@ -1221,14 +1220,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->frame_set_info.wth, err);
|
||||
gint64 packet_size = wtap_file_size(cf->provider.wth, err);
|
||||
|
||||
*data_buffer = (guint8*)g_malloc((gsize)packet_size);
|
||||
/* bytes_read =*/ file_read(*data_buffer, (unsigned int)packet_size, cf->frame_set_info.wth->fh);
|
||||
/* bytes_read =*/ file_read(*data_buffer, (unsigned int)packet_size, cf->provider.wth->fh);
|
||||
|
||||
#if 0 /* no more filetap */
|
||||
if (bytes_read < 0) {
|
||||
*err = file_error(cf->frame_set_info.wth->fh, err_info);
|
||||
*err = file_error(cf->provider.wth->fh, err_info);
|
||||
if (*err == 0)
|
||||
*err = FTAP_ERR_SHORT_READ;
|
||||
return FALSE;
|
||||
|
@ -1323,7 +1322,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->frame_set_info.frames = new_frame_data_sequence();
|
||||
cf->provider.frames = new_frame_data_sequence();
|
||||
|
||||
if (do_dissection) {
|
||||
gboolean create_proto_tree;
|
||||
|
@ -1345,8 +1344,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->frame_set_info.wth)*/,
|
||||
wtap_buf_ptr(cf->frame_set_info.wth))) {
|
||||
if (process_packet_first_pass(cf, edt, data_offset, &file_phdr/*wtap_phdr(cf->provider.wth)*/,
|
||||
wtap_buf_ptr(cf->provider.wth))) {
|
||||
|
||||
/* Stop reading if we have the maximum number of packets;
|
||||
* When the -c option has not been used, max_packet_count
|
||||
|
@ -1367,15 +1366,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->frame_set_info.wth);
|
||||
wtap_sequential_close(cf->provider.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->frame_set_info.prev_dis = NULL;
|
||||
cf->frame_set_info.prev_cap = NULL;
|
||||
cf->provider.prev_dis = NULL;
|
||||
cf->provider.prev_cap = NULL;
|
||||
ws_buffer_init(&buf, 1500);
|
||||
|
||||
if (do_dissection) {
|
||||
|
@ -1406,9 +1405,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->frame_set_info.frames, framenum);
|
||||
fdata = frame_data_sequence_find(cf->provider.frames, framenum);
|
||||
#if 0
|
||||
if (wtap_seek_read(cf->frame_set_info.wth, fdata->file_off,
|
||||
if (wtap_seek_read(cf->provider.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 +1468,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->frame_set_info.wth)*/,
|
||||
&file_phdr/*wtap_phdr(cf->provider.wth)*/,
|
||||
raw_data, tap_flags))
|
||||
return FALSE;
|
||||
|
||||
|
@ -1569,8 +1568,8 @@ process_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
|
|||
}
|
||||
|
||||
out:
|
||||
wtap_close(cf->frame_set_info.wth);
|
||||
cf->frame_set_info.wth = NULL;
|
||||
wtap_close(cf->provider.wth);
|
||||
cf->provider.wth = NULL;
|
||||
|
||||
return (err != 0);
|
||||
}
|
||||
|
@ -1618,10 +1617,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->frame_set_info.ref, cf->frame_set_info.prev_dis);
|
||||
if (cf->frame_set_info.ref == &fdata) {
|
||||
&cf->provider.ref, cf->provider.prev_dis);
|
||||
if (cf->provider.ref == &fdata) {
|
||||
ref_frame = fdata;
|
||||
cf->frame_set_info.ref = &ref_frame;
|
||||
cf->provider.ref = &ref_frame;
|
||||
}
|
||||
|
||||
epan_dissect_file_run_with_taps(edt, whdr, frame_tvbuff_new(&fdata, pd), &fdata, cinfo);
|
||||
|
@ -1654,11 +1653,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->frame_set_info.prev_dis = &prev_dis_frame;
|
||||
cf->provider.prev_dis = &prev_dis_frame;
|
||||
}
|
||||
|
||||
prev_cap_frame = fdata;
|
||||
cf->frame_set_info.prev_cap = &prev_cap_frame;
|
||||
cf->provider.prev_cap = &prev_cap_frame;
|
||||
|
||||
if (edt) {
|
||||
epan_dissect_reset(edt);
|
||||
|
@ -2066,7 +2065,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->frame_set_info.wth = NULL; /**** XXX - DOESN'T WORK RIGHT NOW!!!! */
|
||||
cf->provider.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 +2086,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->frame_set_info.ref = NULL;
|
||||
cf->frame_set_info.prev_dis = NULL;
|
||||
cf->frame_set_info.prev_cap = NULL;
|
||||
cf->provider.ref = NULL;
|
||||
cf->provider.prev_dis = NULL;
|
||||
cf->provider.prev_cap = NULL;
|
||||
|
||||
cf->state = FILE_READ_IN_PROGRESS;
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ failure_message_cont(const char *msg_format, va_list ap)
|
|||
}
|
||||
|
||||
static const nstime_t *
|
||||
fuzzshark_get_frame_ts(frame_set *cf _U_, guint32 frame_num _U_)
|
||||
fuzzshark_get_frame_ts(struct packet_provider *prov _U_, guint32 frame_num _U_)
|
||||
{
|
||||
static nstime_t empty;
|
||||
|
||||
|
@ -121,7 +121,7 @@ fuzzshark_get_frame_ts(frame_set *cf _U_, guint32 frame_num _U_)
|
|||
static epan_t *
|
||||
fuzzshark_epan_new(void)
|
||||
{
|
||||
epan_t *epan = epan_new();
|
||||
epan_t *epan = epan_new(NULL);
|
||||
|
||||
epan->get_frame_ts = fuzzshark_get_frame_ts;
|
||||
epan->get_interface_name = NULL;
|
||||
|
|
143
tshark.c
143
tshark.c
|
@ -2199,9 +2199,9 @@ main(int argc, char *argv[])
|
|||
|
||||
g_free(cf_name);
|
||||
|
||||
if (cfile.frame_set_info.frames != NULL) {
|
||||
free_frame_data_sequence(cfile.frame_set_info.frames);
|
||||
cfile.frame_set_info.frames = NULL;
|
||||
if (cfile.provider.frames != NULL) {
|
||||
free_frame_data_sequence(cfile.provider.frames);
|
||||
cfile.provider.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(frame_set *fs, guint32 frame_num)
|
||||
tshark_get_frame_ts(struct packet_provider *prov, guint32 frame_num)
|
||||
{
|
||||
if (fs->ref && fs->ref->num == frame_num)
|
||||
return &fs->ref->abs_ts;
|
||||
if (prov->ref && prov->ref->num == frame_num)
|
||||
return &prov->ref->abs_ts;
|
||||
|
||||
if (fs->prev_dis && fs->prev_dis->num == frame_num)
|
||||
return &fs->prev_dis->abs_ts;
|
||||
if (prov->prev_dis && prov->prev_dis->num == frame_num)
|
||||
return &prov->prev_dis->abs_ts;
|
||||
|
||||
if (fs->prev_cap && fs->prev_cap->num == frame_num)
|
||||
return &fs->prev_cap->abs_ts;
|
||||
if (prov->prev_cap && prov->prev_cap->num == frame_num)
|
||||
return &prov->prev_cap->abs_ts;
|
||||
|
||||
if (fs->frames) {
|
||||
frame_data *fd = frame_data_sequence_find(fs->frames, frame_num);
|
||||
if (prov->frames) {
|
||||
frame_data *fd = frame_data_sequence_find(prov->frames, frame_num);
|
||||
|
||||
return (fd) ? &fd->abs_ts : NULL;
|
||||
}
|
||||
|
@ -2366,12 +2366,11 @@ tshark_get_frame_ts(frame_set *fs, guint32 frame_num)
|
|||
static epan_t *
|
||||
tshark_epan_new(capture_file *cf)
|
||||
{
|
||||
epan_t *epan = epan_new();
|
||||
epan_t *epan = epan_new(&cf->provider);
|
||||
|
||||
epan->fs = &cf->frame_set_info;
|
||||
epan->get_frame_ts = tshark_get_frame_ts;
|
||||
epan->get_interface_name = frame_set_get_interface_name;
|
||||
epan->get_interface_description = frame_set_get_interface_description;
|
||||
epan->get_interface_name = cap_file_provider_get_interface_name;
|
||||
epan->get_interface_description = cap_file_provider_get_interface_description;
|
||||
epan->get_user_comment = NULL;
|
||||
|
||||
return epan;
|
||||
|
@ -2578,9 +2577,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->frame_set_info.wth != NULL) {
|
||||
wtap_close(cf->frame_set_info.wth);
|
||||
cf->frame_set_info.wth = NULL;
|
||||
if (cf->provider.wth != NULL) {
|
||||
wtap_close(cf->provider.wth);
|
||||
cf->provider.wth = NULL;
|
||||
}
|
||||
cf->state = FILE_CLOSED;
|
||||
}
|
||||
|
@ -2683,19 +2682,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->frame_set_info.wth) {
|
||||
wtap_cleareof(cf->frame_set_info.wth);
|
||||
ret = wtap_read(cf->frame_set_info.wth, &err, &err_info, &data_offset);
|
||||
while (to_read-- && cf->provider.wth) {
|
||||
wtap_cleareof(cf->provider.wth);
|
||||
ret = wtap_read(cf->provider.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->frame_set_info.wth);
|
||||
cf->frame_set_info.wth = NULL;
|
||||
wtap_close(cf->provider.wth);
|
||||
cf->provider.wth = NULL;
|
||||
} else {
|
||||
ret = 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);
|
||||
wtap_phdr(cf->provider.wth),
|
||||
wtap_buf_ptr(cf->provider.wth), tap_flags);
|
||||
}
|
||||
if (ret != FALSE) {
|
||||
/* packet successfully read and gone through the "Read Filter" */
|
||||
|
@ -2799,8 +2798,8 @@ capture_input_closed(capture_session *cap_session, gchar *msg)
|
|||
|
||||
report_counts();
|
||||
|
||||
if (cf != NULL && cf->frame_set_info.wth != NULL) {
|
||||
wtap_close(cf->frame_set_info.wth);
|
||||
if (cf != NULL && cf->provider.wth != NULL) {
|
||||
wtap_close(cf->provider.wth);
|
||||
if (cf->is_tempfile) {
|
||||
ws_unlink(cf->filename);
|
||||
}
|
||||
|
@ -2908,10 +2907,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->frame_set_info.ref, cf->frame_set_info.prev_dis);
|
||||
if (cf->frame_set_info.ref == &fdlocal) {
|
||||
&cf->provider.ref, cf->provider.prev_dis);
|
||||
if (cf->provider.ref == &fdlocal) {
|
||||
ref_frame = fdlocal;
|
||||
cf->frame_set_info.ref = &ref_frame;
|
||||
cf->provider.ref = &ref_frame;
|
||||
}
|
||||
|
||||
epan_dissect_run(edt, cf->cd_t, whdr, frame_tvbuff_new(&fdlocal, pd), &fdlocal, NULL);
|
||||
|
@ -2923,7 +2922,7 @@ process_packet_first_pass(capture_file *cf, epan_dissect_t *edt,
|
|||
|
||||
if (passed) {
|
||||
frame_data_set_after_dissect(&fdlocal, &cum_bytes);
|
||||
cf->frame_set_info.prev_cap = cf->frame_set_info.prev_dis = frame_data_sequence_add(cf->frame_set_info.frames, &fdlocal);
|
||||
cf->provider.prev_cap = cf->provider.prev_dis = frame_data_sequence_add(cf->provider.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 +2932,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->frame_set_info.frames);
|
||||
g_slist_foreach(edt->pi.dependent_frames, find_and_mark_frame_depended_upon, cf->provider.frames);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2993,10 +2992,10 @@ process_packet_second_pass(capture_file *cf, epan_dissect_t *edt,
|
|||
cinfo = NULL;
|
||||
|
||||
frame_data_set_before_dissect(fdata, &cf->elapsed_time,
|
||||
&cf->frame_set_info.ref, cf->frame_set_info.prev_dis);
|
||||
if (cf->frame_set_info.ref == fdata) {
|
||||
&cf->provider.ref, cf->provider.prev_dis);
|
||||
if (cf->provider.ref == fdata) {
|
||||
ref_frame = *fdata;
|
||||
cf->frame_set_info.ref = &ref_frame;
|
||||
cf->provider.ref = &ref_frame;
|
||||
}
|
||||
|
||||
if (dissect_color) {
|
||||
|
@ -3030,9 +3029,9 @@ process_packet_second_pass(capture_file *cf, epan_dissect_t *edt,
|
|||
exit(2);
|
||||
}
|
||||
}
|
||||
cf->frame_set_info.prev_dis = fdata;
|
||||
cf->provider.prev_dis = fdata;
|
||||
}
|
||||
cf->frame_set_info.prev_cap = fdata;
|
||||
cf->provider.prev_cap = fdata;
|
||||
|
||||
if (edt) {
|
||||
epan_dissect_reset(edt);
|
||||
|
@ -3064,27 +3063,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->frame_set_info.wth);
|
||||
idb_inf = wtap_file_get_idb_info(cf->provider.wth);
|
||||
#ifdef PCAP_NG_DEFAULT
|
||||
if (idb_inf->interface_data->len > 1) {
|
||||
linktype = WTAP_ENCAP_PER_PACKET;
|
||||
} else {
|
||||
linktype = wtap_file_encap(cf->frame_set_info.wth);
|
||||
linktype = wtap_file_encap(cf->provider.wth);
|
||||
}
|
||||
#else
|
||||
linktype = wtap_file_encap(cf->frame_set_info.wth);
|
||||
linktype = wtap_file_encap(cf->provider.wth);
|
||||
#endif
|
||||
if (save_file != NULL) {
|
||||
/* Set up to write to the capture file. */
|
||||
snapshot_length = wtap_snapshot_length(cf->frame_set_info.wth);
|
||||
snapshot_length = wtap_snapshot_length(cf->provider.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->frame_set_info.wth);
|
||||
nrb_hdrs = wtap_file_get_nrb_for_new_file(cf->frame_set_info.wth);
|
||||
shb_hdrs = wtap_file_get_shb_for_new_file(cf->provider.wth);
|
||||
nrb_hdrs = wtap_file_get_nrb_for_new_file(cf->provider.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 +3150,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->frame_set_info.frames = new_frame_data_sequence();
|
||||
cf->provider.frames = new_frame_data_sequence();
|
||||
|
||||
if (do_dissection) {
|
||||
gboolean create_proto_tree;
|
||||
|
@ -3178,9 +3177,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->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))) {
|
||||
while (wtap_read(cf->provider.wth, &err, &err_info, &data_offset)) {
|
||||
if (process_packet_first_pass(cf, edt, data_offset, wtap_phdr(cf->provider.wth),
|
||||
wtap_buf_ptr(cf->provider.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 +3214,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->frame_set_info.wth);
|
||||
wtap_sequential_close(cf->provider.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->frame_set_info.prev_dis = NULL;
|
||||
cf->frame_set_info.prev_cap = NULL;
|
||||
cf->provider.prev_dis = NULL;
|
||||
cf->provider.prev_cap = NULL;
|
||||
ws_buffer_init(&buf, 1500);
|
||||
|
||||
tshark_debug("tshark: done with first pass");
|
||||
|
@ -3257,8 +3256,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->frame_set_info.frames, framenum);
|
||||
if (wtap_seek_read(cf->frame_set_info.wth, fdata->file_off, &phdr, &buf, &err,
|
||||
fdata = frame_data_sequence_find(cf->provider.frames, framenum);
|
||||
if (wtap_seek_read(cf->provider.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 +3337,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->frame_set_info.wth, &err, &err_info, &data_offset)) {
|
||||
while (wtap_read(cf->provider.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->frame_set_info.wth),
|
||||
wtap_buf_ptr(cf->frame_set_info.wth), tap_flags)) {
|
||||
if (process_packet_single_pass(cf, edt, data_offset, wtap_phdr(cf->provider.wth),
|
||||
wtap_buf_ptr(cf->provider.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->frame_set_info.wth), wtap_buf_ptr(cf->frame_set_info.wth), &err, &err_info)) {
|
||||
if (!wtap_dump(pdh, wtap_phdr(cf->provider.wth), wtap_buf_ptr(cf->provider.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 +3444,8 @@ process_cap_file(capture_file *cf, char *save_file, int out_file_type,
|
|||
}
|
||||
|
||||
out:
|
||||
wtap_close(cf->frame_set_info.wth);
|
||||
cf->frame_set_info.wth = NULL;
|
||||
wtap_close(cf->provider.wth);
|
||||
cf->provider.wth = NULL;
|
||||
|
||||
wtap_block_array_free(shb_hdrs);
|
||||
wtap_block_array_free(nrb_hdrs);
|
||||
|
@ -3508,10 +3507,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->frame_set_info.ref, cf->frame_set_info.prev_dis);
|
||||
if (cf->frame_set_info.ref == &fdata) {
|
||||
&cf->provider.ref, cf->provider.prev_dis);
|
||||
if (cf->provider.ref == &fdata) {
|
||||
ref_frame = fdata;
|
||||
cf->frame_set_info.ref = &ref_frame;
|
||||
cf->provider.ref = &ref_frame;
|
||||
}
|
||||
|
||||
if (dissect_color) {
|
||||
|
@ -3550,11 +3549,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->frame_set_info.prev_dis = &prev_dis_frame;
|
||||
cf->provider.prev_dis = &prev_dis_frame;
|
||||
}
|
||||
|
||||
prev_cap_frame = fdata;
|
||||
cf->frame_set_info.prev_cap = &prev_cap_frame;
|
||||
cf->provider.prev_cap = &prev_cap_frame;
|
||||
|
||||
if (edt) {
|
||||
epan_dissect_reset(edt);
|
||||
|
@ -4031,7 +4030,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->frame_set_info.wth = wth;
|
||||
cf->provider.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 +4044,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->frame_set_info.wth);
|
||||
cf->cd_t = wtap_file_type_subtype(cf->provider.wth);
|
||||
cf->open_type = type;
|
||||
cf->count = 0;
|
||||
cf->drops_known = FALSE;
|
||||
cf->drops = 0;
|
||||
cf->snap = wtap_snapshot_length(cf->frame_set_info.wth);
|
||||
cf->snap = wtap_snapshot_length(cf->provider.wth);
|
||||
nstime_set_zero(&cf->elapsed_time);
|
||||
cf->frame_set_info.ref = NULL;
|
||||
cf->frame_set_info.prev_dis = NULL;
|
||||
cf->frame_set_info.prev_cap = NULL;
|
||||
cf->provider.ref = NULL;
|
||||
cf->provider.prev_dis = NULL;
|
||||
cf->provider.prev_cap = NULL;
|
||||
|
||||
cf->state = FILE_READ_IN_PROGRESS;
|
||||
|
||||
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);
|
||||
wtap_set_cb_new_ipv4(cf->provider.wth, add_ipv4_name);
|
||||
wtap_set_cb_new_ipv6(cf->provider.wth, (wtap_new_ipv6_callback_t) add_ipv6_name);
|
||||
|
||||
return CF_OK;
|
||||
|
||||
|
|
|
@ -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.frame_set_info.frames, framenum);
|
||||
fdata = frame_data_sequence_find(cfile.provider.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.frame_set_info.frames, framenum);
|
||||
fdata = frame_data_sequence_find(cfile.provider.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.frame_set_info.frames, framenum);
|
||||
fdata = frame_data_sequence_find(cfile.provider.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.frame_set_info.frames, cfile.first_displayed);
|
||||
fdata = frame_data_sequence_find(cfile.provider.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.frame_set_info.frames, framenum);
|
||||
fdata = frame_data_sequence_find(cfile.provider.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.frame_set_info.frames, framenum);
|
||||
fdata = frame_data_sequence_find(cfile.provider.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.frame_set_info.frames, framenum);
|
||||
fdata = frame_data_sequence_find(cfile.provider.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);
|
||||
|
|
|
@ -198,7 +198,7 @@ void new_packet_window(GtkWidget *w _U_, gboolean reference, gboolean editable _
|
|||
return;
|
||||
}
|
||||
|
||||
fd = frame_data_sequence_find(cfile.frame_set_info.frames, framenum);
|
||||
fd = frame_data_sequence_find(cfile.provider.frames, framenum);
|
||||
}
|
||||
else {
|
||||
fd = cfile.current_frame;
|
||||
|
|
|
@ -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.frame_set_info.wth);
|
||||
shb_inf = wtap_file_get_shb(cfile.provider.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.frame_set_info.wth);
|
||||
shb_inf = wtap_file_get_shb(cfile.provider.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.frame_set_info.wth);
|
||||
shb_inf = wtap_file_get_shb(cfile.provider.wth);
|
||||
if (shb_inf != NULL) {
|
||||
char *opt_comment;
|
||||
|
||||
|
|
|
@ -78,7 +78,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->frame_set_info.frames != NULL) {
|
||||
if (range->cf->provider.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.
|
||||
|
@ -89,7 +89,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->frame_set_info.frames, framenum);
|
||||
packet = frame_data_sequence_find(range->cf->provider.frames, framenum);
|
||||
|
||||
if (range->cf->current_frame == packet) {
|
||||
range->selected_packet = framenum;
|
||||
|
@ -134,7 +134,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->frame_set_info.frames, framenum);
|
||||
packet = frame_data_sequence_find(range->cf->provider.frames, framenum);
|
||||
|
||||
if (framenum >= mark_low &&
|
||||
framenum <= mark_high)
|
||||
|
@ -203,9 +203,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->frame_set_info.frames != NULL) {
|
||||
if (range->cf->provider.frames != NULL) {
|
||||
for(framenum = 1; framenum <= range->cf->count; framenum++) {
|
||||
packet = frame_data_sequence_find(range->cf->frame_set_info.frames, framenum);
|
||||
packet = frame_data_sequence_find(range->cf->provider.frames, framenum);
|
||||
|
||||
if (value_is_in_range(range->user_range, framenum)) {
|
||||
range->user_range_cnt++;
|
||||
|
|
|
@ -232,7 +232,7 @@ ph_stats_new(capture_file *cf)
|
|||
tot_bytes = 0;
|
||||
|
||||
for (framenum = 1; framenum <= cf->count; framenum++) {
|
||||
frame = frame_data_sequence_find(cf->frame_set_info.frames, framenum);
|
||||
frame = frame_data_sequence_find(cf->provider.frames, framenum);
|
||||
|
||||
/* Create the progress bar if necessary.
|
||||
We check on every iteration of the loop, so that
|
||||
|
|
|
@ -101,8 +101,8 @@ struct _packet_info *CaptureFile::packetInfo()
|
|||
|
||||
int CaptureFile::timestampPrecision()
|
||||
{
|
||||
if (capFile() && capFile()->frame_set_info.wth) {
|
||||
return wtap_file_tsprec(capFile()->frame_set_info.wth);
|
||||
if (capFile() && capFile()->provider.wth) {
|
||||
return wtap_file_tsprec(capFile()->provider.wth);
|
||||
}
|
||||
return WTAP_TSPREC_UNKNOWN;
|
||||
}
|
||||
|
|
|
@ -248,7 +248,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()->frame_set_info.wth);
|
||||
wtap_block_t shb_inf = wtap_file_get_shb(cap_file_.capFile()->provider.wth);
|
||||
char *str;
|
||||
|
||||
if (shb_inf != NULL) {
|
||||
|
@ -529,7 +529,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()->frame_set_info.frames, framenum);
|
||||
frame_data *fdata = frame_data_sequence_find(cap_file_.capFile()->provider.frames, framenum);
|
||||
char *pkt_comment = cf_get_packet_comment(cap_file_.capFile(), fdata);
|
||||
|
||||
if (pkt_comment) {
|
||||
|
|
|
@ -2633,7 +2633,7 @@ void MainWindow::openPacketDialog(bool from_reference)
|
|||
if (framenum == 0)
|
||||
return;
|
||||
|
||||
fdata = frame_data_sequence_find(capture_file_.capFile()->frame_set_info.frames, framenum);
|
||||
fdata = frame_data_sequence_find(capture_file_.capFile()->provider.frames, framenum);
|
||||
} else {
|
||||
fdata = capture_file_.capFile()->current_frame;
|
||||
}
|
||||
|
|
|
@ -1124,7 +1124,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_->frame_set_info.frames, framenum);
|
||||
fdata = frame_data_sequence_find(cap_file_->provider.frames, framenum);
|
||||
|
||||
char *pkt_comment = cf_get_packet_comment(cap_file_, fdata);
|
||||
|
||||
|
@ -1151,7 +1151,7 @@ void PacketList::deleteAllPacketComments()
|
|||
return;
|
||||
|
||||
for (framenum = 1; framenum <= cap_file_->count ; framenum++) {
|
||||
fdata = frame_data_sequence_find(cap_file_->frame_set_info.frames, framenum);
|
||||
fdata = frame_data_sequence_find(cap_file_->provider.frames, framenum);
|
||||
|
||||
cf_set_user_packet_comment(cap_file_, fdata, NULL);
|
||||
}
|
||||
|
|
|
@ -194,7 +194,7 @@ ResolvedAddressesDialog::ResolvedAddressesDialog(QWidget *parent, CaptureFile *c
|
|||
ui->plainTextEdit->setTabStopWidth(ui->plainTextEdit->fontMetrics().averageCharWidth() * 8);
|
||||
|
||||
if (capture_file->isValid()) {
|
||||
wtap* wth = capture_file->capFile()->frame_set_info.wth;
|
||||
wtap* wth = capture_file->capFile()->provider.wth;
|
||||
if (wth) {
|
||||
// might return null
|
||||
wtap_block_t nrb_hdr;
|
||||
|
|
|
@ -174,7 +174,7 @@ void WirelessTimeline::mouseReleaseEvent(QMouseEvent *event)
|
|||
if (num == 0)
|
||||
return;
|
||||
|
||||
frame_data *fdata = frame_data_sequence_find(cfile.frame_set_info.frames, num);
|
||||
frame_data *fdata = frame_data_sequence_find(cfile.provider.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.frame_set_info.frames, packet);
|
||||
frame_data *fdata = frame_data_sequence_find(cfile.provider.frames, packet);
|
||||
struct wlan_radio *ri = get_wlan_radio(fdata->num);
|
||||
float x, width, red, green, blue;
|
||||
|
||||
|
|
|
@ -296,11 +296,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->frame_set_info.frames, 1))
|
||||
if (!frame_data_sequence_find(cf->provider.frames, 1))
|
||||
return "No frames found."; /* Shouldn't happen */
|
||||
|
||||
for (i = 1; i <= cf->count; i++) {
|
||||
if ((fd = frame_data_sequence_find(cf->frame_set_info.frames, i)) == NULL)
|
||||
if ((fd = frame_data_sequence_find(cf->provider.frames, i)) == NULL)
|
||||
continue; /* Shouldn't happen */
|
||||
modify_time_perform(fd, neg ? SHIFT_NEG : SHIFT_POS, &offset, SHIFT_KEEPOFFSET);
|
||||
}
|
||||
|
@ -327,7 +327,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->frame_set_info.frames, packet_num)) == NULL)
|
||||
if ((packetfd = frame_data_sequence_find(cf->provider.frames, packet_num)) == NULL)
|
||||
return "No packets found.";
|
||||
nstime_delta(&packet_time, &(packetfd->abs_ts), &(packetfd->shift_offset));
|
||||
|
||||
|
@ -339,12 +339,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->frame_set_info.frames, 1))
|
||||
if (!frame_data_sequence_find(cf->provider.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->frame_set_info.frames, i)) == NULL)
|
||||
if ((fd = frame_data_sequence_find(cf->provider.frames, i)) == NULL)
|
||||
continue; /* Shouldn't happen */
|
||||
modify_time_perform(fd, SHIFT_POS, &diff_time, SHIFT_SETTOZERO);
|
||||
}
|
||||
|
@ -385,7 +385,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->frame_set_info.frames, packet1_num)) == NULL)
|
||||
if ((packet1fd = frame_data_sequence_find(cf->provider.frames, packet1_num)) == NULL)
|
||||
return "No frames found.";
|
||||
nstime_copy(&ot1, &(packet1fd->abs_ts));
|
||||
nstime_subtract(&ot1, &(packet1fd->shift_offset));
|
||||
|
@ -397,7 +397,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->frame_set_info.frames, packet2_num)) == NULL)
|
||||
if ((packet2fd = frame_data_sequence_find(cf->provider.frames, packet2_num)) == NULL)
|
||||
return "No frames found.";
|
||||
nstime_copy(&ot2, &(packet2fd->abs_ts));
|
||||
nstime_subtract(&ot2, &(packet2fd->shift_offset));
|
||||
|
@ -412,11 +412,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->frame_set_info.frames, 1))
|
||||
if (!frame_data_sequence_find(cf->provider.frames, 1))
|
||||
return "No frames found."; /* Shouldn't happen */
|
||||
|
||||
for (i = 1; i <= cf->count; i++) {
|
||||
if ((fd = frame_data_sequence_find(cf->frame_set_info.frames, i)) == NULL)
|
||||
if ((fd = frame_data_sequence_find(cf->provider.frames, i)) == NULL)
|
||||
continue; /* Shouldn't happen */
|
||||
|
||||
/* Set everything back to the original time */
|
||||
|
@ -448,11 +448,11 @@ time_shift_undo(capture_file *cf)
|
|||
|
||||
nulltime.secs = nulltime.nsecs = 0;
|
||||
|
||||
if (!frame_data_sequence_find(cf->frame_set_info.frames, 1))
|
||||
if (!frame_data_sequence_find(cf->provider.frames, 1))
|
||||
return "No frames found."; /* Shouldn't happen */
|
||||
|
||||
for (i = 1; i <= cf->count; i++) {
|
||||
if ((fd = frame_data_sequence_find(cf->frame_set_info.frames, i)) == NULL)
|
||||
if ((fd = frame_data_sequence_find(cf->provider.frames, i)) == NULL)
|
||||
continue; /* Shouldn't happen */
|
||||
modify_time_perform(fd, SHIFT_NEG, &nulltime, SHIFT_SETTOZERO);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue