}
}
+/*
+ * Fill in columns if we got an error reading the packet.
+ * We set most columns to "???", and set the Info column to an error
+ * message.
+ */
+void
+col_fill_in_error(column_info *cinfo, frame_data *fdata, const gboolean fill_col_exprs, const gboolean fill_fd_colums)
+{
+ int i;
+
+ if (!cinfo)
+ return;
+
+ for (i = 0; i < cinfo->num_cols; i++) {
+ switch (cinfo->col_fmt[i]) {
+
+ case COL_NUMBER:
+ case COL_CLS_TIME:
+ case COL_ABS_TIME:
+ case COL_ABS_DATE_TIME:
+ case COL_REL_TIME:
+ case COL_DELTA_TIME:
+ case COL_DELTA_TIME_DIS:
+ case COL_PACKET_LENGTH:
+ case COL_CUMULATIVE_BYTES:
+ if (fill_fd_colums)
+ col_fill_in_frame_data(fdata, cinfo, i, fill_col_exprs);
+ break;
+
+ case COL_INFO:
+ /* XXX - say more than this */
+ cinfo->col_data[i] = "Read error";
+ break;
+
+ case NUM_COL_FMTS: /* keep compiler happy - shouldn't get here */
+ g_assert_not_reached();
+ break;
+ default:
+ if (cinfo->col_fmt[i] >= NUM_COL_FMTS) {
+ g_assert_not_reached();
+ }
+ /*
+ * No dissection was done, and these columns are set as the
+ * result of the dissection, so....
+ */
+ cinfo->col_data[i] = "???";
+ break;
+ }
+ }
+}
+
#if 0
XXX this needs more rework?
/* --------------------------- */
*/
extern void col_fill_in(packet_info *pinfo, const gboolean fill_col_exprs, const gboolean fill_fd_colums);
+/** Fill in columns if we got an error reading the packet.
+ * We set most columns to "???", and set the Info column to an error
+ * message.
+ *
+ * Internal, don't use this in dissectors!
+ */
+extern void col_fill_in_error(column_info *cinfo, frame_data *fdata, const gboolean fill_col_exprs, const gboolean fill_fd_colums);
+
/* Utility routines used by packet*.c */
/** Are the columns writable?
else
cinfo = NULL;
- if (!cf_read_frame_r(&cfile, fdata, &pseudo_header, pd))
+ if (!cf_read_frame_r(&cfile, fdata, &pseudo_header, pd)) {
+ /*
+ * Error reading the frame.
+ *
+ * Don't set the color filter for now (we might want
+ * to colorize it in some fashion to warn that the
+ * row couldn't be filled in or colorized), and
+ * set the columns to placeholder values, except
+ * for the Info column, where we'll put in an
+ * error message.
+ */
+ if (dissect_columns) {
+ col_fill_in_error(cinfo, fdata, FALSE, FALSE /* fill_fd_columns */);
+
+ for(col = 0; col < cinfo->num_cols; ++col) {
+ /* Skip columns based on frame_data because we already store those. */
+ if (!col_based_on_frame_data(cinfo, col))
+ packet_list_change_record(packet_list, record->physical_pos, col, cinfo);
+ }
+ record->columnized = TRUE;
+ }
+ if (dissect_color) {
+ fdata->color_filter = NULL;
+ record->colorized = TRUE;
+ }
return; /* error reading the frame */
+ }
create_proto_tree = (color_filters_used() && dissect_color) ||
(have_custom_cols(cinfo) && dissect_columns);
epan_dissect_fill_in_columns(&edt, FALSE, FALSE /* fill_fd_columns */);
for(col = 0; col < cinfo->num_cols; ++col) {
- /* Skip columns based om frame_data because we already store those. */
+ /* Skip columns based on frame_data because we already store those. */
if (!col_based_on_frame_data(cinfo, col))
packet_list_change_record(packet_list, record->physical_pos, col, cinfo);
}