aboutsummaryrefslogtreecommitdiffstats
path: root/rawshark.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2017-12-07 19:31:43 -0800
committerGuy Harris <guy@alum.mit.edu>2017-12-08 03:32:25 +0000
commit797d2f6a87607b146a2ef62e1ff501031dce8212 (patch)
tree7c18adbd5b86d5f2843dd760f6fa492f7c05fef4 /rawshark.c
parent0baa4458c5780b143ad4479d387202ddf4add06f (diff)
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>
Diffstat (limited to 'rawshark.c')
-rw-r--r--rawshark.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/rawshark.c b/rawshark.c
index 02825bf956..e97ab249ba 100644
--- a/rawshark.c
+++ b/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;
}