2 * Routines for column utilities.
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
32 #include "column-utils.h"
33 #include "timestamp.h"
34 #include "sna-utils.h"
35 #include "atalk-utils.h"
37 #include "packet_info.h"
39 #include "addr_resolv.h"
40 #include "ipv6-utils.h"
41 #include "osi-utils.h"
42 #include "value_string.h"
43 #include "column_info.h"
45 #include <epan/strutil.h>
46 #include <epan/epan.h>
48 static column_info *ci;
50 /* Allocate all the data structures for constructing column data, given
51 the number of columns. */
53 col_setup(column_info *cinfo, gint num_cols)
57 cinfo->num_cols = num_cols;
58 cinfo->col_fmt = (gint *) g_malloc(sizeof(gint) * num_cols);
59 cinfo->fmt_matx = (gboolean **) g_malloc(sizeof(gboolean *) * num_cols);
60 cinfo->col_first = (int *) g_malloc(sizeof(int) * (NUM_COL_FMTS));
61 cinfo->col_last = (int *) g_malloc(sizeof(int) * (NUM_COL_FMTS));
62 cinfo->col_title = (gchar **) g_malloc(sizeof(gchar *) * num_cols);
63 cinfo->col_custom_field = (gchar **) g_malloc(sizeof(gchar *) * num_cols);
64 cinfo->col_data = (const gchar **) g_malloc(sizeof(gchar *) * num_cols);
65 cinfo->col_buf = (gchar **) g_malloc(sizeof(gchar *) * num_cols);
66 cinfo->col_fence = (int *) g_malloc(sizeof(int) * num_cols);
67 cinfo->col_expr.col_expr = (gchar **) g_malloc(sizeof(gchar *) * (num_cols + 1));
68 cinfo->col_expr.col_expr_val = (gchar **) g_malloc(sizeof(gchar *) * (num_cols + 1));
70 for (i = 0; i < NUM_COL_FMTS; i++) {
71 cinfo->col_first[i] = -1;
72 cinfo->col_last[i] = -1;
76 /* Initialize the data structures for constructing column data. */
78 col_init(column_info *cinfo)
82 for (i = 0; i < cinfo->num_cols; i++) {
83 cinfo->col_buf[i][0] = '\0';
84 cinfo->col_data[i] = cinfo->col_buf[i];
85 cinfo->col_fence[i] = 0;
86 cinfo->col_expr.col_expr[i][0] = '\0';
87 cinfo->col_expr.col_expr_val[i][0] = '\0';
89 cinfo->writable = TRUE;
93 col_get_writable(column_info *cinfo)
95 return (cinfo ? cinfo->writable : FALSE);
99 col_set_writable(column_info *cinfo, gboolean writable)
102 cinfo->writable = writable;
105 /* Checks to see if a particular packet information element is needed for
108 check_col(column_info *cinfo, gint el) {
110 if (cinfo && cinfo->writable) {
111 /* We are constructing columns, and they're writable */
112 if (cinfo->col_first[el] >= 0) {
113 /* There is at least one column in that format */
120 /* Sets the fence for a column to be at the end of the column. */
122 col_set_fence(column_info *cinfo, gint el)
126 if (cinfo && cinfo->writable) {
127 /* We are constructing columns, and they're writable */
128 if (cinfo->col_first[el] >= 0) {
129 /* There is at least one column in that format */
130 for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
131 if (cinfo->fmt_matx[i][el]) {
132 cinfo->col_fence[i] = strlen(cinfo->col_data[i]);
139 /* Use this to clear out a column, especially if you're going to be
140 appending to it later; at least on some platforms, it's more
141 efficient than using "col_add_str()" with a null string, and
142 more efficient than "col_set_str()" with a null string if you
143 later append to it, as the later append will cause a string
146 col_clear(column_info *cinfo, gint el)
151 g_assert(cinfo->col_first[el] >= 0);
152 for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
153 if (cinfo->fmt_matx[i][el]) {
155 * At this point, either
157 * 1) col_data[i] is equal to col_buf[i], in which case we
158 * don't have to worry about copying col_data[i] to
161 * 2) col_data[i] isn't equal to col_buf[i], in which case
162 * the only thing that's been done to the column is
163 * "col_set_str()" calls and possibly "col_set_fence()"
164 * calls, in which case the fence is either unset and
165 * at the beginning of the string or set and at the end
166 * of the string - if it's at the beginning, we're just
167 * going to clear the column, and if it's at the end,
168 * we don't do anything.
170 fence = cinfo->col_fence[i];
171 if (fence == 0 || cinfo->col_buf[i] == cinfo->col_data[i]) {
173 * The fence isn't at the end of the column, or the column wasn't
174 * last set with "col_set_str()", so clear the column out.
176 cinfo->col_buf[i][fence] = '\0';
177 cinfo->col_data[i] = cinfo->col_buf[i];
179 cinfo->col_expr.col_expr[i][0] = '\0';
180 cinfo->col_expr.col_expr_val[i][0] = '\0';
185 #define COL_CHECK_APPEND(cinfo, i, max_len) \
186 if (cinfo->col_data[i] != cinfo->col_buf[i]) { \
187 /* This was set with "col_set_str()"; copy the string they \
188 set it to into the buffer, so we can append to it. */ \
189 g_strlcpy(cinfo->col_buf[i], cinfo->col_data[i], max_len); \
190 cinfo->col_data[i] = cinfo->col_buf[i]; \
193 #define COL_CHECK_REF_TIME(fd, cinfo, col) \
194 if(fd->flags.ref_time){ \
195 g_snprintf(cinfo->col_buf[col], COL_MAX_LEN, "*REF*"); \
196 cinfo->col_data[col] = cinfo->col_buf[col]; \
200 /* Use this if "str" points to something that will stay around (and thus
201 needn't be copied). */
203 col_set_str(column_info *cinfo, gint el, const gchar* str)
210 max_len = COL_MAX_INFO_LEN;
212 max_len = COL_MAX_LEN;
214 g_assert(cinfo->col_first[el] >= 0);
215 for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
216 if (cinfo->fmt_matx[i][el]) {
217 fence = cinfo->col_fence[i];
220 * We will append the string after the fence.
221 * First arrange that we can append, if necessary.
223 COL_CHECK_APPEND(cinfo, i, max_len);
225 g_strlcpy(&cinfo->col_buf[i][fence], str, max_len - fence);
228 * There's no fence, so we can just set the column to point
231 cinfo->col_data[i] = str;
237 /* Adds a vararg list to a packet info string. */
239 col_add_fstr(column_info *cinfo, gint el, const gchar *format, ...) {
245 g_assert(cinfo->col_first[el] >= 0);
247 max_len = COL_MAX_INFO_LEN;
249 max_len = COL_MAX_LEN;
251 va_start(ap, format);
252 for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
253 if (cinfo->fmt_matx[i][el]) {
254 fence = cinfo->col_fence[i];
257 * We will append the string after the fence.
258 * First arrange that we can append, if necessary.
260 COL_CHECK_APPEND(cinfo, i, max_len);
263 * There's no fence, so we can just write to the string.
265 cinfo->col_data[i] = cinfo->col_buf[i];
267 g_vsnprintf(&cinfo->col_buf[i][fence], max_len - fence, format, ap);
268 cinfo->col_buf[i][max_len - 1] = '\0';
275 col_custom_set_fstr(header_field_info *hfinfo, const gchar *format, ...)
280 if (!have_custom_cols(ci))
283 va_start(ap, format);
284 for (i = ci->col_first[COL_CUSTOM];
285 i <= ci->col_last[COL_CUSTOM]; i++) {
286 if (ci->fmt_matx[i][COL_CUSTOM] &&
287 strcmp(ci->col_custom_field[i], hfinfo->abbrev) == 0) {
288 ci->col_data[i] = ci->col_buf[i];
289 g_vsnprintf(ci->col_buf[i], COL_MAX_LEN, format, ap);
291 g_strlcpy(ci->col_expr.col_expr[i], hfinfo->abbrev, COL_MAX_LEN);
293 switch(hfinfo->type) {
296 g_snprintf(ci->col_expr.col_expr_val[i], COL_MAX_LEN, "\"%s\"",
301 g_strlcpy(ci->col_expr.col_expr_val[i], ci->col_buf[i], COL_MAX_LEN);
310 col_custom_prime_edt(epan_dissect_t *edt, column_info *cinfo)
313 dfilter_t *dfilter_code;
315 ci = cinfo; /* Save this into the static variable ci for use by
316 * col_custom_set_fstr() later. */
318 if(!have_custom_cols(cinfo))
321 for (i = cinfo->col_first[COL_CUSTOM];
322 i <= cinfo->col_last[COL_CUSTOM]; i++) {
323 if (cinfo->fmt_matx[i][COL_CUSTOM] &&
324 strlen(cinfo->col_custom_field[i]) > 0) {
325 if(dfilter_compile(cinfo->col_custom_field[i], &dfilter_code)) {
326 epan_dissect_prime_dfilter(edt, dfilter_code);
327 dfilter_free(dfilter_code);
334 have_custom_cols(column_info *cinfo)
336 /* The same as check_col(), but without the check to see if the column
338 if (cinfo && cinfo->col_first[COL_CUSTOM] >= 0)
345 col_has_time_fmt(column_info *cinfo, gint col)
347 return ((cinfo->fmt_matx[col][COL_CLS_TIME]) ||
348 (cinfo->fmt_matx[col][COL_ABS_TIME]) ||
349 (cinfo->fmt_matx[col][COL_ABS_DATE_TIME]) ||
350 (cinfo->fmt_matx[col][COL_REL_TIME]) ||
351 (cinfo->fmt_matx[col][COL_DELTA_TIME]) ||
352 (cinfo->fmt_matx[col][COL_DELTA_TIME_DIS]));
356 col_do_append_sep_va_fstr(column_info *cinfo, gint el, const gchar *separator,
357 const gchar *format, va_list ap)
360 size_t len, max_len, sep_len;
362 g_assert(cinfo->col_first[el] >= 0);
364 max_len = COL_MAX_INFO_LEN;
366 max_len = COL_MAX_LEN;
368 if (separator == NULL)
371 sep_len = strlen(separator);
372 for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
373 if (cinfo->fmt_matx[i][el]) {
375 * First arrange that we can append, if necessary.
377 COL_CHECK_APPEND(cinfo, i, max_len);
379 len = strlen(cinfo->col_buf[i]);
382 * If we have a separator, append it if the column isn't empty.
384 if (separator != NULL) {
386 g_strlcat(cinfo->col_buf[i], separator, max_len);
390 g_vsnprintf(&cinfo->col_buf[i][len], max_len - len, format, ap);
391 cinfo->col_buf[i][max_len-1] = 0;
396 /* Appends a vararg list to a packet info string. */
398 col_append_fstr(column_info *cinfo, gint el, const gchar *format, ...)
402 va_start(ap, format);
403 col_do_append_sep_va_fstr(cinfo, el, NULL, format, ap);
407 /* Appends a vararg list to a packet info string.
408 * Prefixes it with the given separator if the column is not empty. */
410 col_append_sep_fstr(column_info *cinfo, gint el, const gchar *separator,
411 const gchar *format, ...)
415 if (separator == NULL)
416 separator = ", "; /* default */
417 va_start(ap, format);
418 col_do_append_sep_va_fstr(cinfo, el, separator, format, ap);
424 /* Prepends a vararg list to a packet info string. */
425 #define COL_BUF_MAX_LEN (((COL_MAX_INFO_LEN) > (COL_MAX_LEN)) ? \
426 (COL_MAX_INFO_LEN) : (COL_MAX_LEN))
428 col_prepend_fstr(column_info *cinfo, gint el, const gchar *format, ...)
432 char orig_buf[COL_BUF_MAX_LEN];
436 g_assert(cinfo->col_first[el] >= 0);
438 max_len = COL_MAX_INFO_LEN;
440 max_len = COL_MAX_LEN;
442 va_start(ap, format);
443 for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
444 if (cinfo->fmt_matx[i][el]) {
445 if (cinfo->col_data[i] != cinfo->col_buf[i]) {
446 /* This was set with "col_set_str()"; which is effectively const */
447 orig = cinfo->col_data[i];
449 g_strlcpy(orig_buf, cinfo->col_buf[i], max_len);
452 g_vsnprintf(cinfo->col_buf[i], max_len, format, ap);
453 cinfo->col_buf[i][max_len - 1] = '\0';
456 * Move the fence, unless it's at the beginning of the string.
458 if (cinfo->col_fence[i] > 0)
459 cinfo->col_fence[i] += strlen(cinfo->col_buf[i]);
461 g_strlcat(cinfo->col_buf[i], orig, max_len);
462 cinfo->col_data[i] = cinfo->col_buf[i];
468 col_prepend_fence_fstr(column_info *cinfo, gint el, const gchar *format, ...)
472 char orig_buf[COL_BUF_MAX_LEN];
476 g_assert(cinfo->col_first[el] >= 0);
478 max_len = COL_MAX_INFO_LEN;
480 max_len = COL_MAX_LEN;
482 va_start(ap, format);
483 for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
484 if (cinfo->fmt_matx[i][el]) {
485 if (cinfo->col_data[i] != cinfo->col_buf[i]) {
486 /* This was set with "col_set_str()"; which is effectively const */
487 orig = cinfo->col_data[i];
489 g_strlcpy(orig_buf, cinfo->col_buf[i], max_len);
492 g_vsnprintf(cinfo->col_buf[i], max_len, format, ap);
493 cinfo->col_buf[i][max_len - 1] = '\0';
496 * Move the fence if it exists, else create a new fence at the
497 * end of the prepended data.
499 if (cinfo->col_fence[i] > 0) {
500 cinfo->col_fence[i] += strlen(cinfo->col_buf[i]);
502 cinfo->col_fence[i] = strlen(cinfo->col_buf[i]);
504 g_strlcat(cinfo->col_buf[i], orig, max_len);
505 cinfo->col_data[i] = cinfo->col_buf[i];
511 /* Use this if "str" points to something that won't stay around (and
512 must thus be copied). */
514 col_add_str(column_info *cinfo, gint el, const gchar* str)
520 g_assert(cinfo->col_first[el] >= 0);
522 max_len = COL_MAX_INFO_LEN;
524 max_len = COL_MAX_LEN;
526 for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
527 if (cinfo->fmt_matx[i][el]) {
528 fence = cinfo->col_fence[i];
531 * We will append the string after the fence.
532 * First arrange that we can append, if necessary.
534 COL_CHECK_APPEND(cinfo, i, max_len);
537 * There's no fence, so we can just write to the string.
539 cinfo->col_data[i] = cinfo->col_buf[i];
541 g_strlcpy(&cinfo->col_buf[i][fence], str, max_len - fence);
547 col_do_append_str(column_info *cinfo, gint el, const gchar* separator,
551 size_t len, max_len, sep_len;
553 g_assert(cinfo->col_first[el] >= 0);
555 max_len = COL_MAX_INFO_LEN;
557 max_len = COL_MAX_LEN;
559 if (separator == NULL)
562 sep_len = strlen(separator);
564 for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
565 if (cinfo->fmt_matx[i][el]) {
567 * First arrange that we can append, if necessary.
569 COL_CHECK_APPEND(cinfo, i, max_len);
571 len = cinfo->col_buf[i][0];
574 * If we have a separator, append it if the column isn't empty.
576 if (separator != NULL) {
578 g_strlcat(cinfo->col_buf[i], separator, max_len);
581 g_strlcat(cinfo->col_buf[i], str, max_len);
587 col_append_str(column_info *cinfo, gint el, const gchar* str)
589 col_do_append_str(cinfo, el, NULL, str);
593 col_append_sep_str(column_info *cinfo, gint el, const gchar* separator,
596 if (separator == NULL)
597 separator = ", "; /* default */
598 col_do_append_str(cinfo, el, separator, str);
602 col_set_abs_date_time(frame_data *fd, column_info *cinfo, int col)
607 COL_CHECK_REF_TIME(fd, cinfo, col);
609 then = fd->abs_ts.secs;
610 tmp = localtime(&then);
612 switch(timestamp_get_precision()) {
613 case(TS_PREC_FIXED_SEC):
614 case(TS_PREC_AUTO_SEC):
615 g_snprintf(cinfo->col_buf[col], COL_MAX_LEN,
616 "%04d-%02d-%02d %02d:%02d:%02d",
624 case(TS_PREC_FIXED_DSEC):
625 case(TS_PREC_AUTO_DSEC):
626 g_snprintf(cinfo->col_buf[col], COL_MAX_LEN,
627 "%04d-%02d-%02d %02d:%02d:%02d.%01ld",
634 (long)fd->abs_ts.nsecs / 100000000);
636 case(TS_PREC_FIXED_CSEC):
637 case(TS_PREC_AUTO_CSEC):
638 g_snprintf(cinfo->col_buf[col], COL_MAX_LEN,
639 "%04d-%02d-%02d %02d:%02d:%02d.%02ld",
646 (long)fd->abs_ts.nsecs / 10000000);
648 case(TS_PREC_FIXED_MSEC):
649 case(TS_PREC_AUTO_MSEC):
650 g_snprintf(cinfo->col_buf[col], COL_MAX_LEN,
651 "%04d-%02d-%02d %02d:%02d:%02d.%03ld",
658 (long)fd->abs_ts.nsecs / 1000000);
660 case(TS_PREC_FIXED_USEC):
661 case(TS_PREC_AUTO_USEC):
662 g_snprintf(cinfo->col_buf[col], COL_MAX_LEN,
663 "%04d-%02d-%02d %02d:%02d:%02d.%06ld",
670 (long)fd->abs_ts.nsecs / 1000);
672 case(TS_PREC_FIXED_NSEC):
673 case(TS_PREC_AUTO_NSEC):
674 g_snprintf(cinfo->col_buf[col], COL_MAX_LEN,
675 "%04d-%02d-%02d %02d:%02d:%02d.%09ld",
682 (long)fd->abs_ts.nsecs);
685 g_assert_not_reached();
688 cinfo->col_buf[col][0] = '\0';
690 cinfo->col_data[col] = cinfo->col_buf[col];
691 g_strlcpy(cinfo->col_expr.col_expr[col],"frame.time",COL_MAX_LEN);
692 g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->col_buf[col],COL_MAX_LEN);
696 col_set_rel_time(frame_data *fd, column_info *cinfo, int col)
698 COL_CHECK_REF_TIME(fd, cinfo, col);
700 switch(timestamp_get_precision()) {
701 case(TS_PREC_FIXED_SEC):
702 case(TS_PREC_AUTO_SEC):
703 display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
704 (gint32) fd->rel_ts.secs, fd->rel_ts.nsecs / 1000000000, SECS);
706 case(TS_PREC_FIXED_DSEC):
707 case(TS_PREC_AUTO_DSEC):
708 display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
709 (gint32) fd->rel_ts.secs, fd->rel_ts.nsecs / 100000000, DSECS);
711 case(TS_PREC_FIXED_CSEC):
712 case(TS_PREC_AUTO_CSEC):
713 display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
714 (gint32) fd->rel_ts.secs, fd->rel_ts.nsecs / 10000000, CSECS);
716 case(TS_PREC_FIXED_MSEC):
717 case(TS_PREC_AUTO_MSEC):
718 display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
719 (gint32) fd->rel_ts.secs, fd->rel_ts.nsecs / 1000000, MSECS);
721 case(TS_PREC_FIXED_USEC):
722 case(TS_PREC_AUTO_USEC):
723 display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
724 (gint32) fd->rel_ts.secs, fd->rel_ts.nsecs / 1000, USECS);
726 case(TS_PREC_FIXED_NSEC):
727 case(TS_PREC_AUTO_NSEC):
728 display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
729 (gint32) fd->rel_ts.secs, fd->rel_ts.nsecs, NSECS);
732 g_assert_not_reached();
734 cinfo->col_data[col] = cinfo->col_buf[col];
735 g_strlcpy(cinfo->col_expr.col_expr[col],"frame.time_relative", COL_MAX_LEN);
736 g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->col_buf[col],COL_MAX_LEN);
740 col_set_delta_time(frame_data *fd, column_info *cinfo, int col)
742 COL_CHECK_REF_TIME(fd, cinfo, col);
744 switch(timestamp_get_precision()) {
745 case(TS_PREC_FIXED_SEC):
746 case(TS_PREC_AUTO_SEC):
747 display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
748 (gint32) fd->del_cap_ts.secs, fd->del_cap_ts.nsecs / 1000000000, SECS);
750 case(TS_PREC_FIXED_DSEC):
751 case(TS_PREC_AUTO_DSEC):
752 display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
753 (gint32) fd->del_cap_ts.secs, fd->del_cap_ts.nsecs / 100000000, DSECS);
755 case(TS_PREC_FIXED_CSEC):
756 case(TS_PREC_AUTO_CSEC):
757 display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
758 (gint32) fd->del_cap_ts.secs, fd->del_cap_ts.nsecs / 10000000, CSECS);
760 case(TS_PREC_FIXED_MSEC):
761 case(TS_PREC_AUTO_MSEC):
762 display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
763 (gint32) fd->del_cap_ts.secs, fd->del_cap_ts.nsecs / 1000000, MSECS);
765 case(TS_PREC_FIXED_USEC):
766 case(TS_PREC_AUTO_USEC):
767 display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
768 (gint32) fd->del_cap_ts.secs, fd->del_cap_ts.nsecs / 1000, USECS);
770 case(TS_PREC_FIXED_NSEC):
771 case(TS_PREC_AUTO_NSEC):
772 display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
773 (gint32) fd->del_cap_ts.secs, fd->del_cap_ts.nsecs, NSECS);
776 g_assert_not_reached();
778 cinfo->col_data[col] = cinfo->col_buf[col];
779 g_strlcpy(cinfo->col_expr.col_expr[col],"frame.time_delta",COL_MAX_LEN);
780 g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->col_buf[col],COL_MAX_LEN);
784 col_set_delta_time_dis(frame_data *fd, column_info *cinfo, int col)
786 COL_CHECK_REF_TIME(fd, cinfo, col);
788 switch(timestamp_get_precision()) {
789 case(TS_PREC_FIXED_SEC):
790 case(TS_PREC_AUTO_SEC):
791 display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
792 (gint32) fd->del_dis_ts.secs, fd->del_dis_ts.nsecs / 1000000000, SECS);
794 case(TS_PREC_FIXED_DSEC):
795 case(TS_PREC_AUTO_DSEC):
796 display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
797 (gint32) fd->del_dis_ts.secs, fd->del_dis_ts.nsecs / 100000000, DSECS);
799 case(TS_PREC_FIXED_CSEC):
800 case(TS_PREC_AUTO_CSEC):
801 display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
802 (gint32) fd->del_dis_ts.secs, fd->del_dis_ts.nsecs / 10000000, CSECS);
804 case(TS_PREC_FIXED_MSEC):
805 case(TS_PREC_AUTO_MSEC):
806 display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
807 (gint32) fd->del_dis_ts.secs, fd->del_dis_ts.nsecs / 1000000, MSECS);
809 case(TS_PREC_FIXED_USEC):
810 case(TS_PREC_AUTO_USEC):
811 display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
812 (gint32) fd->del_dis_ts.secs, fd->del_dis_ts.nsecs / 1000, USECS);
814 case(TS_PREC_FIXED_NSEC):
815 case(TS_PREC_AUTO_NSEC):
816 display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
817 (gint32) fd->del_dis_ts.secs, fd->del_dis_ts.nsecs, NSECS);
820 g_assert_not_reached();
822 cinfo->col_data[col] = cinfo->col_buf[col];
823 g_strlcpy(cinfo->col_expr.col_expr[col],"frame.time_delta_displayed",
825 g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->col_buf[col],COL_MAX_LEN);
828 /* To do: Add check_col checks to the col_add* routines */
831 col_set_abs_time(frame_data *fd, column_info *cinfo, int col)
836 COL_CHECK_REF_TIME(fd, cinfo, col);
838 then = fd->abs_ts.secs;
839 tmp = localtime(&then);
841 switch(timestamp_get_precision()) {
842 case(TS_PREC_FIXED_SEC):
843 case(TS_PREC_AUTO_SEC):
844 g_snprintf(cinfo->col_buf[col], COL_MAX_LEN,
850 case(TS_PREC_FIXED_DSEC):
851 case(TS_PREC_AUTO_DSEC):
852 g_snprintf(cinfo->col_buf[col], COL_MAX_LEN,
853 "%02d:%02d:%02d.%01ld",
857 (long)fd->abs_ts.nsecs / 100000000);
859 case(TS_PREC_FIXED_CSEC):
860 case(TS_PREC_AUTO_CSEC):
861 g_snprintf(cinfo->col_buf[col], COL_MAX_LEN,
862 "%02d:%02d:%02d.%02ld",
866 (long)fd->abs_ts.nsecs / 10000000);
868 case(TS_PREC_FIXED_MSEC):
869 case(TS_PREC_AUTO_MSEC):
870 g_snprintf(cinfo->col_buf[col], COL_MAX_LEN,
871 "%02d:%02d:%02d.%03ld",
875 (long)fd->abs_ts.nsecs / 1000000);
877 case(TS_PREC_FIXED_USEC):
878 case(TS_PREC_AUTO_USEC):
879 g_snprintf(cinfo->col_buf[col], COL_MAX_LEN,
880 "%02d:%02d:%02d.%06ld",
884 (long)fd->abs_ts.nsecs / 1000);
886 case(TS_PREC_FIXED_NSEC):
887 case(TS_PREC_AUTO_NSEC):
888 g_snprintf(cinfo->col_buf[col], COL_MAX_LEN,
889 "%02d:%02d:%02d.%09ld",
893 (long)fd->abs_ts.nsecs);
896 g_assert_not_reached();
899 cinfo->col_buf[col][0] = '\0';
901 cinfo->col_data[col] = cinfo->col_buf[col];
902 g_strlcpy(cinfo->col_expr.col_expr[col],"frame.time",COL_MAX_LEN);
903 g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->col_buf[col],COL_MAX_LEN);
907 col_set_epoch_time(frame_data *fd, column_info *cinfo, int col)
910 COL_CHECK_REF_TIME(fd, cinfo, col);
912 switch(timestamp_get_precision()) {
913 case(TS_PREC_FIXED_SEC):
914 case(TS_PREC_AUTO_SEC):
915 display_epoch_time(cinfo->col_buf[col], COL_MAX_LEN,
916 fd->abs_ts.secs, fd->abs_ts.nsecs / 1000000000, SECS);
918 case(TS_PREC_FIXED_DSEC):
919 case(TS_PREC_AUTO_DSEC):
920 display_epoch_time(cinfo->col_buf[col], COL_MAX_LEN,
921 fd->abs_ts.secs, fd->abs_ts.nsecs / 100000000, DSECS);
923 case(TS_PREC_FIXED_CSEC):
924 case(TS_PREC_AUTO_CSEC):
925 display_epoch_time(cinfo->col_buf[col], COL_MAX_LEN,
926 fd->abs_ts.secs, fd->abs_ts.nsecs / 10000000, CSECS);
928 case(TS_PREC_FIXED_MSEC):
929 case(TS_PREC_AUTO_MSEC):
930 display_epoch_time(cinfo->col_buf[col], COL_MAX_LEN,
931 fd->abs_ts.secs, fd->abs_ts.nsecs / 1000000, MSECS);
933 case(TS_PREC_FIXED_USEC):
934 case(TS_PREC_AUTO_USEC):
935 display_epoch_time(cinfo->col_buf[col], COL_MAX_LEN,
936 fd->abs_ts.secs, fd->abs_ts.nsecs / 1000, USECS);
938 case(TS_PREC_FIXED_NSEC):
939 case(TS_PREC_AUTO_NSEC):
940 display_epoch_time(cinfo->col_buf[col], COL_MAX_LEN,
941 fd->abs_ts.secs, fd->abs_ts.nsecs, NSECS);
944 g_assert_not_reached();
946 cinfo->col_data[col] = cinfo->col_buf[col];
947 g_strlcpy(cinfo->col_expr.col_expr[col],"frame.time_delta",COL_MAX_LEN);
948 g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->col_buf[col],COL_MAX_LEN);
952 col_set_cls_time(frame_data *fd, column_info *cinfo, gint col)
954 switch (timestamp_get_type()) {
956 col_set_abs_time(fd, cinfo, col);
959 case TS_ABSOLUTE_WITH_DATE:
960 col_set_abs_date_time(fd, cinfo, col);
964 col_set_rel_time(fd, cinfo, col);
968 col_set_delta_time(fd, cinfo, col);
972 col_set_delta_time_dis(fd, cinfo, col);
976 col_set_epoch_time(fd, cinfo, col);
980 /* code is missing for this case, but I don't know which [jmayer20051219] */
986 /* Set the format of the variable time format.
987 XXX - this is called from "file.c" when the user changes the time
988 format they want for "command-line-specified" time; it's a bit ugly
989 that we have to export it, but if we go to a CList-like widget that
990 invokes callbacks to get the text for the columns rather than
991 requiring us to stuff the text into the widget from outside, we
992 might be able to clean this up. */
994 col_set_fmt_time(frame_data *fd, column_info *cinfo, gint fmt, gint col)
998 col_set_cls_time(fd, cinfo, col);
1002 col_set_abs_time(fd, cinfo, col);
1005 case COL_ABS_DATE_TIME:
1006 col_set_abs_date_time(fd, cinfo, col);
1010 col_set_rel_time(fd, cinfo, col);
1013 case COL_DELTA_TIME:
1014 col_set_delta_time(fd, cinfo, col);
1017 case COL_DELTA_TIME_DIS:
1018 col_set_delta_time_dis(fd, cinfo, col);
1021 case COL_REL_CONV_TIME:
1022 case COL_DELTA_CONV_TIME:
1023 /* Will be set by various dissectors */
1027 g_assert_not_reached();
1033 col_set_time(column_info *cinfo, gint el, nstime_t *ts, char *fieldname)
1037 g_assert(cinfo->col_first[el] >= 0);
1039 for (col = cinfo->col_first[el]; col <= cinfo->col_last[el]; col++) {
1040 if (cinfo->fmt_matx[col][el]) {
1041 switch(timestamp_get_precision()) {
1042 case(TS_PREC_FIXED_SEC):
1043 case(TS_PREC_AUTO_SEC):
1044 display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
1045 (gint32) ts->secs, ts->nsecs / 1000000000, SECS);
1047 case(TS_PREC_FIXED_DSEC):
1048 case(TS_PREC_AUTO_DSEC):
1049 display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
1050 (gint32) ts->secs, ts->nsecs / 100000000, DSECS);
1052 case(TS_PREC_FIXED_CSEC):
1053 case(TS_PREC_AUTO_CSEC):
1054 display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
1055 (gint32) ts->secs, ts->nsecs / 10000000, CSECS);
1057 case(TS_PREC_FIXED_MSEC):
1058 case(TS_PREC_AUTO_MSEC):
1059 display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
1060 (gint32) ts->secs, ts->nsecs / 1000000, MSECS);
1062 case(TS_PREC_FIXED_USEC):
1063 case(TS_PREC_AUTO_USEC):
1064 display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
1065 (gint32) ts->secs, ts->nsecs / 1000, USECS);
1067 case(TS_PREC_FIXED_NSEC):
1068 case(TS_PREC_AUTO_NSEC):
1069 display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
1070 (gint32) ts->secs, ts->nsecs, NSECS);
1073 g_assert_not_reached();
1075 cinfo->col_data[col] = cinfo->col_buf[col];
1076 g_strlcpy(cinfo->col_expr.col_expr[col],fieldname,COL_MAX_LEN);
1077 g_strlcpy(cinfo->col_expr.col_expr_val[col],cinfo->col_buf[col],
1084 col_set_addr(packet_info *pinfo, int col, address *addr, gboolean is_res,
1087 struct e_in6_addr ipv6_addr;
1089 pinfo->cinfo->col_expr.col_expr[col][0] = '\0';
1090 pinfo->cinfo->col_expr.col_expr_val[col][0] = '\0';
1092 if (addr->type == AT_NONE)
1093 return; /* no address, nothing to do */
1096 get_addr_name_buf(addr, pinfo->cinfo->col_buf[col], COL_MAX_LEN);
1098 address_to_str_buf(addr, pinfo->cinfo->col_buf[col], COL_MAX_LEN);
1100 pinfo->cinfo->col_data[col] = pinfo->cinfo->col_buf[col];
1102 switch (addr->type) {
1106 g_strlcpy(pinfo->cinfo->col_expr.col_expr[col], "eth.src",COL_MAX_LEN);
1108 g_strlcpy(pinfo->cinfo->col_expr.col_expr[col], "eth.dst",COL_MAX_LEN);
1109 g_strlcpy(pinfo->cinfo->col_expr.col_expr_val[col], ether_to_str(addr->data), COL_MAX_LEN);
1114 g_strlcpy(pinfo->cinfo->col_expr.col_expr[col], "ip.src", COL_MAX_LEN);
1116 g_strlcpy(pinfo->cinfo->col_expr.col_expr[col], "ip.dst",COL_MAX_LEN);
1117 g_strlcpy(pinfo->cinfo->col_expr.col_expr_val[col], ip_to_str(addr->data), COL_MAX_LEN);
1122 g_strlcpy(pinfo->cinfo->col_expr.col_expr[col], "ipv6.src", COL_MAX_LEN);
1124 g_strlcpy(pinfo->cinfo->col_expr.col_expr[col], "ipv6.dst", COL_MAX_LEN);
1125 memcpy(&ipv6_addr.bytes, addr->data, sizeof ipv6_addr.bytes);
1126 g_strlcpy(pinfo->cinfo->col_expr.col_expr_val[col], ip6_to_str(&ipv6_addr), COL_MAX_LEN);
1131 g_strlcpy(pinfo->cinfo->col_expr.col_expr[col], "ddp.src", COL_MAX_LEN);
1133 g_strlcpy(pinfo->cinfo->col_expr.col_expr[col], "ddp.dst", COL_MAX_LEN);
1134 g_strlcpy(pinfo->cinfo->col_expr.col_expr_val[col], pinfo->cinfo->col_buf[col], COL_MAX_LEN);
1139 g_strlcpy(pinfo->cinfo->col_expr.col_expr[col], "arcnet.src",
1142 g_strlcpy(pinfo->cinfo->col_expr.col_expr[col], "arcnet.dst",
1144 g_strlcpy(pinfo->cinfo->col_expr.col_expr_val[col], pinfo->cinfo->col_buf[col], COL_MAX_LEN);
1149 g_strlcpy(pinfo->cinfo->col_expr.col_expr[col], "uri.src", COL_MAX_LEN);
1151 g_strlcpy(pinfo->cinfo->col_expr.col_expr[col], "uri.dst", COL_MAX_LEN);
1152 address_to_str_buf(addr, pinfo->cinfo->col_expr.col_expr_val[col], COL_MAX_LEN);
1161 col_set_port(packet_info *pinfo, int col, gboolean is_res, gboolean is_src)
1166 port = pinfo->srcport;
1168 port = pinfo->destport;
1169 pinfo->cinfo->col_expr.col_expr[col][0] = '\0';
1170 pinfo->cinfo->col_expr.col_expr_val[col][0] = '\0';
1171 switch (pinfo->ptype) {
1175 g_strlcpy(pinfo->cinfo->col_buf[col], get_sctp_port(port), COL_MAX_LEN);
1177 g_snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", port);
1182 g_strlcpy(pinfo->cinfo->col_buf[col], get_tcp_port(port), COL_MAX_LEN);
1184 g_snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", port);
1186 g_strlcpy(pinfo->cinfo->col_expr.col_expr[col], "tcp.srcport",
1189 g_strlcpy(pinfo->cinfo->col_expr.col_expr[col], "tcp.dstport",
1191 g_snprintf(pinfo->cinfo->col_expr.col_expr_val[col], COL_MAX_LEN, "%u", port);
1192 pinfo->cinfo->col_expr.col_expr_val[col][COL_MAX_LEN - 1] = '\0';
1197 g_strlcpy(pinfo->cinfo->col_buf[col], get_udp_port(port), COL_MAX_LEN);
1199 g_snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", port);
1201 g_strlcpy(pinfo->cinfo->col_expr.col_expr[col], "udp.srcport",
1204 g_strlcpy(pinfo->cinfo->col_expr.col_expr[col], "udp.dstport",
1206 g_snprintf(pinfo->cinfo->col_expr.col_expr_val[col], COL_MAX_LEN, "%u", port);
1207 pinfo->cinfo->col_expr.col_expr_val[col][COL_MAX_LEN - 1] = '\0';
1212 g_strlcpy(pinfo->cinfo->col_expr.col_expr[col], "ddp.src_socket",
1215 g_strlcpy(pinfo->cinfo->col_expr.col_expr[col], "ddp.dst_socket",
1217 g_snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", port);
1218 g_snprintf(pinfo->cinfo->col_expr.col_expr_val[col], COL_MAX_LEN, "%u", port);
1219 pinfo->cinfo->col_expr.col_expr_val[col][COL_MAX_LEN - 1] = '\0';
1223 /* XXX - resolve IPX socket numbers */
1224 g_snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "0x%04x", port);
1226 g_strlcpy(pinfo->cinfo->col_expr.col_expr[col], "ipx.src.socket",
1229 g_strlcpy(pinfo->cinfo->col_expr.col_expr[col], "ipx.dst.socket",
1231 g_snprintf(pinfo->cinfo->col_expr.col_expr_val[col], COL_MAX_LEN, "0x%04x", port);
1232 pinfo->cinfo->col_expr.col_expr_val[col][COL_MAX_LEN - 1] = '\0';
1236 /* XXX - resolve IDP socket numbers */
1237 g_snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "0x%04x", port);
1239 g_strlcpy(pinfo->cinfo->col_expr.col_expr[col], "idp.src.socket",
1242 g_strlcpy(pinfo->cinfo->col_expr.col_expr[col], "idp.dst.socket",
1244 g_snprintf(pinfo->cinfo->col_expr.col_expr_val[col], COL_MAX_LEN, "0x%04x", port);
1245 pinfo->cinfo->col_expr.col_expr_val[col][COL_MAX_LEN - 1] = '\0';
1249 /* XXX - resolve USB endpoint numbers */
1250 g_snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "0x%08x", port);
1252 g_strlcpy(pinfo->cinfo->col_expr.col_expr[col], "usb.src.endpoint",
1255 g_strlcpy(pinfo->cinfo->col_expr.col_expr[col], "usb.dst.endpoint",
1257 g_snprintf(pinfo->cinfo->col_expr.col_expr_val[col], COL_MAX_LEN, "0x%08x", port);
1258 pinfo->cinfo->col_expr.col_expr_val[col][COL_MAX_LEN - 1] = '\0';
1264 pinfo->cinfo->col_buf[col][COL_MAX_LEN - 1] = '\0';
1265 pinfo->cinfo->col_data[col] = pinfo->cinfo->col_buf[col];
1269 * XXX - this should be in some common code in the epan directory, shared
1270 * by this code and packet-isdn.c.
1272 static const value_string channel_vals[] = {
1308 col_set_circuit_id(packet_info *pinfo, int col)
1310 pinfo->cinfo->col_expr.col_expr[col][0] = '\0';
1311 pinfo->cinfo->col_expr.col_expr_val[col][0] = '\0';
1312 switch (pinfo->ctype) {
1315 g_snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
1316 g_strlcpy(pinfo->cinfo->col_expr.col_expr[col], "fr.dlci", COL_MAX_LEN);
1317 g_snprintf(pinfo->cinfo->col_expr.col_expr_val[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
1318 pinfo->cinfo->col_expr.col_expr_val[col][COL_MAX_LEN - 1] = '\0';
1322 g_snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%s",
1323 val_to_str(pinfo->circuit_id, channel_vals, "Unknown (%u)"));
1324 g_strlcpy(pinfo->cinfo->col_expr.col_expr[col], "isdn.channel",
1326 g_snprintf(pinfo->cinfo->col_expr.col_expr_val[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
1327 pinfo->cinfo->col_expr.col_expr_val[col][COL_MAX_LEN - 1] = '\0';
1331 g_snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
1335 g_snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
1336 g_strlcpy(pinfo->cinfo->col_expr.col_expr[col], "isup.cic", COL_MAX_LEN);
1337 g_snprintf(pinfo->cinfo->col_expr.col_expr_val[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
1338 pinfo->cinfo->col_expr.col_expr_val[col][COL_MAX_LEN - 1] = '\0';
1344 pinfo->cinfo->col_buf[col][COL_MAX_LEN - 1] = '\0';
1345 pinfo->cinfo->col_data[col] = pinfo->cinfo->col_buf[col];
1349 col_fill_in(packet_info *pinfo)
1353 for (i = 0; i < pinfo->cinfo->num_cols; i++) {
1354 switch (pinfo->cinfo->col_fmt[i]) {
1357 g_snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "%u", pinfo->fd->num);
1358 pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
1359 g_strlcpy(pinfo->cinfo->col_expr.col_expr[i], "frame.number",
1361 g_strlcpy(pinfo->cinfo->col_expr.col_expr_val[i], pinfo->cinfo->col_buf[i], COL_MAX_LEN);
1365 col_set_cls_time(pinfo->fd, pinfo->cinfo, i);
1369 col_set_abs_time(pinfo->fd, pinfo->cinfo, i);
1372 case COL_ABS_DATE_TIME:
1373 col_set_abs_date_time(pinfo->fd, pinfo->cinfo, i);
1377 col_set_rel_time(pinfo->fd, pinfo->cinfo, i);
1380 case COL_DELTA_TIME:
1381 col_set_delta_time(pinfo->fd, pinfo->cinfo, i);
1384 case COL_DELTA_TIME_DIS:
1385 col_set_delta_time_dis(pinfo->fd, pinfo->cinfo, i);
1388 case COL_REL_CONV_TIME:
1389 case COL_DELTA_CONV_TIME:
1390 break; /* Will be set by various dissectors */
1393 case COL_RES_SRC: /* COL_DEF_SRC is currently just like COL_RES_SRC */
1394 col_set_addr(pinfo, i, &pinfo->src, TRUE, TRUE);
1398 col_set_addr(pinfo, i, &pinfo->src, FALSE, TRUE);
1401 case COL_DEF_DL_SRC:
1402 case COL_RES_DL_SRC:
1403 col_set_addr(pinfo, i, &pinfo->dl_src, TRUE, TRUE);
1406 case COL_UNRES_DL_SRC:
1407 col_set_addr(pinfo, i, &pinfo->dl_src, FALSE, TRUE);
1410 case COL_DEF_NET_SRC:
1411 case COL_RES_NET_SRC:
1412 col_set_addr(pinfo, i, &pinfo->net_src, TRUE, TRUE);
1415 case COL_UNRES_NET_SRC:
1416 col_set_addr(pinfo, i, &pinfo->net_src, FALSE, TRUE);
1420 case COL_RES_DST: /* COL_DEF_DST is currently just like COL_RES_DST */
1421 col_set_addr(pinfo, i, &pinfo->dst, TRUE, FALSE);
1425 col_set_addr(pinfo, i, &pinfo->dst, FALSE, FALSE);
1428 case COL_DEF_DL_DST:
1429 case COL_RES_DL_DST:
1430 col_set_addr(pinfo, i, &pinfo->dl_dst, TRUE, FALSE);
1433 case COL_UNRES_DL_DST:
1434 col_set_addr(pinfo, i, &pinfo->dl_dst, FALSE, FALSE);
1437 case COL_DEF_NET_DST:
1438 case COL_RES_NET_DST:
1439 col_set_addr(pinfo, i, &pinfo->net_dst, TRUE, FALSE);
1442 case COL_UNRES_NET_DST:
1443 col_set_addr(pinfo, i, &pinfo->net_dst, FALSE, FALSE);
1446 case COL_DEF_SRC_PORT:
1447 case COL_RES_SRC_PORT: /* COL_DEF_SRC_PORT is currently just like COL_RES_SRC_PORT */
1448 col_set_port(pinfo, i, TRUE, TRUE);
1451 case COL_UNRES_SRC_PORT:
1452 col_set_port(pinfo, i, FALSE, TRUE);
1455 case COL_DEF_DST_PORT:
1456 case COL_RES_DST_PORT: /* COL_DEF_DST_PORT is currently just like COL_RES_DST_PORT */
1457 col_set_port(pinfo, i, TRUE, FALSE);
1460 case COL_UNRES_DST_PORT:
1461 col_set_port(pinfo, i, FALSE, FALSE);
1464 case COL_PROTOCOL: /* currently done by dissectors */
1465 case COL_INFO: /* currently done by dissectors */
1468 case COL_PACKET_LENGTH:
1469 g_snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "%u", pinfo->fd->pkt_len);
1470 pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
1471 g_strlcpy(pinfo->cinfo->col_expr.col_expr[i], "frame.len",
1473 g_strlcpy(pinfo->cinfo->col_expr.col_expr_val[i], pinfo->cinfo->col_buf[i], COL_MAX_LEN);
1476 case COL_CUMULATIVE_BYTES:
1477 g_snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "%u", pinfo->fd->cum_bytes);
1478 pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
1482 g_snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "0x%x", pinfo->oxid);
1483 pinfo->cinfo->col_buf[i][COL_MAX_LEN - 1] = '\0';
1484 pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
1488 g_snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "0x%x", pinfo->rxid);
1489 pinfo->cinfo->col_buf[i][COL_MAX_LEN - 1] = '\0';
1490 pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
1493 case COL_IF_DIR: /* currently done by dissectors */
1496 case COL_CIRCUIT_ID:
1497 col_set_circuit_id(pinfo, i);
1501 g_snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "0x%x", pinfo->src_idx);
1502 pinfo->cinfo->col_buf[i][COL_MAX_LEN - 1] = '\0';
1503 pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
1507 g_snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "0x%x", pinfo->dst_idx);
1508 pinfo->cinfo->col_buf[i][COL_MAX_LEN - 1] = '\0';
1509 pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
1513 g_snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "%u", pinfo->vsan);
1514 pinfo->cinfo->col_buf[i][COL_MAX_LEN - 1] = '\0';
1515 pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
1518 case COL_HPUX_SUBSYS: /* done by nettl disector */
1519 case COL_HPUX_DEVID: /* done by nettl disector */
1522 case COL_DCE_CALL: /* done by dcerpc */
1525 case COL_DCE_CTX: /* done by dcerpc */
1528 case COL_8021Q_VLAN_ID:
1531 case COL_DSCP_VALUE: /* done by packet-ip.c */
1534 case COL_COS_VALUE: /* done by packet-vlan.c */
1537 case COL_FR_DLCI: /* done by packet-fr.c */
1538 case COL_BSSGP_TLLI: /* done by packet-bssgp.c */
1541 case COL_EXPERT: /* done by expert.c */
1544 case COL_FREQ_CHAN: /* done by radio dissectors */
1547 case COL_CUSTOM: /* done by col_custom_set_fstr() called from proto.c */
1550 case NUM_COL_FMTS: /* keep compiler happy - shouldn't get here */
1551 g_assert_not_reached();