2 * Routines for column utilities.
4 * $Id: column-utils.c,v 1.36 2003/08/26 01:30:48 guy Exp $
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"
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)
53 col_info->num_cols = num_cols;
54 col_info->col_fmt = (gint *) g_malloc(sizeof(gint) * num_cols);
55 col_info->fmt_matx = (gboolean **) g_malloc(sizeof(gboolean *) * num_cols);
56 col_info->col_width = (gint *) g_malloc(sizeof(gint) * num_cols);
57 col_info->col_title = (gchar **) g_malloc(sizeof(gchar *) * num_cols);
58 col_info->col_data = (gchar **) g_malloc(sizeof(gchar *) * num_cols);
59 col_info->col_buf = (gchar **) g_malloc(sizeof(gchar *) * num_cols);
60 col_info->col_fence = (int *) g_malloc(sizeof(int) * num_cols);
61 col_info->col_expr = (gchar **) g_malloc(sizeof(gchar *) * num_cols);
62 col_info->col_expr_val = (gchar **) g_malloc(sizeof(gchar *) * num_cols);
65 /* Initialize the data structures for constructing column data. */
67 col_init(column_info *cinfo)
71 for (i = 0; i < cinfo->num_cols; i++) {
72 cinfo->col_buf[i][0] = '\0';
73 cinfo->col_data[i] = cinfo->col_buf[i];
74 cinfo->col_fence[i] = 0;
75 cinfo->col_expr[i][0] = '\0';
76 cinfo->col_expr_val[i][0] = '\0';
78 cinfo->writable = TRUE;
82 col_get_writable(column_info *cinfo)
84 return (cinfo ? cinfo->writable : FALSE);
88 col_set_writable(column_info *cinfo, gboolean writable)
91 cinfo->writable = writable;
94 /* Checks to see if a particular packet information element is needed for
97 check_col(column_info *cinfo, gint el) {
100 if (cinfo && cinfo->writable) {
101 for (i = 0; i < cinfo->num_cols; i++) {
102 if (cinfo->fmt_matx[i][el])
109 /* Sets the fence for a column to be at the end of the column. */
111 col_set_fence(column_info *cinfo, gint el)
115 if (cinfo && cinfo->writable) {
116 for (i = 0; i < cinfo->num_cols; i++) {
117 if (cinfo->fmt_matx[i][el])
118 cinfo->col_fence[i] = strlen(cinfo->col_data[i]);
123 /* Use this to clear out a column, especially if you're going to be
124 appending to it later; at least on some platforms, it's more
125 efficient than using "col_add_str()" with a null string, and
126 more efficient than "col_set_str()" with a null string if you
127 later append to it, as the later append will cause a string
130 col_clear(column_info *cinfo, gint el)
135 for (i = 0; i < cinfo->num_cols; i++) {
136 if (cinfo->fmt_matx[i][el]) {
138 * At this point, either
140 * 1) col_data[i] is equal to col_buf[i], in which case we
141 * don't have to worry about copying col_data[i] to
144 * 2) col_data[i] isn't equal to col_buf[i], in which case
145 * the only thing that's been done to the column is
146 * "col_set_str()" calls and possibly "col_set_fence()"
147 * calls, in which case the fence is either unset and
148 * at the beginning of the string or set and at the end
149 * of the string - if it's at the beginning, we're just
150 * going to clear the column, and if it's at the end,
151 * we don't do anything.
153 fence = cinfo->col_fence[i];
154 if (fence == 0 || cinfo->col_buf[i] == cinfo->col_data[i]) {
156 * The fence isn't at the end of the column, or the column wasn't
157 * last set with "col_set_str()", so clear the column out.
159 cinfo->col_buf[i][fence] = '\0';
160 cinfo->col_data[i] = cinfo->col_buf[i];
162 cinfo->col_expr[i][0] = '\0';
163 cinfo->col_expr_val[i][0] = '\0';
168 #define COL_CHECK_APPEND(cinfo, i, max_len) \
169 if (cinfo->col_data[i] != cinfo->col_buf[i]) { \
170 /* This was set with "col_set_str()"; copy the string they \
171 set it to into the buffer, so we can append to it. */ \
172 strncpy(cinfo->col_buf[i], cinfo->col_data[i], max_len); \
173 cinfo->col_buf[i][max_len - 1] = '\0'; \
174 cinfo->col_data[i] = cinfo->col_buf[i]; \
177 /* Use this if "str" points to something that will stay around (and thus
178 needn't be copied). */
180 col_set_str(column_info *cinfo, gint el, gchar* str)
187 max_len = COL_MAX_INFO_LEN;
189 max_len = COL_MAX_LEN;
191 for (i = 0; i < cinfo->num_cols; i++) {
192 if (cinfo->fmt_matx[i][el]) {
193 fence = cinfo->col_fence[i];
196 * We will append the string after the fence.
197 * First arrange that we can append, if necessary.
199 COL_CHECK_APPEND(cinfo, i, max_len);
201 len = strlen(cinfo->col_buf[i]);
202 strncat(cinfo->col_buf[i], str, max_len - len);
203 cinfo->col_buf[i][max_len - 1] = 0;
206 * There's no fence, so we can just set the column to point
209 cinfo->col_data[i] = str;
215 /* Adds a vararg list to a packet info string. */
217 col_add_fstr(column_info *cinfo, gint el, const gchar *format, ...) {
224 max_len = COL_MAX_INFO_LEN;
226 max_len = COL_MAX_LEN;
228 va_start(ap, format);
229 for (i = 0; i < cinfo->num_cols; i++) {
230 if (cinfo->fmt_matx[i][el]) {
231 fence = cinfo->col_fence[i];
234 * We will append the string after the fence.
235 * First arrange that we can append, if necessary.
237 COL_CHECK_APPEND(cinfo, i, max_len);
240 * There's no fence, so we can just write to the string.
242 cinfo->col_data[i] = cinfo->col_buf[i];
244 vsnprintf(&cinfo->col_buf[i][fence], max_len - fence, format, ap);
250 /* Appends a vararg list to a packet info string. */
252 col_append_fstr(column_info *cinfo, gint el, const gchar *format, ...)
259 max_len = COL_MAX_INFO_LEN;
261 max_len = COL_MAX_LEN;
263 va_start(ap, format);
264 for (i = 0; i < cinfo->num_cols; i++) {
265 if (cinfo->fmt_matx[i][el]) {
267 * First arrange that we can append, if necessary.
269 COL_CHECK_APPEND(cinfo, i, max_len);
270 len = strlen(cinfo->col_buf[i]);
271 vsnprintf(&cinfo->col_buf[i][len], max_len - len, format, ap);
277 /* Prepends a vararg list to a packet info string. */
278 #define COL_BUF_MAX_LEN (((COL_MAX_INFO_LEN) > (COL_MAX_LEN)) ? \
279 (COL_MAX_INFO_LEN) : (COL_MAX_LEN))
281 col_prepend_fstr(column_info *cinfo, gint el, const gchar *format, ...)
285 char orig_buf[COL_BUF_MAX_LEN];
290 max_len = COL_MAX_INFO_LEN;
292 max_len = COL_MAX_LEN;
294 va_start(ap, format);
295 for (i = 0; i < cinfo->num_cols; i++) {
296 if (cinfo->fmt_matx[i][el]) {
297 if (cinfo->col_data[i] != cinfo->col_buf[i]) {
298 /* This was set with "col_set_str()"; which is effectively const */
299 orig = cinfo->col_data[i];
302 strncpy(orig, cinfo->col_buf[i], max_len);
303 orig[max_len - 1] = '\0';
305 vsnprintf(cinfo->col_buf[i], max_len, format, ap);
306 cinfo->col_buf[i][max_len - 1] = '\0';
309 * Move the fence, unless it's at the beginning of the string.
311 if (cinfo->col_fence[i] > 0)
312 cinfo->col_fence[i] += strlen(cinfo->col_buf[i]);
314 strncat(cinfo->col_buf[i], orig, max_len);
315 cinfo->col_buf[i][max_len - 1] = '\0';
316 cinfo->col_data[i] = cinfo->col_buf[i];
322 /* Use this if "str" points to something that won't stay around (and
323 must thus be copied). */
325 col_add_str(column_info *cinfo, gint el, const gchar* str)
332 max_len = COL_MAX_INFO_LEN;
334 max_len = COL_MAX_LEN;
336 for (i = 0; i < cinfo->num_cols; i++) {
337 if (cinfo->fmt_matx[i][el]) {
338 fence = cinfo->col_fence[i];
341 * We will append the string after the fence.
342 * First arrange that we can append, if necessary.
344 COL_CHECK_APPEND(cinfo, i, max_len);
347 * There's no fence, so we can just write to the string.
349 cinfo->col_data[i] = cinfo->col_buf[i];
351 strncpy(&cinfo->col_buf[i][fence], str, max_len - fence);
352 cinfo->col_buf[i][max_len - 1] = 0;
358 col_append_str(column_info *cinfo, gint el, const gchar* str)
364 max_len = COL_MAX_INFO_LEN;
366 max_len = COL_MAX_LEN;
368 for (i = 0; i < cinfo->num_cols; i++) {
369 if (cinfo->fmt_matx[i][el]) {
371 * First arrange that we can append, if necessary.
373 COL_CHECK_APPEND(cinfo, i, max_len);
374 len = strlen(cinfo->col_buf[i]);
375 strncat(cinfo->col_buf[i], str, max_len - len);
376 cinfo->col_buf[i][max_len - 1] = 0;
382 col_set_abs_date_time(frame_data *fd, column_info *cinfo, int col)
388 tmp = localtime(&then);
390 snprintf(cinfo->col_buf[col], COL_MAX_LEN,
391 "%04d-%02d-%02d %02d:%02d:%02d.%06ld",
398 (long)fd->abs_usecs);
400 cinfo->col_buf[col][0] = '\0';
402 cinfo->col_data[col] = cinfo->col_buf[col];
403 strcpy(cinfo->col_expr[col],"frame.time");
404 strcpy(cinfo->col_expr_val[col],cinfo->col_buf[col]);
408 col_set_rel_time(frame_data *fd, column_info *cinfo, int col)
410 display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
411 fd->rel_secs, fd->rel_usecs, USECS);
412 cinfo->col_data[col] = cinfo->col_buf[col];
413 strcpy(cinfo->col_expr[col],"frame.time_relative");
414 strcpy(cinfo->col_expr_val[col],cinfo->col_buf[col]);
418 col_set_delta_time(frame_data *fd, column_info *cinfo, int col)
420 display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
421 fd->del_secs, fd->del_usecs, USECS);
422 cinfo->col_data[col] = cinfo->col_buf[col];
423 strcpy(cinfo->col_expr[col],"frame.time_delta");
424 strcpy(cinfo->col_expr_val[col],cinfo->col_buf[col]);
427 /* To do: Add check_col checks to the col_add* routines */
430 col_set_abs_time(frame_data *fd, column_info *cinfo, int col)
436 tmp = localtime(&then);
438 snprintf(cinfo->col_buf[col], COL_MAX_LEN, "%02d:%02d:%02d.%06ld",
442 (long)fd->abs_usecs);
444 cinfo->col_buf[col][0] = '\0';
446 cinfo->col_data[col] = cinfo->col_buf[col];
447 strcpy(cinfo->col_expr[col],"frame.time");
448 strcpy(cinfo->col_expr_val[col],cinfo->col_buf[col]);
451 /* Add "command-line-specified" time.
452 XXX - this is called from "file.c" when the user changes the time
453 format they want for "command-line-specified" time; it's a bit ugly
454 that we have to export it, but if we go to a CList-like widget that
455 invokes callbacks to get the text for the columns rather than
456 requiring us to stuff the text into the widget from outside, we
457 might be able to clean this up. */
459 col_set_cls_time(frame_data *fd, column_info *cinfo, int col)
461 switch (timestamp_type) {
463 col_set_abs_time(fd, cinfo, col);
466 case ABSOLUTE_WITH_DATE:
467 col_set_abs_date_time(fd, cinfo, col);
471 col_set_rel_time(fd, cinfo, col);
475 col_set_delta_time(fd, cinfo, col);
481 col_set_addr(packet_info *pinfo, int col, address *addr, gboolean is_res,
485 struct e_in6_addr ipv6_addr;
487 pinfo->cinfo->col_expr[col][0] = '\0';
488 pinfo->cinfo->col_expr_val[col][0] = '\0';
490 switch (addr->type) {
493 strncpy(pinfo->cinfo->col_buf[col], get_ether_name(addr->data), COL_MAX_LEN);
494 pinfo->cinfo->col_buf[col][COL_MAX_LEN - 1] = '\0';
495 pinfo->cinfo->col_data[col] = pinfo->cinfo->col_buf[col];
499 memcpy(&ipv4_addr, addr->data, sizeof ipv4_addr);
500 strncpy(pinfo->cinfo->col_buf[col], get_hostname(ipv4_addr), COL_MAX_LEN);
501 pinfo->cinfo->col_buf[col][COL_MAX_LEN - 1] = '\0';
505 memcpy(&ipv6_addr.s6_addr, addr->data, sizeof ipv6_addr.s6_addr);
506 strncpy(pinfo->cinfo->col_buf[col], get_hostname6(&ipv6_addr), COL_MAX_LEN);
507 pinfo->cinfo->col_buf[col][COL_MAX_LEN - 1] = '\0';
511 address_to_str_buf(addr, pinfo->cinfo->col_buf[col]);
515 address_to_str_buf(addr, pinfo->cinfo->col_buf[col]);
516 pinfo->cinfo->col_data[col] = pinfo->cinfo->col_buf[col];
518 switch (addr->type) {
522 strcpy(pinfo->cinfo->col_expr[col], "eth.src");
524 strcpy(pinfo->cinfo->col_expr[col], "eth.dst");
525 strncpy(pinfo->cinfo->col_expr_val[col], ether_to_str(addr->data), COL_MAX_LEN);
526 pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
531 strcpy(pinfo->cinfo->col_expr[col], "ip.src");
533 strcpy(pinfo->cinfo->col_expr[col], "ip.dst");
534 strncpy(pinfo->cinfo->col_expr_val[col], ip_to_str(addr->data), COL_MAX_LEN);
535 pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
540 strcpy(pinfo->cinfo->col_expr[col], "ipv6.src");
542 strcpy(pinfo->cinfo->col_expr[col], "ipv6.dst");
543 strncpy(pinfo->cinfo->col_expr_val[col], ip6_to_str(&ipv6_addr), COL_MAX_LEN);
544 pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
549 strcpy(pinfo->cinfo->col_expr[col], "ddp.src");
551 strcpy(pinfo->cinfo->col_expr[col], "ddp.dst");
552 strcpy(pinfo->cinfo->col_expr_val[col], pinfo->cinfo->col_buf[col]);
557 strcpy(pinfo->cinfo->col_expr[col], "arcnet.src");
559 strcpy(pinfo->cinfo->col_expr[col], "arcnet.dst");
560 strcpy(pinfo->cinfo->col_expr_val[col], pinfo->cinfo->col_buf[col]);
569 col_set_port(packet_info *pinfo, int col, gboolean is_res, gboolean is_src)
574 port = pinfo->srcport;
576 port = pinfo->destport;
577 pinfo->cinfo->col_expr[col][0] = '\0';
578 pinfo->cinfo->col_expr_val[col][0] = '\0';
579 switch (pinfo->ptype) {
583 strncpy(pinfo->cinfo->col_buf[col], get_sctp_port(port), COL_MAX_LEN);
585 snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", port);
590 strncpy(pinfo->cinfo->col_buf[col], get_tcp_port(port), COL_MAX_LEN);
592 snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", port);
594 strcpy(pinfo->cinfo->col_expr[col], "tcp.srcport");
596 strcpy(pinfo->cinfo->col_expr[col], "tcp.dstport");
597 snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "%u", port);
598 pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
603 strncpy(pinfo->cinfo->col_buf[col], get_udp_port(port), COL_MAX_LEN);
605 snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", port);
607 strcpy(pinfo->cinfo->col_expr[col], "udp.srcport");
609 strcpy(pinfo->cinfo->col_expr[col], "udp.dstport");
610 snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "%u", port);
611 pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
616 strcpy(pinfo->cinfo->col_expr[col], "ddp.src_socket");
618 strcpy(pinfo->cinfo->col_expr[col], "ddp.dst_socket");
619 snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", port);
620 snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "%u", port);
621 pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
625 /* XXX - resolve IPX socket numbers */
626 snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "0x%04x", port);
628 strcpy(pinfo->cinfo->col_expr[col], "ipx.src.socket");
630 strcpy(pinfo->cinfo->col_expr[col], "ipx.dst.socket");
631 snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "0x%04x", port);
632 pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
638 pinfo->cinfo->col_buf[col][COL_MAX_LEN - 1] = '\0';
639 pinfo->cinfo->col_data[col] = pinfo->cinfo->col_buf[col];
643 * XXX - this should be in some common code in the epan directory, shared
644 * by this code and packet-isdn.c.
646 static const value_string channel_vals[] = {
682 col_set_circuit_id(packet_info *pinfo, int col)
684 pinfo->cinfo->col_expr[col][0] = '\0';
685 pinfo->cinfo->col_expr_val[col][0] = '\0';
686 switch (pinfo->ctype) {
689 snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
690 strcpy(pinfo->cinfo->col_expr[col], "fr.dlci");
691 snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
692 pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
696 snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%s",
697 val_to_str(pinfo->circuit_id, channel_vals, "Unknown (%u)"));
698 strcpy(pinfo->cinfo->col_expr[col], "isdn.channel");
699 snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
700 pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
704 snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
710 pinfo->cinfo->col_buf[col][COL_MAX_LEN - 1] = '\0';
711 pinfo->cinfo->col_data[col] = pinfo->cinfo->col_buf[col];
715 fill_in_columns(packet_info *pinfo)
719 for (i = 0; i < pinfo->cinfo->num_cols; i++) {
720 switch (pinfo->cinfo->col_fmt[i]) {
723 snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "%u", pinfo->fd->num);
724 pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
725 strcpy(pinfo->cinfo->col_expr[i], "frame.number");
726 strcpy(pinfo->cinfo->col_expr_val[i], pinfo->cinfo->col_buf[i]);
730 col_set_cls_time(pinfo->fd, pinfo->cinfo, i);
734 col_set_abs_time(pinfo->fd, pinfo->cinfo, i);
737 case COL_ABS_DATE_TIME:
738 col_set_abs_date_time(pinfo->fd, pinfo->cinfo, i);
742 col_set_rel_time(pinfo->fd, pinfo->cinfo, i);
746 col_set_delta_time(pinfo->fd, pinfo->cinfo, i);
750 case COL_RES_SRC: /* COL_DEF_SRC is currently just like COL_RES_SRC */
751 col_set_addr(pinfo, i, &pinfo->src, TRUE, TRUE);
755 col_set_addr(pinfo, i, &pinfo->src, FALSE, TRUE);
760 col_set_addr(pinfo, i, &pinfo->dl_src, TRUE, TRUE);
763 case COL_UNRES_DL_SRC:
764 col_set_addr(pinfo, i, &pinfo->dl_src, FALSE, TRUE);
767 case COL_DEF_NET_SRC:
768 case COL_RES_NET_SRC:
769 col_set_addr(pinfo, i, &pinfo->net_src, TRUE, TRUE);
772 case COL_UNRES_NET_SRC:
773 col_set_addr(pinfo, i, &pinfo->net_src, FALSE, TRUE);
777 case COL_RES_DST: /* COL_DEF_DST is currently just like COL_RES_DST */
778 col_set_addr(pinfo, i, &pinfo->dst, TRUE, FALSE);
782 col_set_addr(pinfo, i, &pinfo->dst, FALSE, FALSE);
787 col_set_addr(pinfo, i, &pinfo->dl_dst, TRUE, FALSE);
790 case COL_UNRES_DL_DST:
791 col_set_addr(pinfo, i, &pinfo->dl_dst, FALSE, FALSE);
794 case COL_DEF_NET_DST:
795 case COL_RES_NET_DST:
796 col_set_addr(pinfo, i, &pinfo->net_dst, TRUE, FALSE);
799 case COL_UNRES_NET_DST:
800 col_set_addr(pinfo, i, &pinfo->net_dst, FALSE, FALSE);
803 case COL_DEF_SRC_PORT:
804 case COL_RES_SRC_PORT: /* COL_DEF_SRC_PORT is currently just like COL_RES_SRC_PORT */
805 col_set_port(pinfo, i, TRUE, TRUE);
808 case COL_UNRES_SRC_PORT:
809 col_set_port(pinfo, i, FALSE, TRUE);
812 case COL_DEF_DST_PORT:
813 case COL_RES_DST_PORT: /* COL_DEF_DST_PORT is currently just like COL_RES_DST_PORT */
814 col_set_port(pinfo, i, TRUE, FALSE);
817 case COL_UNRES_DST_PORT:
818 col_set_port(pinfo, i, FALSE, FALSE);
821 case COL_PROTOCOL: /* currently done by dissectors */
822 case COL_INFO: /* currently done by dissectors */
825 case COL_PACKET_LENGTH:
826 snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "%u", pinfo->fd->pkt_len);
827 pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
828 strcpy(pinfo->cinfo->col_expr[i], "frame.pkt_len");
829 strcpy(pinfo->cinfo->col_expr_val[i], pinfo->cinfo->col_buf[i]);
833 snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "0x%x", pinfo->oxid);
834 pinfo->cinfo->col_buf[i][COL_MAX_LEN - 1] = '\0';
835 pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
839 snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "0x%x", pinfo->rxid);
840 pinfo->cinfo->col_buf[i][COL_MAX_LEN - 1] = '\0';
841 pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
844 case COL_IF_DIR: /* currently done by dissectors */
848 col_set_circuit_id(pinfo, i);
852 snprintf (pinfo->cinfo->col_buf[i], COL_MAX_LEN, "0x%x",
854 pinfo->cinfo->col_buf[i][COL_MAX_LEN - 1] = '\0';
855 pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
859 snprintf (pinfo->cinfo->col_buf[i], COL_MAX_LEN, "0x%x",
861 pinfo->cinfo->col_buf[i][COL_MAX_LEN - 1] = '\0';
862 pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
866 snprintf (pinfo->cinfo->col_buf[i], COL_MAX_LEN, "%d", pinfo->vsan);
867 pinfo->cinfo->col_buf[i][COL_MAX_LEN - 1] = '\0';
868 pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
871 case NUM_COL_FMTS: /* keep compiler happy - shouldn't get here */
872 g_assert_not_reached();