2 * Routines for column utilities.
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@ethereal.com>
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 #ifdef NEED_SNPRINTF_H
33 # include "snprintf.h"
36 #include "column-utils.h"
37 #include "timestamp.h"
38 #include "sna-utils.h"
39 #include "atalk-utils.h"
41 #include "packet_info.h"
43 #include "addr_resolv.h"
44 #include "ipv6-utils.h"
45 #include "osi-utils.h"
46 #include "value_string.h"
48 /* Allocate all the data structures for constructing column data, given
49 the number of columns. */
51 col_setup(column_info *col_info, gint num_cols)
55 col_info->num_cols = num_cols;
56 col_info->col_fmt = (gint *) g_malloc(sizeof(gint) * num_cols);
57 col_info->fmt_matx = (gboolean **) g_malloc(sizeof(gboolean *) * num_cols);
58 col_info->col_first = (int *) g_malloc(sizeof(int) * (NUM_COL_FMTS));
59 col_info->col_last = (int *) g_malloc(sizeof(int) * (NUM_COL_FMTS));
60 col_info->col_title = (gchar **) g_malloc(sizeof(gchar *) * num_cols);
61 col_info->col_data = (gchar **) g_malloc(sizeof(gchar *) * num_cols);
62 col_info->col_buf = (gchar **) g_malloc(sizeof(gchar *) * num_cols);
63 col_info->col_fence = (int *) g_malloc(sizeof(int) * num_cols);
64 col_info->col_expr = (gchar **) g_malloc(sizeof(gchar *) * num_cols);
65 col_info->col_expr_val = (gchar **) g_malloc(sizeof(gchar *) * num_cols);
67 for (i = 0; i < NUM_COL_FMTS; i++) {
68 col_info->col_first[i] = -1;
69 col_info->col_last[i] = -1;
73 /* Initialize the data structures for constructing column data. */
75 col_init(column_info *cinfo)
79 for (i = 0; i < cinfo->num_cols; i++) {
80 cinfo->col_buf[i][0] = '\0';
81 cinfo->col_data[i] = cinfo->col_buf[i];
82 cinfo->col_fence[i] = 0;
83 cinfo->col_expr[i][0] = '\0';
84 cinfo->col_expr_val[i][0] = '\0';
86 cinfo->writable = TRUE;
90 col_get_writable(column_info *cinfo)
92 return (cinfo ? cinfo->writable : FALSE);
96 col_set_writable(column_info *cinfo, gboolean writable)
99 cinfo->writable = writable;
102 /* Checks to see if a particular packet information element is needed for
105 check_col(column_info *cinfo, gint el) {
107 if (cinfo && cinfo->writable) {
108 /* We are constructing columns, and they're writable */
109 if (cinfo->col_first[el] >= 0) {
110 /* There is at least one column in that format */
117 /* Sets the fence for a column to be at the end of the column. */
119 col_set_fence(column_info *cinfo, gint el)
123 if (cinfo && cinfo->writable) {
124 /* We are constructing columns, and they're writable */
125 if (cinfo->col_first[el] >= 0) {
126 /* There is at least one column in that format */
127 for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
128 if (cinfo->fmt_matx[i][el]) {
129 cinfo->col_fence[i] = strlen(cinfo->col_data[i]);
136 /* Use this to clear out a column, especially if you're going to be
137 appending to it later; at least on some platforms, it's more
138 efficient than using "col_add_str()" with a null string, and
139 more efficient than "col_set_str()" with a null string if you
140 later append to it, as the later append will cause a string
143 col_clear(column_info *cinfo, gint el)
148 g_assert(cinfo->col_first[el] >= 0);
149 for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
150 if (cinfo->fmt_matx[i][el]) {
152 * At this point, either
154 * 1) col_data[i] is equal to col_buf[i], in which case we
155 * don't have to worry about copying col_data[i] to
158 * 2) col_data[i] isn't equal to col_buf[i], in which case
159 * the only thing that's been done to the column is
160 * "col_set_str()" calls and possibly "col_set_fence()"
161 * calls, in which case the fence is either unset and
162 * at the beginning of the string or set and at the end
163 * of the string - if it's at the beginning, we're just
164 * going to clear the column, and if it's at the end,
165 * we don't do anything.
167 fence = cinfo->col_fence[i];
168 if (fence == 0 || cinfo->col_buf[i] == cinfo->col_data[i]) {
170 * The fence isn't at the end of the column, or the column wasn't
171 * last set with "col_set_str()", so clear the column out.
173 cinfo->col_buf[i][fence] = '\0';
174 cinfo->col_data[i] = cinfo->col_buf[i];
176 cinfo->col_expr[i][0] = '\0';
177 cinfo->col_expr_val[i][0] = '\0';
182 #define COL_CHECK_APPEND(cinfo, i, max_len) \
183 if (cinfo->col_data[i] != cinfo->col_buf[i]) { \
184 /* This was set with "col_set_str()"; copy the string they \
185 set it to into the buffer, so we can append to it. */ \
186 strncpy(cinfo->col_buf[i], cinfo->col_data[i], max_len); \
187 cinfo->col_buf[i][max_len - 1] = '\0'; \
188 cinfo->col_data[i] = cinfo->col_buf[i]; \
191 /* Use this if "str" points to something that will stay around (and thus
192 needn't be copied). */
194 col_set_str(column_info *cinfo, gint el, const gchar* str)
201 max_len = COL_MAX_INFO_LEN;
203 max_len = COL_MAX_LEN;
205 g_assert(cinfo->col_first[el] >= 0);
206 for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
207 if (cinfo->fmt_matx[i][el]) {
208 fence = cinfo->col_fence[i];
211 * We will append the string after the fence.
212 * First arrange that we can append, if necessary.
214 COL_CHECK_APPEND(cinfo, i, max_len);
216 strncpy(&cinfo->col_buf[i][fence], str, max_len - fence);
217 cinfo->col_buf[i][max_len - 1] = 0;
220 * There's no fence, so we can just set the column to point
223 cinfo->col_data[i] = str;
229 /* Adds a vararg list to a packet info string. */
231 col_add_fstr(column_info *cinfo, gint el, const gchar *format, ...) {
237 g_assert(cinfo->col_first[el] >= 0);
239 max_len = COL_MAX_INFO_LEN;
241 max_len = COL_MAX_LEN;
243 va_start(ap, format);
244 for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
245 if (cinfo->fmt_matx[i][el]) {
246 fence = cinfo->col_fence[i];
249 * We will append the string after the fence.
250 * First arrange that we can append, if necessary.
252 COL_CHECK_APPEND(cinfo, i, max_len);
255 * There's no fence, so we can just write to the string.
257 cinfo->col_data[i] = cinfo->col_buf[i];
259 vsnprintf(&cinfo->col_buf[i][fence], max_len - fence, format, ap);
260 cinfo->col_buf[i][max_len - 1] = '\0';
267 col_do_append_sep_va_fstr(column_info *cinfo, gint el, const gchar *separator,
268 const gchar *format, va_list ap)
271 size_t len, max_len, sep_len;
273 g_assert(cinfo->col_first[el] >= 0);
275 max_len = COL_MAX_INFO_LEN;
277 max_len = COL_MAX_LEN;
279 if (separator == NULL)
282 sep_len = strlen(separator);
283 for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
284 if (cinfo->fmt_matx[i][el]) {
286 * First arrange that we can append, if necessary.
288 COL_CHECK_APPEND(cinfo, i, max_len);
290 len = strlen(cinfo->col_buf[i]);
293 * If we have a separator, append it if the column isn't empty.
295 if (separator != NULL) {
297 strncat(cinfo->col_buf[i], separator, max_len - len);
301 vsnprintf(&cinfo->col_buf[i][len], max_len - len, format, ap);
302 cinfo->col_buf[i][max_len-1] = 0;
307 /* Appends a vararg list to a packet info string. */
309 col_append_fstr(column_info *cinfo, gint el, const gchar *format, ...)
313 va_start(ap, format);
314 col_do_append_sep_va_fstr(cinfo, el, NULL, format, ap);
318 /* Appends a vararg list to a packet info string.
319 * Prefixes it with the given separator if the column is not empty. */
321 col_append_sep_fstr(column_info *cinfo, gint el, const gchar *separator,
322 const gchar *format, ...)
326 if (separator == NULL)
327 separator = ", "; /* default */
328 va_start(ap, format);
329 col_do_append_sep_va_fstr(cinfo, el, separator, format, ap);
335 /* Prepends a vararg list to a packet info string. */
336 #define COL_BUF_MAX_LEN (((COL_MAX_INFO_LEN) > (COL_MAX_LEN)) ? \
337 (COL_MAX_INFO_LEN) : (COL_MAX_LEN))
339 col_prepend_fstr(column_info *cinfo, gint el, const gchar *format, ...)
343 char orig_buf[COL_BUF_MAX_LEN];
347 g_assert(cinfo->col_first[el] >= 0);
349 max_len = COL_MAX_INFO_LEN;
351 max_len = COL_MAX_LEN;
353 va_start(ap, format);
354 for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
355 if (cinfo->fmt_matx[i][el]) {
356 if (cinfo->col_data[i] != cinfo->col_buf[i]) {
357 /* This was set with "col_set_str()"; which is effectively const */
358 orig = cinfo->col_data[i];
360 strncpy(orig_buf, cinfo->col_buf[i], max_len);
361 orig_buf[max_len - 1] = '\0';
364 vsnprintf(cinfo->col_buf[i], max_len, format, ap);
365 cinfo->col_buf[i][max_len - 1] = '\0';
368 * Move the fence, unless it's at the beginning of the string.
370 if (cinfo->col_fence[i] > 0)
371 cinfo->col_fence[i] += strlen(cinfo->col_buf[i]);
373 strncat(cinfo->col_buf[i], orig, max_len);
374 cinfo->col_buf[i][max_len - 1] = '\0';
375 cinfo->col_data[i] = cinfo->col_buf[i];
381 /* Use this if "str" points to something that won't stay around (and
382 must thus be copied). */
384 col_add_str(column_info *cinfo, gint el, const gchar* str)
390 g_assert(cinfo->col_first[el] >= 0);
392 max_len = COL_MAX_INFO_LEN;
394 max_len = COL_MAX_LEN;
396 for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
397 if (cinfo->fmt_matx[i][el]) {
398 fence = cinfo->col_fence[i];
401 * We will append the string after the fence.
402 * First arrange that we can append, if necessary.
404 COL_CHECK_APPEND(cinfo, i, max_len);
407 * There's no fence, so we can just write to the string.
409 cinfo->col_data[i] = cinfo->col_buf[i];
411 strncpy(&cinfo->col_buf[i][fence], str, max_len - fence);
412 cinfo->col_buf[i][max_len - 1] = 0;
418 col_do_append_str(column_info *cinfo, gint el, const gchar* separator,
422 size_t len, max_len, sep_len;
424 g_assert(cinfo->col_first[el] >= 0);
426 max_len = COL_MAX_INFO_LEN;
428 max_len = COL_MAX_LEN;
430 if (separator == NULL)
433 sep_len = strlen(separator);
435 for (i = cinfo->col_first[el]; i <= cinfo->col_last[el]; i++) {
436 if (cinfo->fmt_matx[i][el]) {
438 * First arrange that we can append, if necessary.
440 COL_CHECK_APPEND(cinfo, i, max_len);
442 len = strlen(cinfo->col_buf[i]);
445 * If we have a separator, append it if the column isn't empty.
447 if (separator != NULL) {
449 strncat(cinfo->col_buf[i], separator, max_len - len);
453 strncat(cinfo->col_buf[i], str, max_len - len);
454 cinfo->col_buf[i][max_len - 1] = 0;
460 col_append_str(column_info *cinfo, gint el, const gchar* str)
462 col_do_append_str(cinfo, el, NULL, str);
466 col_append_sep_str(column_info *cinfo, gint el, const gchar* separator,
469 if (separator == NULL)
470 separator = ", "; /* default */
471 col_do_append_str(cinfo, el, separator, str);
475 col_set_abs_date_time(frame_data *fd, column_info *cinfo, int col)
481 tmp = localtime(&then);
483 snprintf(cinfo->col_buf[col], COL_MAX_LEN,
484 "%04d-%02d-%02d %02d:%02d:%02d.%06ld",
491 (long)fd->abs_usecs);
493 cinfo->col_buf[col][0] = '\0';
495 cinfo->col_data[col] = cinfo->col_buf[col];
496 strcpy(cinfo->col_expr[col],"frame.time");
497 strcpy(cinfo->col_expr_val[col],cinfo->col_buf[col]);
501 col_set_rel_time(frame_data *fd, column_info *cinfo, int col)
503 display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
504 fd->rel_secs, fd->rel_usecs, USECS);
505 cinfo->col_data[col] = cinfo->col_buf[col];
506 strcpy(cinfo->col_expr[col],"frame.time_relative");
507 strcpy(cinfo->col_expr_val[col],cinfo->col_buf[col]);
511 col_set_delta_time(frame_data *fd, column_info *cinfo, int col)
513 display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
514 fd->del_secs, fd->del_usecs, USECS);
515 cinfo->col_data[col] = cinfo->col_buf[col];
516 strcpy(cinfo->col_expr[col],"frame.time_delta");
517 strcpy(cinfo->col_expr_val[col],cinfo->col_buf[col]);
520 /* To do: Add check_col checks to the col_add* routines */
523 col_set_abs_time(frame_data *fd, column_info *cinfo, int col)
529 tmp = localtime(&then);
531 snprintf(cinfo->col_buf[col], COL_MAX_LEN, "%02d:%02d:%02d.%06ld",
535 (long)fd->abs_usecs);
537 cinfo->col_buf[col][0] = '\0';
539 cinfo->col_data[col] = cinfo->col_buf[col];
540 strcpy(cinfo->col_expr[col],"frame.time");
541 strcpy(cinfo->col_expr_val[col],cinfo->col_buf[col]);
544 /* Add "command-line-specified" time.
545 XXX - this is called from "file.c" when the user changes the time
546 format they want for "command-line-specified" time; it's a bit ugly
547 that we have to export it, but if we go to a CList-like widget that
548 invokes callbacks to get the text for the columns rather than
549 requiring us to stuff the text into the widget from outside, we
550 might be able to clean this up. */
552 col_set_cls_time(frame_data *fd, column_info *cinfo, int col)
554 switch (get_timestamp_setting()) {
556 col_set_abs_time(fd, cinfo, col);
559 case TS_ABSOLUTE_WITH_DATE:
560 col_set_abs_date_time(fd, cinfo, col);
564 col_set_rel_time(fd, cinfo, col);
568 col_set_delta_time(fd, cinfo, col);
574 col_set_addr(packet_info *pinfo, int col, address *addr, gboolean is_res,
577 const char *addr_string;
578 struct e_in6_addr ipv6_addr;
580 pinfo->cinfo->col_expr[col][0] = '\0';
581 pinfo->cinfo->col_expr_val[col][0] = '\0';
582 if (addr->type == AT_NONE)
583 return; /* no address, nothing to do */
585 addr_string = get_addr_name(addr);
586 if (addr_string != NULL) {
587 strncpy(pinfo->cinfo->col_buf[col], addr_string, COL_MAX_LEN);
588 pinfo->cinfo->col_buf[col][COL_MAX_LEN - 1] = '\0';
590 address_to_str_buf(addr, pinfo->cinfo->col_buf[col]);
592 switch (addr->type) {
595 /* XXX - should be done in "address_to_str_buf()", but that routine
596 doesn't know COL_MAX_LEN; it should be changed to take the
597 maximum length as an argument. */
598 strncpy(pinfo->cinfo->col_buf[col], addr->data, COL_MAX_LEN);
599 pinfo->cinfo->col_buf[col][COL_MAX_LEN - 1] = '\0';
603 address_to_str_buf(addr, pinfo->cinfo->col_buf[col]);
607 pinfo->cinfo->col_data[col] = pinfo->cinfo->col_buf[col];
609 switch (addr->type) {
613 strcpy(pinfo->cinfo->col_expr[col], "eth.src");
615 strcpy(pinfo->cinfo->col_expr[col], "eth.dst");
616 strncpy(pinfo->cinfo->col_expr_val[col], ether_to_str(addr->data), COL_MAX_LEN);
617 pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
622 strcpy(pinfo->cinfo->col_expr[col], "ip.src");
624 strcpy(pinfo->cinfo->col_expr[col], "ip.dst");
625 strncpy(pinfo->cinfo->col_expr_val[col], ip_to_str(addr->data), COL_MAX_LEN);
626 pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
631 strcpy(pinfo->cinfo->col_expr[col], "ipv6.src");
633 strcpy(pinfo->cinfo->col_expr[col], "ipv6.dst");
634 strncpy(pinfo->cinfo->col_expr_val[col], ip6_to_str(&ipv6_addr), COL_MAX_LEN);
635 pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
640 strcpy(pinfo->cinfo->col_expr[col], "ddp.src");
642 strcpy(pinfo->cinfo->col_expr[col], "ddp.dst");
643 strcpy(pinfo->cinfo->col_expr_val[col], pinfo->cinfo->col_buf[col]);
648 strcpy(pinfo->cinfo->col_expr[col], "arcnet.src");
650 strcpy(pinfo->cinfo->col_expr[col], "arcnet.dst");
651 strcpy(pinfo->cinfo->col_expr_val[col], pinfo->cinfo->col_buf[col]);
660 col_set_port(packet_info *pinfo, int col, gboolean is_res, gboolean is_src)
665 port = pinfo->srcport;
667 port = pinfo->destport;
668 pinfo->cinfo->col_expr[col][0] = '\0';
669 pinfo->cinfo->col_expr_val[col][0] = '\0';
670 switch (pinfo->ptype) {
674 strncpy(pinfo->cinfo->col_buf[col], get_sctp_port(port), COL_MAX_LEN);
676 snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", port);
681 strncpy(pinfo->cinfo->col_buf[col], get_tcp_port(port), COL_MAX_LEN);
683 snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", port);
685 strcpy(pinfo->cinfo->col_expr[col], "tcp.srcport");
687 strcpy(pinfo->cinfo->col_expr[col], "tcp.dstport");
688 snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "%u", port);
689 pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
694 strncpy(pinfo->cinfo->col_buf[col], get_udp_port(port), COL_MAX_LEN);
696 snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", port);
698 strcpy(pinfo->cinfo->col_expr[col], "udp.srcport");
700 strcpy(pinfo->cinfo->col_expr[col], "udp.dstport");
701 snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "%u", port);
702 pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
707 strcpy(pinfo->cinfo->col_expr[col], "ddp.src_socket");
709 strcpy(pinfo->cinfo->col_expr[col], "ddp.dst_socket");
710 snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", port);
711 snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "%u", port);
712 pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
716 /* XXX - resolve IPX socket numbers */
717 snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "0x%04x", port);
719 strcpy(pinfo->cinfo->col_expr[col], "ipx.src.socket");
721 strcpy(pinfo->cinfo->col_expr[col], "ipx.dst.socket");
722 snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "0x%04x", port);
723 pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
729 pinfo->cinfo->col_buf[col][COL_MAX_LEN - 1] = '\0';
730 pinfo->cinfo->col_data[col] = pinfo->cinfo->col_buf[col];
734 * XXX - this should be in some common code in the epan directory, shared
735 * by this code and packet-isdn.c.
737 static const value_string channel_vals[] = {
773 col_set_circuit_id(packet_info *pinfo, int col)
775 pinfo->cinfo->col_expr[col][0] = '\0';
776 pinfo->cinfo->col_expr_val[col][0] = '\0';
777 switch (pinfo->ctype) {
780 snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
781 strcpy(pinfo->cinfo->col_expr[col], "fr.dlci");
782 snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
783 pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
787 snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%s",
788 val_to_str(pinfo->circuit_id, channel_vals, "Unknown (%u)"));
789 strcpy(pinfo->cinfo->col_expr[col], "isdn.channel");
790 snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
791 pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
795 snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
799 snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
800 strcpy(pinfo->cinfo->col_expr[col], "isup.cic");
801 snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
802 pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
808 pinfo->cinfo->col_buf[col][COL_MAX_LEN - 1] = '\0';
809 pinfo->cinfo->col_data[col] = pinfo->cinfo->col_buf[col];
813 fill_in_columns(packet_info *pinfo)
817 for (i = 0; i < pinfo->cinfo->num_cols; i++) {
818 switch (pinfo->cinfo->col_fmt[i]) {
821 snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "%u", pinfo->fd->num);
822 pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
823 strcpy(pinfo->cinfo->col_expr[i], "frame.number");
824 strcpy(pinfo->cinfo->col_expr_val[i], pinfo->cinfo->col_buf[i]);
828 if(pinfo->fd->flags.ref_time){
829 snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "*REF*");
830 pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
832 col_set_cls_time(pinfo->fd, pinfo->cinfo, i);
837 if(pinfo->fd->flags.ref_time){
838 snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "*REF*");
839 pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
841 col_set_abs_time(pinfo->fd, pinfo->cinfo, i);
845 case COL_ABS_DATE_TIME:
846 if(pinfo->fd->flags.ref_time){
847 snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "*REF*");
848 pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
850 col_set_abs_date_time(pinfo->fd, pinfo->cinfo, i);
855 if(pinfo->fd->flags.ref_time){
856 snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "*REF*");
857 pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
859 col_set_rel_time(pinfo->fd, pinfo->cinfo, i);
864 if(pinfo->fd->flags.ref_time){
865 snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "*REF*");
866 pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
868 col_set_delta_time(pinfo->fd, pinfo->cinfo, i);
873 case COL_RES_SRC: /* COL_DEF_SRC is currently just like COL_RES_SRC */
874 col_set_addr(pinfo, i, &pinfo->src, TRUE, TRUE);
878 col_set_addr(pinfo, i, &pinfo->src, FALSE, TRUE);
883 col_set_addr(pinfo, i, &pinfo->dl_src, TRUE, TRUE);
886 case COL_UNRES_DL_SRC:
887 col_set_addr(pinfo, i, &pinfo->dl_src, FALSE, TRUE);
890 case COL_DEF_NET_SRC:
891 case COL_RES_NET_SRC:
892 col_set_addr(pinfo, i, &pinfo->net_src, TRUE, TRUE);
895 case COL_UNRES_NET_SRC:
896 col_set_addr(pinfo, i, &pinfo->net_src, FALSE, TRUE);
900 case COL_RES_DST: /* COL_DEF_DST is currently just like COL_RES_DST */
901 col_set_addr(pinfo, i, &pinfo->dst, TRUE, FALSE);
905 col_set_addr(pinfo, i, &pinfo->dst, FALSE, FALSE);
910 col_set_addr(pinfo, i, &pinfo->dl_dst, TRUE, FALSE);
913 case COL_UNRES_DL_DST:
914 col_set_addr(pinfo, i, &pinfo->dl_dst, FALSE, FALSE);
917 case COL_DEF_NET_DST:
918 case COL_RES_NET_DST:
919 col_set_addr(pinfo, i, &pinfo->net_dst, TRUE, FALSE);
922 case COL_UNRES_NET_DST:
923 col_set_addr(pinfo, i, &pinfo->net_dst, FALSE, FALSE);
926 case COL_DEF_SRC_PORT:
927 case COL_RES_SRC_PORT: /* COL_DEF_SRC_PORT is currently just like COL_RES_SRC_PORT */
928 col_set_port(pinfo, i, TRUE, TRUE);
931 case COL_UNRES_SRC_PORT:
932 col_set_port(pinfo, i, FALSE, TRUE);
935 case COL_DEF_DST_PORT:
936 case COL_RES_DST_PORT: /* COL_DEF_DST_PORT is currently just like COL_RES_DST_PORT */
937 col_set_port(pinfo, i, TRUE, FALSE);
940 case COL_UNRES_DST_PORT:
941 col_set_port(pinfo, i, FALSE, FALSE);
944 case COL_PROTOCOL: /* currently done by dissectors */
945 case COL_INFO: /* currently done by dissectors */
948 case COL_PACKET_LENGTH:
949 snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "%u", pinfo->fd->pkt_len);
950 pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
951 strcpy(pinfo->cinfo->col_expr[i], "frame.pkt_len");
952 strcpy(pinfo->cinfo->col_expr_val[i], pinfo->cinfo->col_buf[i]);
955 case COL_CUMULATIVE_BYTES:
956 snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "%u", pinfo->fd->cum_bytes);
957 pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
961 snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "0x%x", pinfo->oxid);
962 pinfo->cinfo->col_buf[i][COL_MAX_LEN - 1] = '\0';
963 pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
967 snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "0x%x", pinfo->rxid);
968 pinfo->cinfo->col_buf[i][COL_MAX_LEN - 1] = '\0';
969 pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
972 case COL_IF_DIR: /* currently done by dissectors */
976 col_set_circuit_id(pinfo, i);
980 snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "0x%x", pinfo->src_idx);
981 pinfo->cinfo->col_buf[i][COL_MAX_LEN - 1] = '\0';
982 pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
986 snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "0x%x", pinfo->dst_idx);
987 pinfo->cinfo->col_buf[i][COL_MAX_LEN - 1] = '\0';
988 pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
992 snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "%u", pinfo->vsan);
993 pinfo->cinfo->col_buf[i][COL_MAX_LEN - 1] = '\0';
994 pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
997 case NUM_COL_FMTS: /* keep compiler happy - shouldn't get here */
998 g_assert_not_reached();