From Jakub Zawadzki:
New functions: cf_read_frame_r, cf_read_frame It's much easier to write: cf_read_frame (cf, fdata, &err, &err_info) Than: wtap_seek_read (cf->wth, fdata->file_off, &cf->pseudo_header, cf->pd, fdata->cap_len, &err, &err_info) svn path=/trunk/; revision=32980
This commit is contained in:
parent
a59da6ffd8
commit
65ee4e797a
30
file.c
30
file.c
|
@ -1712,6 +1712,21 @@ cf_redissect_packets(capture_file *cf)
|
|||
rescan_packets(cf, "Reprocessing", "all packets", TRUE, TRUE);
|
||||
}
|
||||
|
||||
gboolean
|
||||
cf_read_frame_r(capture_file *cf, frame_data *fdata,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd,
|
||||
int *err, gchar **err_info)
|
||||
{
|
||||
return wtap_seek_read(cf->wth, fdata->file_off, pseudo_header,
|
||||
pd, fdata->cap_len, err, err_info);
|
||||
}
|
||||
|
||||
gboolean
|
||||
cf_read_frame(capture_file *cf, frame_data *fdata, int *err, gchar **err_info)
|
||||
{
|
||||
return cf_read_frame_r(cf, fdata, &cf->pseudo_header, cf->pd, err, err_info);
|
||||
}
|
||||
|
||||
/* Rescan the list of packets, reconstructing the CList.
|
||||
|
||||
"action" describes why we're doing this; it's used in the progress
|
||||
|
@ -1907,8 +1922,7 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item,
|
|||
fdata->col_text = se_alloc0(sizeof(fdata->col_text) * (cf->cinfo.num_cols));
|
||||
}
|
||||
|
||||
if (!wtap_seek_read (cf->wth, fdata->file_off, &cf->pseudo_header,
|
||||
cf->pd, fdata->cap_len, &err, &err_info)) {
|
||||
if (!cf_read_frame (cf, fdata, &err, &err_info)) {
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
|
||||
cf_read_error_message(err, err_info), cf->filename);
|
||||
break;
|
||||
|
@ -2211,8 +2225,7 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item,
|
|||
frame_data_cleanup(fdata);
|
||||
}
|
||||
|
||||
if (!wtap_seek_read (cf->wth, fdata->file_off, &cf->pseudo_header,
|
||||
cf->pd, fdata->cap_len, &err, &err_info)) {
|
||||
if (!cf_read_frame (cf, fdata, &err, &err_info)) {
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
|
||||
cf_read_error_message(err, err_info), cf->filename);
|
||||
break;
|
||||
|
@ -2502,8 +2515,7 @@ process_specified_packets(capture_file *cf, packet_range_t *range,
|
|||
}
|
||||
|
||||
/* Get the packet */
|
||||
if (!wtap_seek_read(cf->wth, fdata->file_off, &pseudo_header,
|
||||
pd, fdata->cap_len, &err, &err_info)) {
|
||||
if (!cf_read_frame_r(cf, fdata, &pseudo_header, pd, &err, &err_info)) {
|
||||
/* Attempt to get the packet failed. */
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
|
||||
cf_read_error_message(err, err_info), cf->filename);
|
||||
|
@ -3799,8 +3811,7 @@ find_packet(capture_file *cf,
|
|||
/* Is this packet in the display? */
|
||||
if (fdata->flags.passed_dfilter) {
|
||||
/* Yes. Load its data. */
|
||||
if (!wtap_seek_read(cf->wth, fdata->file_off, &cf->pseudo_header,
|
||||
cf->pd, fdata->cap_len, &err, &err_info)) {
|
||||
if (!cf_read_frame(cf, fdata, &err, &err_info)) {
|
||||
/* Read error. Report the error, and go back to the frame
|
||||
where we started. */
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
|
||||
|
@ -4031,8 +4042,7 @@ cf_select_packet(capture_file *cf, int row)
|
|||
}
|
||||
|
||||
/* Get the data in that frame. */
|
||||
if (!wtap_seek_read (cf->wth, fdata->file_off, &cf->pseudo_header,
|
||||
cf->pd, fdata->cap_len, &err, &err_info)) {
|
||||
if (!cf_read_frame (cf, fdata, &err, &err_info)) {
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
|
||||
cf_read_error_message(err, err_info), cf->filename);
|
||||
return;
|
||||
|
|
7
file.h
7
file.h
|
@ -110,6 +110,13 @@ void cf_reload(capture_file *cf);
|
|||
*/
|
||||
cf_read_status_t cf_read(capture_file *cf, gboolean from_save);
|
||||
|
||||
gboolean cf_read_frame_r(capture_file *cf, frame_data *fdata,
|
||||
union wtap_pseudo_header *pseudo_header, guint8 *pd,
|
||||
int *err, gchar **err_info);
|
||||
|
||||
gboolean cf_read_frame(capture_file *cf, frame_data *fdata,
|
||||
int *err, gchar **err_info);
|
||||
|
||||
/**
|
||||
* Start reading from the end of a capture file.
|
||||
* This is used in "Update list of packets in Real-Time".
|
||||
|
|
|
@ -3413,8 +3413,7 @@ static void iax2_analysis_cb(GtkWidget *w _U_, gpointer data _U_)
|
|||
return; /* if we exit here it's an error */
|
||||
|
||||
/* dissect the current frame */
|
||||
if (!wtap_seek_read(cf->wth, fdata->file_off, &cf->pseudo_header,
|
||||
cf->pd, fdata->cap_len, &err, &err_info)) {
|
||||
if (!cf_read_frame(cf, fdata, &err, &err_info)) {
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
|
||||
cf_read_error_message(err, err_info), cf->filename);
|
||||
return;
|
||||
|
|
|
@ -590,8 +590,7 @@ get_filter_from_packet_list_row_and_column(gpointer data)
|
|||
if (fdata != NULL) {
|
||||
epan_dissect_t edt;
|
||||
|
||||
if (!wtap_seek_read(cfile.wth, fdata->file_off, &cfile.pseudo_header,
|
||||
cfile.pd, fdata->cap_len, &err, &err_info)) {
|
||||
if (!cf_read_frame(&cfile, fdata, &err, &err_info)) {
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
|
||||
cf_read_error_message(err, err_info), cfile.filename);
|
||||
return NULL;
|
||||
|
|
|
@ -1097,8 +1097,7 @@ packet_list_dissect_and_cache_record(PacketList *packet_list, PacketListRecord *
|
|||
else
|
||||
cinfo = NULL;
|
||||
|
||||
if (!wtap_seek_read(cfile.wth, fdata->file_off, &pseudo_header,
|
||||
pd, fdata->cap_len, &err, &err_info)) {
|
||||
if (!cf_read_frame_r(&cfile, fdata, &pseudo_header, pd, &err, &err_info)) {
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
|
||||
cf_read_error_message(err, err_info), cfile.filename);
|
||||
return;
|
||||
|
|
|
@ -144,8 +144,7 @@ void new_window_cb(GtkWidget *w _U_)
|
|||
#ifdef NEW_PACKET_LIST
|
||||
|
||||
/* With the new packetlists "lazy columns" it's neccesary to reread the frame */
|
||||
if (!wtap_seek_read(cfile.wth, cfile.current_frame->file_off, &cfile.pseudo_header,
|
||||
cfile.pd, cfile.current_frame->cap_len, &err, &err_info)) {
|
||||
if (!cf_read_frame(&cfile, cfile.current_frame, &err, &err_info)) {
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
|
||||
cf_read_error_message(err, err_info), cfile.filename);
|
||||
return;
|
||||
|
|
|
@ -3636,8 +3636,7 @@ static void rtp_analysis_cb(GtkWidget *w _U_, gpointer data _U_)
|
|||
return; /* if we exit here it's an error */
|
||||
|
||||
/* dissect the current frame */
|
||||
if (!wtap_seek_read(cf->wth, fdata->file_off, &cf->pseudo_header,
|
||||
cf->pd, fdata->cap_len, &err, &err_info)) {
|
||||
if (!cf_read_frame(cf, fdata, &err, &err_info)) {
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
|
||||
cf_read_error_message(err, err_info), cf->filename);
|
||||
return;
|
||||
|
|
|
@ -899,8 +899,7 @@ static void sctp_analyse_cb(struct sctp_analyse* u_data, gboolean ext)
|
|||
return; /* if we exit here it's an error */
|
||||
|
||||
/* dissect the current frame */
|
||||
if (!wtap_seek_read(cf->wth, fdata->file_off, &cf->pseudo_header,
|
||||
cf->pd, fdata->cap_len, &err, &err_info)) {
|
||||
if (!cf_read_frame(cf, fdata, &err, &err_info)) {
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
|
||||
cf_read_error_message(err, err_info), cf->filename);
|
||||
return;
|
||||
|
|
|
@ -1798,8 +1798,7 @@ static struct tcpheader *select_tcpip_session (capture_file *cf, struct segment
|
|||
}
|
||||
|
||||
/* dissect the current frame */
|
||||
if (!wtap_seek_read(cf->wth, fdata->file_off, &cf->pseudo_header,
|
||||
cf->pd, fdata->cap_len, &err, &err_info)) {
|
||||
if (!cf_read_frame(cf, fdata, &err, &err_info)) {
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
|
||||
cf_read_error_message(err, err_info), cf->filename);
|
||||
return NULL;
|
||||
|
|
|
@ -149,8 +149,7 @@ process_frame(frame_data *frame, column_info *cinfo, ph_stats_t* ps)
|
|||
double cur_time;
|
||||
|
||||
/* Load the frame from the capture file */
|
||||
if (!wtap_seek_read(cfile.wth, frame->file_off, &phdr, pd,
|
||||
frame->cap_len, &err, &err_info)) {
|
||||
if (!cf_read_frame_r(&cfile, frame, &phdr, pd, &err, &err_info)) {
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
|
||||
cf_read_error_message(err, err_info), cfile.filename);
|
||||
return FALSE; /* failure */
|
||||
|
|
Loading…
Reference in New Issue