diff options
author | sake <sake@f5534014-38df-0310-8fa8-9805f1628bb7> | 2007-10-03 14:02:08 +0000 |
---|---|---|
committer | sake <sake@f5534014-38df-0310-8fa8-9805f1628bb7> | 2007-10-03 14:02:08 +0000 |
commit | a53d184cf001096b268be673f22971254330eb33 (patch) | |
tree | 1c21dab32b2f4b96276394ee9f42edd7d72a0794 /epan/column-utils.c | |
parent | 53f3a554de54fb5f0edd10a1fa6e921d7fd90351 (diff) |
This patch adds two new column types:
- COL_REL_CONV_TIME which is used to display the time relative to the first frame that was seen in the conversation
- COL_DELTA_CONV_TIME which is used to display the delta time from the previous frame of the conversation
It also adds the function "col_set_time()" to "epan/column-utils.[ch]" which can be called from within a dissector to set either of these two columns to the appropiate time.
Last but not least, it lets the tcp-dissector make use of these two columns.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@23058 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/column-utils.c')
-rw-r--r-- | epan/column-utils.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/epan/column-utils.c b/epan/column-utils.c index 3da93a755a..81aa9951dd 100644 --- a/epan/column-utils.c +++ b/epan/column-utils.c @@ -909,6 +909,56 @@ col_set_cls_time(frame_data *fd, column_info *cinfo, gint col) } } +void +col_set_time(column_info *cinfo, gint el, nstime_t *ts, char *fieldname) +{ + int col; + + g_assert(cinfo->col_first[el] >= 0); + + for (col = cinfo->col_first[el]; col <= cinfo->col_last[el]; col++) { + if (cinfo->fmt_matx[col][el]) { + switch(timestamp_get_precision()) { + case(TS_PREC_FIXED_SEC): + case(TS_PREC_AUTO_SEC): + display_signed_time(cinfo->col_buf[col], COL_MAX_LEN, + (gint32) ts->secs, ts->nsecs / 1000000000, SECS); + break; + case(TS_PREC_FIXED_DSEC): + case(TS_PREC_AUTO_DSEC): + display_signed_time(cinfo->col_buf[col], COL_MAX_LEN, + (gint32) ts->secs, ts->nsecs / 100000000, DSECS); + break; + case(TS_PREC_FIXED_CSEC): + case(TS_PREC_AUTO_CSEC): + display_signed_time(cinfo->col_buf[col], COL_MAX_LEN, + (gint32) ts->secs, ts->nsecs / 10000000, CSECS); + break; + case(TS_PREC_FIXED_MSEC): + case(TS_PREC_AUTO_MSEC): + display_signed_time(cinfo->col_buf[col], COL_MAX_LEN, + (gint32) ts->secs, ts->nsecs / 1000000, MSECS); + break; + case(TS_PREC_FIXED_USEC): + case(TS_PREC_AUTO_USEC): + display_signed_time(cinfo->col_buf[col], COL_MAX_LEN, + (gint32) ts->secs, ts->nsecs / 1000, USECS); + break; + case(TS_PREC_FIXED_NSEC): + case(TS_PREC_AUTO_NSEC): + display_signed_time(cinfo->col_buf[col], COL_MAX_LEN, + (gint32) ts->secs, ts->nsecs, NSECS); + break; + default: + g_assert_not_reached(); + } + cinfo->col_data[col] = cinfo->col_buf[col]; + strcpy(cinfo->col_expr[col],fieldname); + strcpy(cinfo->col_expr_val[col],cinfo->col_buf[col]); + } + } +} + static void col_set_addr(packet_info *pinfo, int col, address *addr, gboolean is_res, gboolean is_src) @@ -1200,6 +1250,10 @@ col_fill_in(packet_info *pinfo) col_set_delta_time_dis(pinfo->fd, pinfo->cinfo, i); break; + case COL_REL_CONV_TIME: + case COL_DELTA_CONV_TIME: + break; /* Will be set by various dissectors */ + case COL_DEF_SRC: case COL_RES_SRC: /* COL_DEF_SRC is currently just like COL_RES_SRC */ col_set_addr(pinfo, i, &pinfo->src, TRUE, TRUE); |