forked from osmocom/wireshark
Take all epan_column_info members that always get allocated to "number of columns" to share their own data structure.
Change-Id: Ib982662db6cf68730a7d121eac60d9bc5ae67429 Reviewed-on: https://code.wireshark.org/review/9195 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Anders Broman <a.broman58@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
parent
b9145bc836
commit
da09a1bfd8
|
@ -43,22 +43,27 @@ typedef struct {
|
|||
gchar **col_expr_val; /**< Value for filter expression */
|
||||
} col_expr_t;
|
||||
|
||||
/** Individual column info */
|
||||
typedef struct {
|
||||
gint col_fmt; /**< Format of column */
|
||||
gboolean *fmt_matx; /**< Specifies which formats apply to a column */
|
||||
gchar *col_title; /**< Column titles */
|
||||
gchar *col_custom_field; /**< Custom column field */
|
||||
gint col_custom_occurrence;/**< Custom column field occurrence */
|
||||
GSList *col_custom_field_ids; /**< Custom column field id */
|
||||
struct epan_dfilter *col_custom_dfilter; /**< Compiled custom column field */
|
||||
const gchar *col_data; /**< Column data */
|
||||
gchar *col_buf; /**< Buffer into which to copy data for column */
|
||||
int col_fence; /**< Stuff in column buffer before this index is immutable */
|
||||
} col_item_t;
|
||||
|
||||
/** Column info */
|
||||
struct epan_column_info {
|
||||
const struct epan_session *epan;
|
||||
gint num_cols; /**< Number of columns */
|
||||
gint *col_fmt; /**< Format of column */
|
||||
gboolean **fmt_matx; /**< Specifies which formats apply to a column */
|
||||
col_item_t *columns; /**< All column data */
|
||||
gint *col_first; /**< First column number with a given format */
|
||||
gint *col_last; /**< Last column number with a given format */
|
||||
gchar **col_title; /**< Column titles */
|
||||
gchar **col_custom_field; /**< Custom column field */
|
||||
gint *col_custom_occurrence;/**< Custom column field occurrence */
|
||||
GSList **col_custom_field_ids; /**< Custom column field id */
|
||||
struct epan_dfilter **col_custom_dfilter; /**< Compiled custom column field */
|
||||
const gchar **col_data; /**< Column data */
|
||||
gchar **col_buf; /**< Buffer into which to copy data for column */
|
||||
int *col_fence; /**< Stuff in column buffer before this index is immutable */
|
||||
col_expr_t col_expr; /**< Column expressions and values */
|
||||
gboolean writable; /**< writable or not @todo Are we still writing to the columns? */
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -788,41 +788,43 @@ void
|
|||
build_column_format_array(column_info *cinfo, const gint num_cols, const gboolean reset_fences)
|
||||
{
|
||||
int i;
|
||||
col_item_t* col_item;
|
||||
|
||||
/* Build the column format array */
|
||||
col_setup(cinfo, num_cols);
|
||||
|
||||
for (i = 0; i < cinfo->num_cols; i++) {
|
||||
cinfo->col_fmt[i] = get_column_format(i);
|
||||
cinfo->col_title[i] = g_strdup(get_column_title(i));
|
||||
col_item = &cinfo->columns[i];
|
||||
col_item->col_fmt = get_column_format(i);
|
||||
col_item->col_title = g_strdup(get_column_title(i));
|
||||
|
||||
if (cinfo->col_fmt[i] == COL_CUSTOM) {
|
||||
cinfo->col_custom_field[i] = g_strdup(get_column_custom_field(i));
|
||||
cinfo->col_custom_occurrence[i] = get_column_custom_occurrence(i);
|
||||
if(!dfilter_compile(cinfo->col_custom_field[i], &cinfo->col_custom_dfilter[i], NULL)) {
|
||||
if (col_item->col_fmt == COL_CUSTOM) {
|
||||
col_item->col_custom_field = g_strdup(get_column_custom_field(i));
|
||||
col_item->col_custom_occurrence = get_column_custom_occurrence(i);
|
||||
if(!dfilter_compile(col_item->col_custom_field, &col_item->col_custom_dfilter, NULL)) {
|
||||
/* XXX: Should we issue a warning? */
|
||||
g_free(cinfo->col_custom_field[i]);
|
||||
cinfo->col_custom_field[i] = NULL;
|
||||
cinfo->col_custom_occurrence[i] = 0;
|
||||
cinfo->col_custom_dfilter[i] = NULL;
|
||||
g_free(col_item->col_custom_field);
|
||||
col_item->col_custom_field = NULL;
|
||||
col_item->col_custom_occurrence = 0;
|
||||
col_item->col_custom_dfilter = NULL;
|
||||
}
|
||||
} else {
|
||||
cinfo->col_custom_field[i] = NULL;
|
||||
cinfo->col_custom_occurrence[i] = 0;
|
||||
cinfo->col_custom_dfilter[i] = NULL;
|
||||
col_item->col_custom_field = NULL;
|
||||
col_item->col_custom_occurrence = 0;
|
||||
col_item->col_custom_dfilter = NULL;
|
||||
}
|
||||
|
||||
cinfo->fmt_matx[i] = (gboolean *) g_malloc0(sizeof(gboolean) * NUM_COL_FMTS);
|
||||
get_column_format_matches(cinfo->fmt_matx[i], cinfo->col_fmt[i]);
|
||||
cinfo->col_data[i] = NULL;
|
||||
col_item->fmt_matx = (gboolean *) g_malloc0(sizeof(gboolean) * NUM_COL_FMTS);
|
||||
get_column_format_matches(col_item->fmt_matx, col_item->col_fmt);
|
||||
col_item->col_data = NULL;
|
||||
|
||||
if (cinfo->col_fmt[i] == COL_INFO)
|
||||
cinfo->col_buf[i] = (gchar *) g_malloc(sizeof(gchar) * COL_MAX_INFO_LEN);
|
||||
if (col_item->col_fmt == COL_INFO)
|
||||
col_item->col_buf = (gchar *) g_malloc(sizeof(gchar) * COL_MAX_INFO_LEN);
|
||||
else
|
||||
cinfo->col_buf[i] = (gchar *) g_malloc(sizeof(gchar) * COL_MAX_LEN);
|
||||
col_item->col_buf = (gchar *) g_malloc(sizeof(gchar) * COL_MAX_LEN);
|
||||
|
||||
if(reset_fences)
|
||||
cinfo->col_fence[i] = 0;
|
||||
col_item->col_fence = 0;
|
||||
|
||||
cinfo->col_expr.col_expr[i] = "";
|
||||
cinfo->col_expr.col_expr_val[i] = (gchar *) g_malloc(sizeof(gchar) * COL_MAX_LEN);
|
||||
|
@ -835,7 +837,7 @@ build_column_format_array(column_info *cinfo, const gint num_cols, const gboolea
|
|||
int j;
|
||||
|
||||
for (j = 0; j < NUM_COL_FMTS; j++) {
|
||||
if (!cinfo->fmt_matx[i][j])
|
||||
if (!cinfo->columns[i].fmt_matx[j])
|
||||
continue;
|
||||
|
||||
if (cinfo->col_first[j] == -1)
|
||||
|
|
16
epan/print.c
16
epan/print.c
|
@ -614,7 +614,7 @@ write_psml_preamble(column_info *cinfo, FILE *fh)
|
|||
|
||||
for (i = 0; i < cinfo->num_cols; i++) {
|
||||
fprintf(fh, "<section>");
|
||||
print_escaped_xml(fh, cinfo->col_title[i]);
|
||||
print_escaped_xml(fh, cinfo->columns[i].col_title);
|
||||
fprintf(fh, "</section>\n");
|
||||
}
|
||||
|
||||
|
@ -630,7 +630,7 @@ write_psml_columns(epan_dissect_t *edt, FILE *fh)
|
|||
|
||||
for (i = 0; i < edt->pi.cinfo->num_cols; i++) {
|
||||
fprintf(fh, "<section>");
|
||||
print_escaped_xml(fh, edt->pi.cinfo->col_data[i]);
|
||||
print_escaped_xml(fh, edt->pi.cinfo->columns[i].col_data);
|
||||
fprintf(fh, "</section>\n");
|
||||
}
|
||||
|
||||
|
@ -681,8 +681,8 @@ write_csv_column_titles(column_info *cinfo, FILE *fh)
|
|||
gint i;
|
||||
|
||||
for (i = 0; i < cinfo->num_cols - 1; i++)
|
||||
csv_write_str(cinfo->col_title[i], ',', fh);
|
||||
csv_write_str(cinfo->col_title[i], '\n', fh);
|
||||
csv_write_str(cinfo->columns[i].col_title, ',', fh);
|
||||
csv_write_str(cinfo->columns[i].col_title, '\n', fh);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -691,8 +691,8 @@ write_csv_columns(epan_dissect_t *edt, FILE *fh)
|
|||
gint i;
|
||||
|
||||
for (i = 0; i < edt->pi.cinfo->num_cols - 1; i++)
|
||||
csv_write_str(edt->pi.cinfo->col_data[i], ',', fh);
|
||||
csv_write_str(edt->pi.cinfo->col_data[i], '\n', fh);
|
||||
csv_write_str(edt->pi.cinfo->columns[i].col_data, ',', fh);
|
||||
csv_write_str(edt->pi.cinfo->columns[i].col_data, '\n', fh);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1360,12 +1360,12 @@ void write_fields_proto_tree(output_fields_t *fields, epan_dissect_t *edt, colum
|
|||
if (fields->includes_col_fields) {
|
||||
for (col = 0; col < cinfo->num_cols; col++) {
|
||||
/* Prepend COLUMN_FIELD_FILTER as the field name */
|
||||
col_name = g_strdup_printf("%s%s", COLUMN_FIELD_FILTER, cinfo->col_title[col]);
|
||||
col_name = g_strdup_printf("%s%s", COLUMN_FIELD_FILTER, cinfo->columns[col].col_title);
|
||||
field_index = g_hash_table_lookup(fields->field_indicies, col_name);
|
||||
g_free(col_name);
|
||||
|
||||
if (NULL != field_index) {
|
||||
format_field_values(fields, field_index, g_strdup(cinfo->col_data[col]));
|
||||
format_field_values(fields, field_index, g_strdup(cinfo->columns[col].col_data));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
22
file.c
22
file.c
|
@ -2430,6 +2430,7 @@ print_packet(capture_file *cf, frame_data *fdata,
|
|||
int cp_off;
|
||||
char bookmark_name[9+10+1]; /* "__frameNNNNNNNNNN__\0" */
|
||||
char bookmark_title[6+10+1]; /* "Frame NNNNNNNNNN__\0" */
|
||||
col_item_t* col_item;
|
||||
|
||||
/* Fill in the column information if we're printing the summary
|
||||
information. */
|
||||
|
@ -2467,8 +2468,9 @@ print_packet(capture_file *cf, frame_data *fdata,
|
|||
cp = &args->line_buf[0];
|
||||
line_len = 0;
|
||||
for (i = 0; i < args->num_visible_cols; i++) {
|
||||
col_item = &cf->cinfo.columns[args->visible_cols[i]];
|
||||
/* Find the length of the string for this column. */
|
||||
column_len = (int) strlen(cf->cinfo.col_data[args->visible_cols[i]]);
|
||||
column_len = (int) strlen(col_item->col_data);
|
||||
if (args->col_widths[i] > column_len)
|
||||
column_len = args->col_widths[i];
|
||||
|
||||
|
@ -2483,10 +2485,10 @@ print_packet(capture_file *cf, frame_data *fdata,
|
|||
}
|
||||
|
||||
/* Right-justify the packet number column. */
|
||||
if (cf->cinfo.col_fmt[args->visible_cols[i]] == COL_NUMBER)
|
||||
g_snprintf(cp, column_len+1, "%*s", args->col_widths[i], cf->cinfo.col_data[args->visible_cols[i]]);
|
||||
if (col_item->col_fmt == COL_NUMBER)
|
||||
g_snprintf(cp, column_len+1, "%*s", args->col_widths[i], col_item->col_data);
|
||||
else
|
||||
g_snprintf(cp, column_len+1, "%-*s", args->col_widths[i], cf->cinfo.col_data[args->visible_cols[i]]);
|
||||
g_snprintf(cp, column_len+1, "%-*s", args->col_widths[i], col_item->col_data);
|
||||
cp += column_len;
|
||||
if (i != args->num_visible_cols - 1)
|
||||
*cp++ = ' ';
|
||||
|
@ -2638,14 +2640,14 @@ cf_print_packets(capture_file *cf, print_args_t *print_args)
|
|||
if (i == last_visible_col)
|
||||
callback_args.col_widths[visible_col_count] = 0;
|
||||
else {
|
||||
callback_args.col_widths[visible_col_count] = (gint) strlen(cf->cinfo.col_title[i]);
|
||||
callback_args.col_widths[visible_col_count] = (gint) strlen(cf->cinfo.columns[i].col_title);
|
||||
data_width = get_column_char_width(get_column_format(i));
|
||||
if (data_width > callback_args.col_widths[visible_col_count])
|
||||
callback_args.col_widths[visible_col_count] = data_width;
|
||||
}
|
||||
|
||||
/* Find the length of the string for this column. */
|
||||
column_len = (int) strlen(cf->cinfo.col_title[i]);
|
||||
column_len = (int) strlen(cf->cinfo.columns[i].col_title);
|
||||
if (callback_args.col_widths[i] > column_len)
|
||||
column_len = callback_args.col_widths[visible_col_count];
|
||||
|
||||
|
@ -2662,9 +2664,9 @@ cf_print_packets(capture_file *cf, print_args_t *print_args)
|
|||
|
||||
/* Right-justify the packet number column. */
|
||||
/* if (cf->cinfo.col_fmt[i] == COL_NUMBER)
|
||||
g_snprintf(cp, column_len+1, "%*s", callback_args.col_widths[visible_col_count], cf->cinfo.col_title[i]);
|
||||
g_snprintf(cp, column_len+1, "%*s", callback_args.col_widths[visible_col_count], cf->cinfo.columns[i].col_title);
|
||||
else*/
|
||||
g_snprintf(cp, column_len+1, "%-*s", callback_args.col_widths[visible_col_count], cf->cinfo.col_title[i]);
|
||||
g_snprintf(cp, column_len+1, "%-*s", callback_args.col_widths[visible_col_count], cf->cinfo.columns[i].col_title);
|
||||
cp += column_len;
|
||||
if (i != cf->cinfo.num_cols - 1)
|
||||
*cp++ = ' ';
|
||||
|
@ -3178,9 +3180,9 @@ match_summary_line(capture_file *cf, frame_data *fdata, void *criterion)
|
|||
|
||||
/* Find the Info column */
|
||||
for (colx = 0; colx < cf->cinfo.num_cols; colx++) {
|
||||
if (cf->cinfo.fmt_matx[colx][COL_INFO]) {
|
||||
if (cf->cinfo.columns[colx].fmt_matx[COL_INFO]) {
|
||||
/* Found it. See if we match. */
|
||||
info_column = edt.pi.cinfo->col_data[colx];
|
||||
info_column = edt.pi.cinfo->columns[colx].col_data;
|
||||
info_column_len = strlen(info_column);
|
||||
for (i = 0; i < info_column_len; i++) {
|
||||
c_char = info_column[i];
|
||||
|
|
38
tfshark.c
38
tfshark.c
|
@ -2254,21 +2254,23 @@ print_columns(capture_file *cf)
|
|||
size_t buf_offset;
|
||||
size_t column_len;
|
||||
size_t col_len;
|
||||
col_item_t* col_item;
|
||||
|
||||
line_bufp = get_line_buf(256);
|
||||
buf_offset = 0;
|
||||
*line_bufp = '\0';
|
||||
for (i = 0; i < cf->cinfo.num_cols; i++) {
|
||||
col_item = &cf->cinfo.columns[i];
|
||||
/* Skip columns not marked as visible. */
|
||||
if (!get_column_visible(i))
|
||||
continue;
|
||||
switch (cf->cinfo.col_fmt[i]) {
|
||||
switch (col_item->col_fmt) {
|
||||
case COL_NUMBER:
|
||||
column_len = col_len = strlen(cf->cinfo.col_data[i]);
|
||||
column_len = col_len = strlen(col_item->col_data);
|
||||
if (column_len < 3)
|
||||
column_len = 3;
|
||||
line_bufp = get_line_buf(buf_offset + column_len);
|
||||
put_spaces_string(line_bufp + buf_offset, cf->cinfo.col_data[i], col_len, column_len);
|
||||
put_spaces_string(line_bufp + buf_offset, col_item->col_data, col_len, column_len);
|
||||
break;
|
||||
|
||||
case COL_CLS_TIME:
|
||||
|
@ -2279,11 +2281,11 @@ print_columns(capture_file *cf)
|
|||
case COL_UTC_TIME:
|
||||
case COL_UTC_YMD_TIME: /* XXX - wider */
|
||||
case COL_UTC_YDOY_TIME: /* XXX - wider */
|
||||
column_len = col_len = strlen(cf->cinfo.col_data[i]);
|
||||
column_len = col_len = strlen(col_item->col_data);
|
||||
if (column_len < 10)
|
||||
column_len = 10;
|
||||
line_bufp = get_line_buf(buf_offset + column_len);
|
||||
put_spaces_string(line_bufp + buf_offset, cf->cinfo.col_data[i], col_len, column_len);
|
||||
put_spaces_string(line_bufp + buf_offset, col_item->col_data, col_len, column_len);
|
||||
break;
|
||||
|
||||
case COL_DEF_SRC:
|
||||
|
@ -2295,11 +2297,11 @@ print_columns(capture_file *cf)
|
|||
case COL_DEF_NET_SRC:
|
||||
case COL_RES_NET_SRC:
|
||||
case COL_UNRES_NET_SRC:
|
||||
column_len = col_len = strlen(cf->cinfo.col_data[i]);
|
||||
column_len = col_len = strlen(col_item->col_data);
|
||||
if (column_len < 12)
|
||||
column_len = 12;
|
||||
line_bufp = get_line_buf(buf_offset + column_len);
|
||||
put_spaces_string(line_bufp + buf_offset, cf->cinfo.col_data[i], col_len, column_len);
|
||||
put_spaces_string(line_bufp + buf_offset, col_item->col_data, col_len, column_len);
|
||||
break;
|
||||
|
||||
case COL_DEF_DST:
|
||||
|
@ -2311,17 +2313,17 @@ print_columns(capture_file *cf)
|
|||
case COL_DEF_NET_DST:
|
||||
case COL_RES_NET_DST:
|
||||
case COL_UNRES_NET_DST:
|
||||
column_len = col_len = strlen(cf->cinfo.col_data[i]);
|
||||
column_len = col_len = strlen(col_item->col_data);
|
||||
if (column_len < 12)
|
||||
column_len = 12;
|
||||
line_bufp = get_line_buf(buf_offset + column_len);
|
||||
put_string_spaces(line_bufp + buf_offset, cf->cinfo.col_data[i], col_len, column_len);
|
||||
put_string_spaces(line_bufp + buf_offset, col_item->col_data, col_len, column_len);
|
||||
break;
|
||||
|
||||
default:
|
||||
column_len = strlen(cf->cinfo.col_data[i]);
|
||||
column_len = strlen(col_item->col_data);
|
||||
line_bufp = get_line_buf(buf_offset + column_len);
|
||||
put_string(line_bufp + buf_offset, cf->cinfo.col_data[i], column_len);
|
||||
put_string(line_bufp + buf_offset, col_item->col_data, column_len);
|
||||
break;
|
||||
}
|
||||
buf_offset += column_len;
|
||||
|
@ -2341,12 +2343,12 @@ print_columns(capture_file *cf)
|
|||
* even if we're only adding " ".
|
||||
*/
|
||||
line_bufp = get_line_buf(buf_offset + 4);
|
||||
switch (cf->cinfo.col_fmt[i]) {
|
||||
switch (col_item->col_fmt) {
|
||||
|
||||
case COL_DEF_SRC:
|
||||
case COL_RES_SRC:
|
||||
case COL_UNRES_SRC:
|
||||
switch (cf->cinfo.col_fmt[i + 1]) {
|
||||
switch (cf->cinfo.columns[i+1].col_fmt) {
|
||||
|
||||
case COL_DEF_DST:
|
||||
case COL_RES_DST:
|
||||
|
@ -2365,7 +2367,7 @@ print_columns(capture_file *cf)
|
|||
case COL_DEF_DL_SRC:
|
||||
case COL_RES_DL_SRC:
|
||||
case COL_UNRES_DL_SRC:
|
||||
switch (cf->cinfo.col_fmt[i + 1]) {
|
||||
switch (cf->cinfo.columns[i+1].col_fmt) {
|
||||
|
||||
case COL_DEF_DL_DST:
|
||||
case COL_RES_DL_DST:
|
||||
|
@ -2384,7 +2386,7 @@ print_columns(capture_file *cf)
|
|||
case COL_DEF_NET_SRC:
|
||||
case COL_RES_NET_SRC:
|
||||
case COL_UNRES_NET_SRC:
|
||||
switch (cf->cinfo.col_fmt[i + 1]) {
|
||||
switch (cf->cinfo.columns[i+1].col_fmt) {
|
||||
|
||||
case COL_DEF_NET_DST:
|
||||
case COL_RES_NET_DST:
|
||||
|
@ -2403,7 +2405,7 @@ print_columns(capture_file *cf)
|
|||
case COL_DEF_DST:
|
||||
case COL_RES_DST:
|
||||
case COL_UNRES_DST:
|
||||
switch (cf->cinfo.col_fmt[i + 1]) {
|
||||
switch (cf->cinfo.columns[i+1].col_fmt) {
|
||||
|
||||
case COL_DEF_SRC:
|
||||
case COL_RES_SRC:
|
||||
|
@ -2422,7 +2424,7 @@ print_columns(capture_file *cf)
|
|||
case COL_DEF_DL_DST:
|
||||
case COL_RES_DL_DST:
|
||||
case COL_UNRES_DL_DST:
|
||||
switch (cf->cinfo.col_fmt[i + 1]) {
|
||||
switch (cf->cinfo.columns[i+1].col_fmt) {
|
||||
|
||||
case COL_DEF_DL_SRC:
|
||||
case COL_RES_DL_SRC:
|
||||
|
@ -2441,7 +2443,7 @@ print_columns(capture_file *cf)
|
|||
case COL_DEF_NET_DST:
|
||||
case COL_RES_NET_DST:
|
||||
case COL_UNRES_NET_DST:
|
||||
switch (cf->cinfo.col_fmt[i + 1]) {
|
||||
switch (cf->cinfo.columns[i+1].col_fmt) {
|
||||
|
||||
case COL_DEF_NET_SRC:
|
||||
case COL_RES_NET_SRC:
|
||||
|
|
38
tshark.c
38
tshark.c
|
@ -3748,21 +3748,23 @@ print_columns(capture_file *cf)
|
|||
size_t buf_offset;
|
||||
size_t column_len;
|
||||
size_t col_len;
|
||||
col_item_t* col_item;
|
||||
|
||||
line_bufp = get_line_buf(256);
|
||||
buf_offset = 0;
|
||||
*line_bufp = '\0';
|
||||
for (i = 0; i < cf->cinfo.num_cols; i++) {
|
||||
col_item = &cf->cinfo.columns[i];
|
||||
/* Skip columns not marked as visible. */
|
||||
if (!get_column_visible(i))
|
||||
continue;
|
||||
switch (cf->cinfo.col_fmt[i]) {
|
||||
switch (col_item->col_fmt) {
|
||||
case COL_NUMBER:
|
||||
column_len = col_len = strlen(cf->cinfo.col_data[i]);
|
||||
column_len = col_len = strlen(col_item->col_data);
|
||||
if (column_len < 3)
|
||||
column_len = 3;
|
||||
line_bufp = get_line_buf(buf_offset + column_len);
|
||||
put_spaces_string(line_bufp + buf_offset, cf->cinfo.col_data[i], col_len, column_len);
|
||||
put_spaces_string(line_bufp + buf_offset, col_item->col_data, col_len, column_len);
|
||||
break;
|
||||
|
||||
case COL_CLS_TIME:
|
||||
|
@ -3773,11 +3775,11 @@ print_columns(capture_file *cf)
|
|||
case COL_UTC_TIME:
|
||||
case COL_UTC_YMD_TIME: /* XXX - wider */
|
||||
case COL_UTC_YDOY_TIME: /* XXX - wider */
|
||||
column_len = col_len = strlen(cf->cinfo.col_data[i]);
|
||||
column_len = col_len = strlen(col_item->col_data);
|
||||
if (column_len < 10)
|
||||
column_len = 10;
|
||||
line_bufp = get_line_buf(buf_offset + column_len);
|
||||
put_spaces_string(line_bufp + buf_offset, cf->cinfo.col_data[i], col_len, column_len);
|
||||
put_spaces_string(line_bufp + buf_offset, col_item->col_data, col_len, column_len);
|
||||
break;
|
||||
|
||||
case COL_DEF_SRC:
|
||||
|
@ -3789,11 +3791,11 @@ print_columns(capture_file *cf)
|
|||
case COL_DEF_NET_SRC:
|
||||
case COL_RES_NET_SRC:
|
||||
case COL_UNRES_NET_SRC:
|
||||
column_len = col_len = strlen(cf->cinfo.col_data[i]);
|
||||
column_len = col_len = strlen(col_item->col_data);
|
||||
if (column_len < 12)
|
||||
column_len = 12;
|
||||
line_bufp = get_line_buf(buf_offset + column_len);
|
||||
put_spaces_string(line_bufp + buf_offset, cf->cinfo.col_data[i], col_len, column_len);
|
||||
put_spaces_string(line_bufp + buf_offset, col_item->col_data, col_len, column_len);
|
||||
break;
|
||||
|
||||
case COL_DEF_DST:
|
||||
|
@ -3805,17 +3807,17 @@ print_columns(capture_file *cf)
|
|||
case COL_DEF_NET_DST:
|
||||
case COL_RES_NET_DST:
|
||||
case COL_UNRES_NET_DST:
|
||||
column_len = col_len = strlen(cf->cinfo.col_data[i]);
|
||||
column_len = col_len = strlen(col_item->col_data);
|
||||
if (column_len < 12)
|
||||
column_len = 12;
|
||||
line_bufp = get_line_buf(buf_offset + column_len);
|
||||
put_string_spaces(line_bufp + buf_offset, cf->cinfo.col_data[i], col_len, column_len);
|
||||
put_string_spaces(line_bufp + buf_offset, col_item->col_data, col_len, column_len);
|
||||
break;
|
||||
|
||||
default:
|
||||
column_len = strlen(cf->cinfo.col_data[i]);
|
||||
column_len = strlen(col_item->col_data);
|
||||
line_bufp = get_line_buf(buf_offset + column_len);
|
||||
put_string(line_bufp + buf_offset, cf->cinfo.col_data[i], column_len);
|
||||
put_string(line_bufp + buf_offset, col_item->col_data, column_len);
|
||||
break;
|
||||
}
|
||||
buf_offset += column_len;
|
||||
|
@ -3835,12 +3837,12 @@ print_columns(capture_file *cf)
|
|||
* even if we're only adding " ".
|
||||
*/
|
||||
line_bufp = get_line_buf(buf_offset + 4);
|
||||
switch (cf->cinfo.col_fmt[i]) {
|
||||
switch (col_item->col_fmt) {
|
||||
|
||||
case COL_DEF_SRC:
|
||||
case COL_RES_SRC:
|
||||
case COL_UNRES_SRC:
|
||||
switch (cf->cinfo.col_fmt[i + 1]) {
|
||||
switch (cf->cinfo.columns[i+1].col_fmt) {
|
||||
|
||||
case COL_DEF_DST:
|
||||
case COL_RES_DST:
|
||||
|
@ -3859,7 +3861,7 @@ print_columns(capture_file *cf)
|
|||
case COL_DEF_DL_SRC:
|
||||
case COL_RES_DL_SRC:
|
||||
case COL_UNRES_DL_SRC:
|
||||
switch (cf->cinfo.col_fmt[i + 1]) {
|
||||
switch (cf->cinfo.columns[i+1].col_fmt) {
|
||||
|
||||
case COL_DEF_DL_DST:
|
||||
case COL_RES_DL_DST:
|
||||
|
@ -3878,7 +3880,7 @@ print_columns(capture_file *cf)
|
|||
case COL_DEF_NET_SRC:
|
||||
case COL_RES_NET_SRC:
|
||||
case COL_UNRES_NET_SRC:
|
||||
switch (cf->cinfo.col_fmt[i + 1]) {
|
||||
switch (cf->cinfo.columns[i+1].col_fmt) {
|
||||
|
||||
case COL_DEF_NET_DST:
|
||||
case COL_RES_NET_DST:
|
||||
|
@ -3897,7 +3899,7 @@ print_columns(capture_file *cf)
|
|||
case COL_DEF_DST:
|
||||
case COL_RES_DST:
|
||||
case COL_UNRES_DST:
|
||||
switch (cf->cinfo.col_fmt[i + 1]) {
|
||||
switch (cf->cinfo.columns[i+1].col_fmt) {
|
||||
|
||||
case COL_DEF_SRC:
|
||||
case COL_RES_SRC:
|
||||
|
@ -3916,7 +3918,7 @@ print_columns(capture_file *cf)
|
|||
case COL_DEF_DL_DST:
|
||||
case COL_RES_DL_DST:
|
||||
case COL_UNRES_DL_DST:
|
||||
switch (cf->cinfo.col_fmt[i + 1]) {
|
||||
switch (cf->cinfo.columns[i+1].col_fmt) {
|
||||
|
||||
case COL_DEF_DL_SRC:
|
||||
case COL_RES_DL_SRC:
|
||||
|
@ -3935,7 +3937,7 @@ print_columns(capture_file *cf)
|
|||
case COL_DEF_NET_DST:
|
||||
case COL_RES_NET_DST:
|
||||
case COL_UNRES_NET_DST:
|
||||
switch (cf->cinfo.col_fmt[i + 1]) {
|
||||
switch (cf->cinfo.columns[i+1].col_fmt) {
|
||||
|
||||
case COL_DEF_NET_SRC:
|
||||
case COL_RES_NET_SRC:
|
||||
|
|
|
@ -531,10 +531,10 @@ selected_ptree_ref_cb(GtkWidget *widget _U_, gpointer data _U_)
|
|||
static gboolean
|
||||
is_address_column (gint column)
|
||||
{
|
||||
if (((cfile.cinfo.col_fmt[column] == COL_DEF_SRC) ||
|
||||
(cfile.cinfo.col_fmt[column] == COL_RES_SRC) ||
|
||||
(cfile.cinfo.col_fmt[column] == COL_DEF_DST) ||
|
||||
(cfile.cinfo.col_fmt[column] == COL_RES_DST)) &&
|
||||
if (((cfile.cinfo.columns[column].col_fmt == COL_DEF_SRC) ||
|
||||
(cfile.cinfo.columns[column].col_fmt == COL_RES_SRC) ||
|
||||
(cfile.cinfo.columns[column].col_fmt == COL_DEF_DST) ||
|
||||
(cfile.cinfo.columns[column].col_fmt == COL_RES_DST)) &&
|
||||
strlen(cfile.cinfo.col_expr.col_expr_val[column]))
|
||||
{
|
||||
return TRUE;
|
||||
|
@ -609,7 +609,7 @@ get_filter_from_packet_list_row_and_column(gpointer data)
|
|||
fdata, &cfile.cinfo);
|
||||
epan_dissect_fill_in_columns(&edt, TRUE, TRUE);
|
||||
|
||||
if ((cfile.cinfo.col_custom_occurrence[column]) ||
|
||||
if ((cfile.cinfo.columns[column].col_custom_occurrence) ||
|
||||
(strchr (cfile.cinfo.col_expr.col_expr_val[column], ',') == NULL))
|
||||
{
|
||||
/* Only construct the filter when a single occurrence is displayed
|
||||
|
@ -622,8 +622,8 @@ get_filter_from_packet_list_row_and_column(gpointer data)
|
|||
if (strlen(cfile.cinfo.col_expr.col_expr[column]) != 0 &&
|
||||
strlen(cfile.cinfo.col_expr.col_expr_val[column]) != 0) {
|
||||
/* leak a little; is there a safe wmem_ scope here? */
|
||||
if (cfile.cinfo.col_fmt[column] == COL_CUSTOM) {
|
||||
header_field_info *hfi = proto_registrar_get_byname(cfile.cinfo.col_custom_field[column]);
|
||||
if (cfile.cinfo.columns[column].col_fmt == COL_CUSTOM) {
|
||||
header_field_info *hfi = proto_registrar_get_byname(cfile.cinfo.columns[column].col_custom_field);
|
||||
if (hfi && hfi->parent == -1) {
|
||||
/* Protocol only */
|
||||
buf = g_strdup(cfile.cinfo.col_expr.col_expr[column]);
|
||||
|
|
|
@ -662,6 +662,7 @@ create_view_and_model(void)
|
|||
header_field_info *hfi;
|
||||
gint col_min_width;
|
||||
gchar *escaped_title;
|
||||
col_item_t* col_item;
|
||||
|
||||
packetlist = packet_list_new();
|
||||
|
||||
|
@ -691,6 +692,7 @@ create_view_and_model(void)
|
|||
|
||||
/* We need one extra column to store the entire PacketListRecord */
|
||||
for(i = 0; i < cfile.cinfo.num_cols; i++) {
|
||||
col_item = &cfile.cinfo.columns[i];
|
||||
renderer = gtk_cell_renderer_text_new();
|
||||
col = gtk_tree_view_column_new();
|
||||
gtk_tree_view_column_pack_start(col, renderer, TRUE);
|
||||
|
@ -706,14 +708,14 @@ create_view_and_model(void)
|
|||
show_cell_data_func,
|
||||
GINT_TO_POINTER(i),
|
||||
NULL);
|
||||
if (cfile.cinfo.col_fmt[i] == COL_CUSTOM) {
|
||||
hfi = proto_registrar_get_byname(cfile.cinfo.col_custom_field[i]);
|
||||
if (col_item->col_fmt == COL_CUSTOM) {
|
||||
hfi = proto_registrar_get_byname(col_item->col_custom_field);
|
||||
/* Check if this is a valid custom_field */
|
||||
if (hfi != NULL) {
|
||||
if (hfi->parent != -1) {
|
||||
/* Prefix with protocol name */
|
||||
if (cfile.cinfo.col_custom_occurrence[i] != 0) {
|
||||
tooltip_text = g_strdup_printf("%s\n%s (%s#%d)", proto_get_protocol_name(hfi->parent), hfi->name, hfi->abbrev, cfile.cinfo.col_custom_occurrence[i]);
|
||||
if (col_item->col_custom_occurrence != 0) {
|
||||
tooltip_text = g_strdup_printf("%s\n%s (%s#%d)", proto_get_protocol_name(hfi->parent), hfi->name, hfi->abbrev, col_item->col_custom_occurrence);
|
||||
} else {
|
||||
tooltip_text = g_strdup_printf("%s\n%s (%s)", proto_get_protocol_name(hfi->parent), hfi->name, hfi->abbrev);
|
||||
}
|
||||
|
@ -724,9 +726,9 @@ create_view_and_model(void)
|
|||
tooltip_text = g_strdup_printf("Unknown Field: %s", get_column_custom_field(i));
|
||||
}
|
||||
} else {
|
||||
tooltip_text = g_strdup(col_format_desc(cfile.cinfo.col_fmt[i]));
|
||||
tooltip_text = g_strdup(col_format_desc(col_item->col_fmt));
|
||||
}
|
||||
escaped_title = ws_strdup_escape_char(cfile.cinfo.col_title[i], '_');
|
||||
escaped_title = ws_strdup_escape_char(col_item->col_title, '_');
|
||||
gtk_tree_view_column_set_title(col, escaped_title);
|
||||
g_free (escaped_title);
|
||||
gtk_tree_view_column_set_clickable(col, TRUE);
|
||||
|
@ -743,7 +745,7 @@ create_view_and_model(void)
|
|||
* XXX The minimum size will be the size of the title
|
||||
* should that be limited for long titles?
|
||||
*/
|
||||
col_min_width = get_default_col_size (packetlist->view, cfile.cinfo.col_title[i]);
|
||||
col_min_width = get_default_col_size (packetlist->view, cfile.cinfo.columns[i].col_title);
|
||||
if(col_min_width<COLUMN_WIDTH_MIN){
|
||||
gtk_tree_view_column_set_min_width(col, COLUMN_WIDTH_MIN);
|
||||
}else{
|
||||
|
|
|
@ -398,7 +398,7 @@ packet_list_get_value(GtkTreeModel *tree_model, GtkTreeIter *iter, gint column,
|
|||
text_column = packet_list->col_to_text[column];
|
||||
if (text_column == -1) { /* column based on frame_data */
|
||||
col_fill_in_frame_data(record->fdata, &cfile.cinfo, column, FALSE);
|
||||
g_value_set_string(value, cfile.cinfo.col_data[column]);
|
||||
g_value_set_string(value, cfile.cinfo.columns[column].col_data);
|
||||
} else {
|
||||
g_return_if_fail(record->col_text);
|
||||
g_value_set_string(value, record->col_text[text_column]);
|
||||
|
@ -652,6 +652,7 @@ packet_list_change_record(PacketList *packet_list, PacketListRecord *record, gin
|
|||
gchar *str;
|
||||
size_t col_text_len;
|
||||
int text_col;
|
||||
col_item_t* col_item;
|
||||
|
||||
text_col = packet_list->col_to_text[col];
|
||||
|
||||
|
@ -659,7 +660,8 @@ packet_list_change_record(PacketList *packet_list, PacketListRecord *record, gin
|
|||
if (text_col == -1 || record->col_text[text_col] != NULL)
|
||||
return;
|
||||
|
||||
switch (cfile.cinfo.col_fmt[col]) {
|
||||
col_item = &cfile.cinfo.columns[col];
|
||||
switch (col_item->col_fmt) {
|
||||
case COL_DEF_SRC:
|
||||
case COL_RES_SRC: /* COL_DEF_SRC is currently just like COL_RES_SRC */
|
||||
case COL_UNRES_SRC:
|
||||
|
@ -685,13 +687,13 @@ packet_list_change_record(PacketList *packet_list, PacketListRecord *record, gin
|
|||
case COL_8021Q_VLAN_ID:
|
||||
case COL_EXPERT:
|
||||
case COL_FREQ_CHAN:
|
||||
if (cinfo->col_data[col] && cinfo->col_data[col] != cinfo->col_buf[col]) {
|
||||
col_text_len = strlen(cinfo->col_data[col]);
|
||||
if (col_item->col_data && col_item->col_data != col_item->col_buf) {
|
||||
col_text_len = strlen(col_item->col_data);
|
||||
if (col_text_len > G_MAXUSHORT)
|
||||
col_text_len = G_MAXUSHORT;
|
||||
|
||||
/* This is a constant string, so we don't have to copy it */
|
||||
record->col_text[text_col] = (gchar *) cinfo->col_data[col];
|
||||
record->col_text[text_col] = (gchar *) col_item->col_data;
|
||||
record->col_text_len[text_col] = (gushort) col_text_len;
|
||||
#ifdef PACKET_LIST_STATISTICS
|
||||
++packet_list->const_strings;
|
||||
|
@ -701,8 +703,8 @@ packet_list_change_record(PacketList *packet_list, PacketListRecord *record, gin
|
|||
/* !! FALL-THROUGH!! */
|
||||
|
||||
default:
|
||||
if(cinfo->col_data[col]){
|
||||
col_text_len = strlen(cinfo->col_data[col]);
|
||||
if(col_item->col_data){
|
||||
col_text_len = strlen(col_item->col_data);
|
||||
if (col_text_len > G_MAXUSHORT)
|
||||
col_text_len = G_MAXUSHORT;
|
||||
|
||||
|
@ -722,7 +724,7 @@ packet_list_change_record(PacketList *packet_list, PacketListRecord *record, gin
|
|||
/* Use the unresolved value in col_expr_val */
|
||||
str = g_string_chunk_insert_const (packet_list->string_pool, (const gchar *)cinfo->col_expr.col_expr_val[col]);
|
||||
} else {
|
||||
str = g_string_chunk_insert_const (packet_list->string_pool, (const gchar *)cinfo->col_data[col]);
|
||||
str = g_string_chunk_insert_const (packet_list->string_pool, (const gchar *)col_item->col_data);
|
||||
}
|
||||
record->col_text[text_col] = str;
|
||||
break;
|
||||
|
@ -930,7 +932,7 @@ packet_list_compare_custom(gint sort_id, gint text_sort_id, PacketListRecord *a,
|
|||
{
|
||||
header_field_info *hfi;
|
||||
|
||||
hfi = proto_registrar_get_byname(cfile.cinfo.col_custom_field[sort_id]);
|
||||
hfi = proto_registrar_get_byname(cfile.cinfo.columns[sort_id].col_custom_field);
|
||||
|
||||
if (hfi == NULL) {
|
||||
return frame_data_compare(cfile.epan, a->fdata, b->fdata, COL_NUMBER);
|
||||
|
@ -968,7 +970,7 @@ _packet_list_compare_records(gint sort_id, gint text_sort_id, PacketListRecord *
|
|||
if(a->col_text[text_sort_id] == b->col_text[text_sort_id])
|
||||
return 0; /* no need to call strcmp() */
|
||||
|
||||
if (cfile.cinfo.col_fmt[sort_id] == COL_CUSTOM)
|
||||
if (cfile.cinfo.columns[sort_id].col_fmt == COL_CUSTOM)
|
||||
return packet_list_compare_custom(sort_id, text_sort_id, a, b);
|
||||
|
||||
return strcmp(a->col_text[text_sort_id], b->col_text[text_sort_id]);
|
||||
|
@ -980,7 +982,7 @@ packet_list_compare_records(gint sort_id, gint text_sort_id, PacketListRecord *a
|
|||
gint ret;
|
||||
|
||||
if (text_sort_id == -1) /* based on frame_data ? */
|
||||
return frame_data_compare(cfile.epan, a->fdata, b->fdata, cfile.cinfo.col_fmt[sort_id]);
|
||||
return frame_data_compare(cfile.epan, a->fdata, b->fdata, cfile.cinfo.columns[sort_id].col_fmt);
|
||||
|
||||
ret = _packet_list_compare_records(sort_id, text_sort_id, a, b);
|
||||
if (ret == 0)
|
||||
|
@ -1216,7 +1218,7 @@ packet_list_get_widest_column_string(PacketList *packet_list, gint col)
|
|||
record = PACKET_LIST_RECORD_GET(packet_list->visible_rows, vis_idx);
|
||||
|
||||
col_fill_in_frame_data(record->fdata, &cfile.cinfo, col, FALSE);
|
||||
column_len = (gint) strlen(cfile.cinfo.col_buf[col]);
|
||||
column_len = (gint) strlen(cfile.cinfo.columns[col].col_buf);
|
||||
if (column_len > widest_column_len) {
|
||||
widest_column_len = column_len;
|
||||
widest_packet = vis_idx;
|
||||
|
@ -1227,7 +1229,7 @@ packet_list_get_widest_column_string(PacketList *packet_list, gint col)
|
|||
record = PACKET_LIST_RECORD_GET(packet_list->visible_rows, widest_packet);
|
||||
col_fill_in_frame_data(record->fdata, &cfile.cinfo, col, FALSE);
|
||||
|
||||
return cfile.cinfo.col_buf[col];
|
||||
return cfile.cinfo.columns[col].col_buf;
|
||||
} else
|
||||
return "";
|
||||
}
|
||||
|
|
|
@ -172,7 +172,7 @@ create_packet_window_title(void)
|
|||
* frame was dissected.
|
||||
*/
|
||||
for (i = 0; i < cfile.cinfo.num_cols; ++i) {
|
||||
g_string_append(title, cfile.cinfo.col_data[i]);
|
||||
g_string_append(title, cfile.cinfo.columns[i].col_data);
|
||||
g_string_append_c(title, ' ');
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ right_justify_column (gint col, capture_file *cf)
|
|||
|
||||
if (!cf) return FALSE;
|
||||
|
||||
switch (cf->cinfo.col_fmt[col]) {
|
||||
switch (cf->cinfo.columns[col].col_fmt) {
|
||||
|
||||
case COL_NUMBER:
|
||||
case COL_PACKET_LENGTH:
|
||||
|
@ -54,7 +54,7 @@ right_justify_column (gint col, capture_file *cf)
|
|||
break;
|
||||
|
||||
case COL_CUSTOM:
|
||||
hfi = proto_registrar_get_byname(cf->cinfo.col_custom_field[col]);
|
||||
hfi = proto_registrar_get_byname(cf->cinfo.columns[col].col_custom_field);
|
||||
/* Check if this is a valid field and we have no strings lookup table */
|
||||
if ((hfi != NULL) && ((hfi->strings == NULL) || !get_column_resolved(col))) {
|
||||
/* Check for bool, framenum and decimal/octal integer types */
|
||||
|
@ -81,10 +81,10 @@ resolve_column (gint col, capture_file *cf)
|
|||
|
||||
if (!cf) return FALSE;
|
||||
|
||||
switch (cf->cinfo.col_fmt[col]) {
|
||||
switch (cf->cinfo.columns[col].col_fmt) {
|
||||
|
||||
case COL_CUSTOM:
|
||||
hfi = proto_registrar_get_byname(cf->cinfo.col_custom_field[col]);
|
||||
hfi = proto_registrar_get_byname(cf->cinfo.columns[col].col_custom_field);
|
||||
/* Check if this is a valid field */
|
||||
if (hfi != NULL) {
|
||||
/* Check if we have an OID or a strings table with integer values */
|
||||
|
|
|
@ -97,7 +97,7 @@ PacketDialog::PacketDialog(QWidget &parent, CaptureFile &cf, frame_data *fdata)
|
|||
// ElidedLabel doesn't support rich text / HTML
|
||||
col_parts << QString("%1: %2")
|
||||
.arg(get_column_title(i))
|
||||
.arg(cap_file_.capFile()->cinfo.col_data[i]);
|
||||
.arg(cap_file_.capFile()->cinfo.columns[i].col_data);
|
||||
}
|
||||
col_info_ = col_parts.join(" " UTF8_MIDDLE_DOT " ");
|
||||
setHintText();
|
||||
|
|
|
@ -856,7 +856,7 @@ QString &PacketList::getFilterFromRowAndColumn()
|
|||
epan_dissect_run(&edt, cap_file_->cd_t, &cap_file_->phdr, frame_tvbuff_new_buffer(fdata, &cap_file_->buf), fdata, &cap_file_->cinfo);
|
||||
epan_dissect_fill_in_columns(&edt, TRUE, TRUE);
|
||||
|
||||
if ((cap_file_->cinfo.col_custom_occurrence[ctx_column_]) ||
|
||||
if ((cap_file_->cinfo.columns[ctx_column_].col_custom_occurrence) ||
|
||||
(strchr (cap_file_->cinfo.col_expr.col_expr_val[ctx_column_], ',') == NULL))
|
||||
{
|
||||
/* Only construct the filter when a single occurrence is displayed
|
||||
|
@ -868,8 +868,8 @@ QString &PacketList::getFilterFromRowAndColumn()
|
|||
*/
|
||||
if (strlen(cap_file_->cinfo.col_expr.col_expr[ctx_column_]) != 0 &&
|
||||
strlen(cap_file_->cinfo.col_expr.col_expr_val[ctx_column_]) != 0) {
|
||||
if (cap_file_->cinfo.col_fmt[ctx_column_] == COL_CUSTOM) {
|
||||
header_field_info *hfi = proto_registrar_get_byname(cap_file_->cinfo.col_custom_field[ctx_column_]);
|
||||
if (cap_file_->cinfo.columns[ctx_column_].col_fmt == COL_CUSTOM) {
|
||||
header_field_info *hfi = proto_registrar_get_byname(cap_file_->cinfo.columns[ctx_column_].col_custom_field);
|
||||
if (hfi->parent == -1) {
|
||||
/* Protocol only */
|
||||
filter.append(cap_file_->cinfo.col_expr.col_expr[ctx_column_]);
|
||||
|
|
|
@ -181,15 +181,15 @@ bool PacketListModel::recordLessThan(PacketListRecord *r1, PacketListRecord *r2)
|
|||
cmp_val = frame_data_compare(sort_cap_file_->epan, r1->frameData(), r2->frameData(), COL_NUMBER);
|
||||
} else if (text_sort_column_ < 0) {
|
||||
// Column comes directly from frame data
|
||||
cmp_val = frame_data_compare(sort_cap_file_->epan, r1->frameData(), r2->frameData(), sort_cap_file_->cinfo.col_fmt[sort_column_]);
|
||||
cmp_val = frame_data_compare(sort_cap_file_->epan, r1->frameData(), r2->frameData(), sort_cap_file_->cinfo.columns[sort_column_].col_fmt);
|
||||
} else {
|
||||
if (r1->columnString(sort_cap_file_, sort_column_).toByteArray().data() == r2->columnString(sort_cap_file_, sort_column_).toByteArray().data()) {
|
||||
cmp_val = 0;
|
||||
} else if (sort_cap_file_->cinfo.col_fmt[sort_column_] == COL_CUSTOM) {
|
||||
} else if (sort_cap_file_->cinfo.columns[sort_column_].col_fmt == COL_CUSTOM) {
|
||||
header_field_info *hfi;
|
||||
|
||||
// Column comes from custom data
|
||||
hfi = proto_registrar_get_byname(sort_cap_file_->cinfo.col_custom_field[sort_column_]);
|
||||
hfi = proto_registrar_get_byname(sort_cap_file_->cinfo.columns[sort_column_].col_custom_field);
|
||||
|
||||
if (hfi == NULL) {
|
||||
cmp_val = frame_data_compare(sort_cap_file_->epan, r1->frameData(), r2->frameData(), COL_NUMBER);
|
||||
|
|
|
@ -192,7 +192,7 @@ void PacketListRecord::cacheColumnStrings(column_info *cinfo)
|
|||
/* Column based on frame_data or it already contains a value */
|
||||
if (text_col < 0) {
|
||||
col_fill_in_frame_data(fdata_, cinfo, column, FALSE);
|
||||
col_text_.append(cinfo->col_data[column]);
|
||||
col_text_.append(cinfo->columns[column].col_data);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -222,12 +222,12 @@ void PacketListRecord::cacheColumnStrings(column_info *cinfo)
|
|||
case COL_8021Q_VLAN_ID:
|
||||
case COL_EXPERT:
|
||||
case COL_FREQ_CHAN:
|
||||
if (cinfo->col_data[column] && cinfo->col_data[column] != cinfo->col_buf[column]) {
|
||||
if (cinfo->columns[column].col_data && cinfo->columns[column].col_data != cinfo->columns[column].col_buf) {
|
||||
/* This is a constant string, so we don't have to copy it */
|
||||
// XXX - ui/gtk/packet_list_store.c uses G_MAXUSHORT. We don't do proper UTF8
|
||||
// truncation in either case.
|
||||
int col_text_len = MIN(qstrlen(cinfo->col_data[column]) + 1, COL_MAX_INFO_LEN);
|
||||
col_text_.append(QByteArray::fromRawData(cinfo->col_data[column], col_text_len));
|
||||
col_text_.append(QByteArray::fromRawData(cinfo->columns[column].col_data, col_text_len));
|
||||
break;
|
||||
}
|
||||
/* !! FALL-THROUGH!! */
|
||||
|
@ -238,7 +238,7 @@ void PacketListRecord::cacheColumnStrings(column_info *cinfo)
|
|||
// XXX Use QContiguousCache?
|
||||
col_text_.append(cinfo->col_expr.col_expr_val[column]);
|
||||
} else {
|
||||
col_text_.append(cinfo->col_data[column]);
|
||||
col_text_.append(cinfo->columns[column].col_data);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ void PacketListRecord::cacheColumnStrings(column_info *cinfo)
|
|||
if (text_col < 0) {
|
||||
col_fill_in_frame_data(fdata_, cinfo, column, FALSE);
|
||||
}
|
||||
col_text = cinfo->col_data[column];
|
||||
col_text = cinfo->columns[column].col_data;
|
||||
}
|
||||
col_text_.append(col_text);
|
||||
col_lines += col_text.count('\n');
|
||||
|
|
|
@ -75,6 +75,7 @@ static gboolean
|
|||
seq_analysis_frame_packet( void *ptr, packet_info *pinfo, epan_dissect_t *edt _U_, const void *dummy _U_)
|
||||
{
|
||||
seq_analysis_info_t *sainfo = (seq_analysis_info_t *) ptr;
|
||||
col_item_t* col_item;
|
||||
|
||||
if ((sainfo->all_packets)||(pinfo->fd->flags.passed_dfilter==1)){
|
||||
int i;
|
||||
|
@ -108,8 +109,9 @@ seq_analysis_frame_packet( void *ptr, packet_info *pinfo, epan_dissect_t *edt _U
|
|||
if (pinfo->cinfo->col_first[COL_INFO]>=0){
|
||||
|
||||
for (i = pinfo->cinfo->col_first[COL_INFO]; i <= pinfo->cinfo->col_last[COL_INFO]; i++) {
|
||||
if (pinfo->cinfo->fmt_matx[i][COL_INFO]) {
|
||||
colinfo = g_strdup(pinfo->cinfo->col_data[i]);
|
||||
col_item = &pinfo->cinfo->columns[i];
|
||||
if (col_item->fmt_matx[COL_INFO]) {
|
||||
colinfo = g_strdup(col_item->col_data);
|
||||
/* break; ? or g_free(colinfo); before g_strdup() */
|
||||
}
|
||||
}
|
||||
|
@ -118,8 +120,9 @@ seq_analysis_frame_packet( void *ptr, packet_info *pinfo, epan_dissect_t *edt _U
|
|||
if (pinfo->cinfo->col_first[COL_PROTOCOL]>=0){
|
||||
|
||||
for (i = pinfo->cinfo->col_first[COL_PROTOCOL]; i <= pinfo->cinfo->col_last[COL_PROTOCOL]; i++) {
|
||||
if (pinfo->cinfo->fmt_matx[i][COL_PROTOCOL]) {
|
||||
protocol = g_strdup(pinfo->cinfo->col_data[i]);
|
||||
col_item = &pinfo->cinfo->columns[i];
|
||||
if (col_item->fmt_matx[COL_PROTOCOL]) {
|
||||
protocol = g_strdup(col_item->col_data);
|
||||
/* break; ? or g_free(protocol); before g_strdup() */
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue