forked from osmocom/wireshark
From Kovarththanan Rajaratnam:
Use frame_data values . svn path=/trunk/; revision=29202
This commit is contained in:
parent
e040dac13f
commit
9ca4ac2bed
|
@ -1348,6 +1348,62 @@ col_set_circuit_id(packet_info *pinfo, int col)
|
||||||
pinfo->cinfo->col_data[col] = pinfo->cinfo->col_buf[col];
|
pinfo->cinfo->col_data[col] = pinfo->cinfo->col_buf[col];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
col_based_on_frame_data(column_info *cinfo, gint col)
|
||||||
|
{
|
||||||
|
if (col_has_time_fmt(cinfo, col))
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
switch (cinfo->col_fmt[col]) {
|
||||||
|
|
||||||
|
case COL_NUMBER:
|
||||||
|
case COL_PACKET_LENGTH:
|
||||||
|
case COL_CUMULATIVE_BYTES:
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
col_fill_in_frame_data(frame_data *fd, column_info *cinfo, gint col)
|
||||||
|
{
|
||||||
|
switch (cinfo->col_fmt[col]) {
|
||||||
|
|
||||||
|
case COL_NUMBER:
|
||||||
|
g_snprintf(cinfo->col_buf[col], COL_MAX_LEN, "%u", fd->num);
|
||||||
|
cinfo->col_data[col] = cinfo->col_buf[col];
|
||||||
|
g_strlcpy(cinfo->col_expr.col_expr[col], "frame.number", COL_MAX_LEN);
|
||||||
|
g_strlcpy(cinfo->col_expr.col_expr_val[col], cinfo->col_buf[col], COL_MAX_LEN);
|
||||||
|
break;
|
||||||
|
|
||||||
|
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:
|
||||||
|
col_set_fmt_time(fd, cinfo, cinfo->col_fmt[col], col);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case COL_PACKET_LENGTH:
|
||||||
|
g_snprintf(cinfo->col_buf[col], COL_MAX_LEN, "%u", fd->pkt_len);
|
||||||
|
cinfo->col_data[col] = cinfo->col_buf[col];
|
||||||
|
g_strlcpy(cinfo->col_expr.col_expr[col], "frame.len", COL_MAX_LEN);
|
||||||
|
g_strlcpy(cinfo->col_expr.col_expr_val[col], cinfo->col_buf[col], COL_MAX_LEN);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case COL_CUMULATIVE_BYTES:
|
||||||
|
g_snprintf(cinfo->col_buf[col], COL_MAX_LEN, "%u", fd->cum_bytes);
|
||||||
|
cinfo->col_data[col] = cinfo->col_buf[col];
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
col_fill_in(packet_info *pinfo)
|
col_fill_in(packet_info *pinfo)
|
||||||
{
|
{
|
||||||
|
@ -1357,35 +1413,16 @@ col_fill_in(packet_info *pinfo)
|
||||||
switch (pinfo->cinfo->col_fmt[i]) {
|
switch (pinfo->cinfo->col_fmt[i]) {
|
||||||
|
|
||||||
case COL_NUMBER:
|
case COL_NUMBER:
|
||||||
g_snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "%u", pinfo->fd->num);
|
col_fill_in_frame_data(pinfo->fd, pinfo->cinfo, i);
|
||||||
pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
|
|
||||||
g_strlcpy(pinfo->cinfo->col_expr.col_expr[i], "frame.number",
|
|
||||||
COL_MAX_LEN);
|
|
||||||
g_strlcpy(pinfo->cinfo->col_expr.col_expr_val[i], pinfo->cinfo->col_buf[i], COL_MAX_LEN);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_CLS_TIME:
|
case COL_CLS_TIME:
|
||||||
col_set_cls_time(pinfo->fd, pinfo->cinfo, i);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COL_ABS_TIME:
|
case COL_ABS_TIME:
|
||||||
col_set_abs_time(pinfo->fd, pinfo->cinfo, i);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COL_ABS_DATE_TIME:
|
case COL_ABS_DATE_TIME:
|
||||||
col_set_abs_date_time(pinfo->fd, pinfo->cinfo, i);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COL_REL_TIME:
|
case COL_REL_TIME:
|
||||||
col_set_rel_time(pinfo->fd, pinfo->cinfo, i);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COL_DELTA_TIME:
|
case COL_DELTA_TIME:
|
||||||
col_set_delta_time(pinfo->fd, pinfo->cinfo, i);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COL_DELTA_TIME_DIS:
|
case COL_DELTA_TIME_DIS:
|
||||||
col_set_delta_time_dis(pinfo->fd, pinfo->cinfo, i);
|
col_fill_in_frame_data(pinfo->fd, pinfo->cinfo, i);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_REL_CONV_TIME:
|
case COL_REL_CONV_TIME:
|
||||||
|
@ -1469,16 +1506,8 @@ col_fill_in(packet_info *pinfo)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_PACKET_LENGTH:
|
case COL_PACKET_LENGTH:
|
||||||
g_snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "%u", pinfo->fd->pkt_len);
|
|
||||||
pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
|
|
||||||
g_strlcpy(pinfo->cinfo->col_expr.col_expr[i], "frame.len",
|
|
||||||
COL_MAX_LEN);
|
|
||||||
g_strlcpy(pinfo->cinfo->col_expr.col_expr_val[i], pinfo->cinfo->col_buf[i], COL_MAX_LEN);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COL_CUMULATIVE_BYTES:
|
case COL_CUMULATIVE_BYTES:
|
||||||
g_snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "%u", pinfo->fd->cum_bytes);
|
col_fill_in_frame_data(pinfo->fd, pinfo->cinfo, i);
|
||||||
pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_OXID:
|
case COL_OXID:
|
||||||
|
@ -1551,3 +1580,4 @@ col_fill_in(packet_info *pinfo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,12 @@ extern void col_init(column_info *cinfo);
|
||||||
*/
|
*/
|
||||||
extern void col_set_fmt_time(frame_data *fd, column_info *cinfo, gint fmt, gint col);
|
extern void col_set_fmt_time(frame_data *fd, column_info *cinfo, gint fmt, gint col);
|
||||||
|
|
||||||
|
/** Fill in all columns of the given packet which are based on values from frame_data.
|
||||||
|
*
|
||||||
|
* Internal, don't use this in dissectors!
|
||||||
|
*/
|
||||||
|
extern void col_fill_in_frame_data(frame_data *fd, column_info *cinfo, gint col);
|
||||||
|
|
||||||
/** Fill in all columns of the given packet.
|
/** Fill in all columns of the given packet.
|
||||||
*
|
*
|
||||||
* Internal, don't use this in dissectors!
|
* Internal, don't use this in dissectors!
|
||||||
|
@ -153,6 +159,7 @@ void col_custom_prime_edt(epan_dissect_t *edt, column_info *cinfo);
|
||||||
/* For internal Wireshark use only. Not to be called from dissectors. */
|
/* For internal Wireshark use only. Not to be called from dissectors. */
|
||||||
gboolean have_custom_cols(column_info *cinfo);
|
gboolean have_custom_cols(column_info *cinfo);
|
||||||
gboolean col_has_time_fmt(column_info *cinfo, gint col);
|
gboolean col_has_time_fmt(column_info *cinfo, gint col);
|
||||||
|
gboolean col_based_on_frame_data(column_info *cinfo, gint col);
|
||||||
|
|
||||||
/** Append the given text to a column element, the text will be copied.
|
/** Append the given text to a column element, the text will be copied.
|
||||||
*
|
*
|
||||||
|
|
|
@ -79,9 +79,11 @@ col_append_fstr
|
||||||
col_append_sep_fstr
|
col_append_sep_fstr
|
||||||
col_append_sep_str
|
col_append_sep_str
|
||||||
col_append_str
|
col_append_str
|
||||||
|
col_based_on_frame_data
|
||||||
col_clear
|
col_clear
|
||||||
col_custom_prime_edt
|
col_custom_prime_edt
|
||||||
col_custom_set_fstr
|
col_custom_set_fstr
|
||||||
|
col_fill_in_frame_data
|
||||||
col_format_desc
|
col_format_desc
|
||||||
col_format_to_string
|
col_format_to_string
|
||||||
col_get_writable
|
col_get_writable
|
||||||
|
|
|
@ -100,11 +100,17 @@ new_packet_list_append(column_info *cinfo, frame_data *fdata)
|
||||||
gint i;
|
gint i;
|
||||||
row_data_t row_data;
|
row_data_t row_data;
|
||||||
|
|
||||||
/* Allocate the array holding column data, the size is the current number of columns */
|
/* Allocate the array holding column data, the size is the current number of columns
|
||||||
|
|
||||||
|
* XXX - only allocate storage for columns _not_ based on values from frame_data? */
|
||||||
row_data.col_text = se_alloc(sizeof(row_data.col_text)*cinfo->num_cols);
|
row_data.col_text = se_alloc(sizeof(row_data.col_text)*cinfo->num_cols);
|
||||||
|
|
||||||
for(i = 0; i < cinfo->num_cols; i++) {
|
for(i = 0; i < cinfo->num_cols; i++) {
|
||||||
row_data.col_text[i] = se_strdup(cinfo->col_data[i]);
|
if (col_based_on_frame_data(cinfo, i))
|
||||||
|
/* We already store the value in frame_data, so don't duplicate this. */
|
||||||
|
row_data.col_text[i] = NULL;
|
||||||
|
else
|
||||||
|
row_data.col_text[i] = se_strdup(cinfo->col_data[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
row_data.fdata = fdata;
|
row_data.fdata = fdata;
|
||||||
|
@ -391,13 +397,13 @@ show_cell_data_func(GtkTreeViewColumn *col _U_, GtkCellRenderer *renderer,
|
||||||
GdkColor bg_gdk;
|
GdkColor bg_gdk;
|
||||||
gchar *cell_text;
|
gchar *cell_text;
|
||||||
|
|
||||||
if (col_has_time_fmt(&cfile.cinfo, col_num)) {
|
if (col_based_on_frame_data(&cfile.cinfo, col_num)) {
|
||||||
col_set_fmt_time(fdata, &cfile.cinfo, cfile.cinfo.col_fmt[col_num], col_num);
|
col_fill_in_frame_data(fdata, &cfile.cinfo, col_num);
|
||||||
cell_text = g_strdup(cfile.cinfo.col_data[col_num]);
|
cell_text = g_strdup(cfile.cinfo.col_data[col_num]);
|
||||||
}else{
|
}else{
|
||||||
gtk_tree_model_get(model, iter,
|
gtk_tree_model_get(model, iter,
|
||||||
col_num, &cell_text,
|
col_num, &cell_text,
|
||||||
-1);
|
-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(fdata->color_filter){
|
if(fdata->color_filter){
|
||||||
|
|
|
@ -680,18 +680,8 @@ packet_list_compare_records(gint sort_id, PacketListRecord *a,
|
||||||
|
|
||||||
/* XXX If we want to store other things than text, we need other sort functions */
|
/* XXX If we want to store other things than text, we need other sort functions */
|
||||||
|
|
||||||
switch (cfile.cinfo.col_fmt[sort_id]) {
|
if (col_based_on_frame_data(&cfile.cinfo, sort_id))
|
||||||
case COL_NUMBER:
|
return frame_data_compare(a->fdata, b->fdata, cfile.cinfo.col_fmt[sort_id]);
|
||||||
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:
|
|
||||||
return frame_data_compare(a->fdata, b->fdata, cfile.cinfo.col_fmt[sort_id]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if((a->col_text[sort_id]) && (b->col_text[sort_id]))
|
if((a->col_text[sort_id]) && (b->col_text[sort_id]))
|
||||||
return strcmp(a->col_text[sort_id], b->col_text[sort_id]);
|
return strcmp(a->col_text[sort_id], b->col_text[sort_id]);
|
||||||
|
|
Loading…
Reference in New Issue