2 * Routines for handling column preferences
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * SPDX-License-Identifier: GPL-2.0-or-later
21 #include <epan/timestamp.h>
22 #include <epan/prefs.h>
23 #include <epan/dfilter/dfilter.h>
24 #include <epan/column.h>
25 #include <epan/packet.h>
26 #include <wsutil/ws_printf.h> /* ws_debug_printf */
28 /* Given a format number (as defined in column-utils.h), returns its equivalent
31 col_format_to_string(const gint fmt) {
32 static const gchar *const slist[NUM_COL_FMTS] = {
33 "%q", /* 0) COL_8021Q_VLAN_ID */
34 "%Yt", /* 1) COL_ABS_YMD_TIME */
35 "%YDOYt", /* 2) COL_ABS_YDOY_TIME */
36 "%At", /* 3) COL_ABS_TIME */
37 "%V", /* 4) COL_VSAN - !! DEPRECATED !!*/
38 "%B", /* 5) COL_CUMULATIVE_BYTES */
39 "%Cus", /* 6) COL_CUSTOM */
40 "%y", /* 7) COL_DCE_CALL */
41 "%Tt", /* 8) COL_DELTA_TIME */
42 "%Gt", /* 9) COL_DELTA_TIME_DIS */
43 "%rd", /* 10) COL_RES_DST */
44 "%ud", /* 11) COL_UNRES_DST */
45 "%rD", /* 12) COL_RES_DST_PORT */
46 "%uD", /* 13) COL_UNRES_DST_PORT */
47 "%d", /* 14) COL_DEF_DST */
48 "%D", /* 15) COL_DEF_DST_PORT */
49 "%a", /* 16) COL_EXPERT */
50 "%I", /* 17) COL_IF_DIR */
51 "%F", /* 18) COL_FREQ_CHAN */
52 "%hd", /* 19) COL_DEF_DL_DST */
53 "%hs", /* 20) COL_DEF_DL_SRC */
54 "%rhd", /* 21) COL_RES_DL_DST */
55 "%uhd", /* 22) COL_UNRES_DL_DST */
56 "%rhs", /* 23) COL_RES_DL_SRC*/
57 "%uhs", /* 24) COL_UNRES_DL_SRC */
58 "%e", /* 25) COL_RSSI */
59 "%x", /* 26) COL_TX_RATE */
60 "%f", /* 27) COL_DSCP_VALUE */
61 "%i", /* 28) COL_INFO */
62 "%rnd", /* 29) COL_RES_NET_DST */
63 "%und", /* 30) COL_UNRES_NET_DST */
64 "%rns", /* 31) COL_RES_NET_SRC */
65 "%uns", /* 32) COL_UNRES_NET_SRC */
66 "%nd", /* 33) COL_DEF_NET_DST */
67 "%ns", /* 34) COL_DEF_NET_SRC */
68 "%m", /* 35) COL_NUMBER */
69 "%L", /* 36) COL_PACKET_LENGTH */
70 "%p", /* 37) COL_PROTOCOL */
71 "%Rt", /* 38) COL_REL_TIME */
72 "%s", /* 39) COL_DEF_SRC */
73 "%S", /* 40) COL_DEF_SRC_PORT */
74 "%rs", /* 41) COL_RES_SRC */
75 "%us", /* 42) COL_UNRES_SRC */
76 "%rS", /* 43) COL_RES_SRC_PORT */
77 "%uS", /* 44) COL_UNRES_SRC_PORT */
78 "%E", /* 45) COL_TEI */
79 "%Yut", /* 46) COL_UTC_YMD_TIME */
80 "%YDOYut", /* 47) COL_UTC_YDOY_TIME */
81 "%Aut", /* 48) COL_UTC_TIME */
82 "%t" /* 49) COL_CLS_TIME */
85 /* The following formats have been used in deprecated columns. Noted here
86 * so they aren't reused
89 * "%c", COL_CIRCUIT_ID
90 * "%l", COL_BSSGP_TLLI
91 * "%H", COL_HPUX_SUBSYS
92 * "%P", COL_HPUX_DEVID
94 * "%rct", COL_REL_CONV_TIME
95 * "%dct", COL_DELTA_CONV_TIME
102 if (fmt < 0 || fmt >= NUM_COL_FMTS)
108 /* Given a format number (as defined in column-utils.h), returns its
111 col_format_desc(const gint fmt) {
112 static const gchar *const dlist[NUM_COL_FMTS] = {
113 "802.1Q VLAN id", /* 0) COL_8021Q_VLAN_ID */
114 "Absolute date, as YYYY-MM-DD, and time", /* 1) COL_ABS_YMD_TIME */
115 "Absolute date, as YYYY/DOY, and time", /* 2) COL_ABS_YDOY_TIME */
116 "Absolute time", /* 3) COL_ABS_TIME */
117 "Cisco VSAN", /* 4) COL_VSAN */
118 "Cumulative Bytes" , /* 5) COL_CUMULATIVE_BYTES */
119 "Custom", /* 6) COL_CUSTOM */
120 "DCE/RPC call (cn_call_id / dg_seqnum)", /* 7) COL_DCE_CALL */
121 "Delta time", /* 8) COL_DELTA_TIME */
122 "Delta time displayed", /* 9) COL_DELTA_TIME_DIS */
123 "Dest addr (resolved)", /* 10) COL_RES_DST */
124 "Dest addr (unresolved)", /* 11) COL_UNRES_DST */
125 "Dest port (resolved)", /* 12) COL_RES_DST_PORT */
126 "Dest port (unresolved)", /* 13) COL_UNRES_DST_PORT */
127 "Destination address", /* 14) COL_DEF_DST */
128 "Destination port", /* 15) COL_DEF_DST_PORT */
129 "Expert Info Severity", /* 16) COL_EXPERT */
130 "FW-1 monitor if/direction", /* 17) COL_IF_DIR */
131 "Frequency/Channel", /* 18) COL_FREQ_CHAN */
132 "Hardware dest addr", /* 19) COL_DEF_DL_DST */
133 "Hardware src addr", /* 20) COL_DEF_DL_SRC */
134 "Hw dest addr (resolved)", /* 21) COL_RES_DL_DST */
135 "Hw dest addr (unresolved)", /* 22) COL_UNRES_DL_DST */
136 "Hw src addr (resolved)", /* 23) COL_RES_DL_SRC*/
137 "Hw src addr (unresolved)", /* 24) COL_UNRES_DL_SRC */
138 "IEEE 802.11 RSSI", /* 25) COL_RSSI */
139 "IEEE 802.11 TX rate", /* 26) COL_TX_RATE */
140 "IP DSCP Value", /* 27) COL_DSCP_VALUE */
141 "Information", /* 28) COL_INFO */
142 "Net dest addr (resolved)", /* 29) COL_RES_NET_DST */
143 "Net dest addr (unresolved)", /* 30) COL_UNRES_NET_DST */
144 "Net src addr (resolved)", /* 31) COL_RES_NET_SRC */
145 "Net src addr (unresolved)", /* 32) COL_UNRES_NET_SRC */
146 "Network dest addr", /* 33) COL_DEF_NET_DST */
147 "Network src addr", /* 34) COL_DEF_NET_SRC */
148 "Number", /* 35) COL_NUMBER */
149 "Packet length (bytes)" , /* 36) COL_PACKET_LENGTH */
150 "Protocol", /* 37) COL_PROTOCOL */
151 "Relative time", /* 38) COL_REL_TIME */
152 "Source address", /* 39) COL_DEF_SRC */
153 "Source port", /* 40) COL_DEF_SRC_PORT */
154 "Src addr (resolved)", /* 41) COL_RES_SRC */
155 "Src addr (unresolved)", /* 42) COL_UNRES_SRC */
156 "Src port (resolved)", /* 43) COL_RES_SRC_PORT */
157 "Src port (unresolved)", /* 44) COL_UNRES_SRC_PORT */
158 "TEI", /* 45) COL_TEI */
159 "UTC date, as YYYY-MM-DD, and time", /* 46) COL_UTC_YMD_TIME */
160 "UTC date, as YYYY/DOY, and time", /* 47) COL_UTC_YDOY_TIME */
161 "UTC time", /* 48) COL_UTC_TIME */
162 "Time (format as specified)" /* 49) COL_CLS_TIME */
165 g_assert((fmt >= 0) && (fmt < NUM_COL_FMTS));
170 column_dump_column_formats(void)
174 for (fmt = 0; fmt < NUM_COL_FMTS; fmt++) {
175 ws_debug_printf("%s\t%s\n", col_format_to_string(fmt), col_format_desc(fmt));
178 ws_debug_printf("\nFor example, to print Wireshark's default columns with tshark:\n\n"
180 "tshark.exe -o \"gui.column.format:"
181 "\\\"No.\\\",\\\"%%m\\\","
182 "\\\"Time\\\",\\\"%%t\\\","
183 "\\\"Source\\\",\\\"%%s\\\","
184 "\\\"Destination\\\",\\\"%%d\\\","
185 "\\\"Protocol\\\",\\\"%%p\\\","
186 "\\\"Length\\\",\\\"%%L\\\","
187 "\\\"Info\\\",\\\"%%i\\\"\"\n");
189 "tshark -o 'gui.column.format:"
192 "\"Source\",\"%%s\","
193 "\"Destination\",\"%%d\","
194 "\"Protocol\",\"%%p\","
195 "\"Length\",\"%%L\","
196 "\"Info\",\"%%i\"'\n");
200 /* Marks each array element true if it can be substituted for the given
203 get_column_format_matches(gboolean *fmt_list, const gint format) {
205 /* Get the obvious: the format itself */
206 if ((format >= 0) && (format < NUM_COL_FMTS))
207 fmt_list[format] = TRUE;
209 /* Get any formats lower down on the chain */
212 fmt_list[COL_RES_DL_SRC] = TRUE;
213 fmt_list[COL_RES_NET_SRC] = TRUE;
216 fmt_list[COL_RES_DL_SRC] = TRUE;
217 fmt_list[COL_RES_NET_SRC] = TRUE;
220 fmt_list[COL_UNRES_DL_SRC] = TRUE;
221 fmt_list[COL_UNRES_NET_SRC] = TRUE;
224 fmt_list[COL_RES_DL_DST] = TRUE;
225 fmt_list[COL_RES_NET_DST] = TRUE;
228 fmt_list[COL_RES_DL_DST] = TRUE;
229 fmt_list[COL_RES_NET_DST] = TRUE;
232 fmt_list[COL_UNRES_DL_DST] = TRUE;
233 fmt_list[COL_UNRES_NET_DST] = TRUE;
236 fmt_list[COL_RES_DL_SRC] = TRUE;
239 fmt_list[COL_RES_DL_DST] = TRUE;
241 case COL_DEF_NET_SRC:
242 fmt_list[COL_RES_NET_SRC] = TRUE;
244 case COL_DEF_NET_DST:
245 fmt_list[COL_RES_NET_DST] = TRUE;
247 case COL_DEF_SRC_PORT:
248 fmt_list[COL_RES_SRC_PORT] = TRUE;
250 case COL_DEF_DST_PORT:
251 fmt_list[COL_RES_DST_PORT] = TRUE;
258 /* Returns a string representing the longest possible value for
259 a timestamp column type. */
261 get_timestamp_column_longest_string(const gint type, const gint precision)
265 case(TS_ABSOLUTE_WITH_YMD):
266 case(TS_UTC_WITH_YMD):
268 case(TS_PREC_FIXED_SEC):
269 return "0000-00-00 00:00:00";
271 case(TS_PREC_FIXED_DSEC):
272 return "0000-00-00 00:00:00.0";
274 case(TS_PREC_FIXED_CSEC):
275 return "0000-00-00 00:00:00.00";
277 case(TS_PREC_FIXED_MSEC):
278 return "0000-00-00 00:00:00.000";
280 case(TS_PREC_FIXED_USEC):
281 return "0000-00-00 00:00:00.000000";
283 case(TS_PREC_FIXED_NSEC):
284 case(TS_PREC_AUTO): /* Leave enough room for the maximum */
285 return "0000-00-00 00:00:00.000000000";
288 g_assert_not_reached();
291 case(TS_ABSOLUTE_WITH_YDOY):
292 case(TS_UTC_WITH_YDOY):
294 case(TS_PREC_FIXED_SEC):
295 return "0000/000 00:00:00";
297 case(TS_PREC_FIXED_DSEC):
298 return "0000/000 00:00:00.0";
300 case(TS_PREC_FIXED_CSEC):
301 return "0000/000 00:00:00.00";
303 case(TS_PREC_FIXED_MSEC):
304 return "0000/000 00:00:00.000";
306 case(TS_PREC_FIXED_USEC):
307 return "0000/000 00:00:00.000000";
309 case(TS_PREC_FIXED_NSEC):
310 case(TS_PREC_AUTO): /* Leave enough room for the maximum */
311 return "0000/000 00:00:00.000000000";
314 g_assert_not_reached();
320 case(TS_PREC_FIXED_SEC):
323 case(TS_PREC_FIXED_DSEC):
326 case(TS_PREC_FIXED_CSEC):
327 return "00:00:00.00";
329 case(TS_PREC_FIXED_MSEC):
330 return "00:00:00.000";
332 case(TS_PREC_FIXED_USEC):
333 return "00:00:00.000000";
335 case(TS_PREC_FIXED_NSEC):
336 case(TS_PREC_AUTO): /* Leave enough room for the maximum */
337 return "00:00:00.000000000";
340 g_assert_not_reached();
343 case(TS_RELATIVE): /* fallthrough */
347 case(TS_PREC_FIXED_SEC):
350 case(TS_PREC_FIXED_DSEC):
353 case(TS_PREC_FIXED_CSEC):
356 case(TS_PREC_FIXED_MSEC):
359 case(TS_PREC_FIXED_USEC):
360 return "0000.000000";
362 case(TS_PREC_FIXED_NSEC):
363 case(TS_PREC_AUTO): /* Leave enough room for the maximum */
364 return "0000.000000000";
367 g_assert_not_reached();
371 /* This is enough to represent 2^63 (signed 64-bit integer) + fractions */
373 case(TS_PREC_FIXED_SEC):
374 return "0000000000000000000";
376 case(TS_PREC_FIXED_DSEC):
377 return "0000000000000000000.0";
379 case(TS_PREC_FIXED_CSEC):
380 return "0000000000000000000.00";
382 case(TS_PREC_FIXED_MSEC):
383 return "0000000000000000000.000";
385 case(TS_PREC_FIXED_USEC):
386 return "0000000000000000000.000000";
388 case(TS_PREC_FIXED_NSEC):
389 case(TS_PREC_AUTO): /* Leave enough room for the maximum */
390 return "0000000000000000000.000000000";
393 g_assert_not_reached();
397 return "0000.000000";
400 g_assert_not_reached();
403 /* never reached, satisfy compiler */
407 /* Returns a string representing the longest possible value for a
408 particular column type. See also get_column_width_string() above.
410 Except for the COL...SRC and COL...DST columns, these are used
411 only when a capture is being displayed while it's taking place;
412 they are arguably somewhat fragile, as changes to the code that
413 generates them don't cause these widths to change, but that's
414 probably not too big a problem, given that the sizes are
415 recomputed based on the actual data in the columns when the capture
416 is done, and given that the width for COL...SRC and COL...DST columns
417 is somewhat arbitrary in any case. We should probably clean
418 that up eventually, though. */
420 get_column_longest_string(const gint format)
427 return get_timestamp_column_longest_string(timestamp_get_type(), timestamp_get_precision());
429 case COL_ABS_YMD_TIME:
430 return get_timestamp_column_longest_string(TS_ABSOLUTE_WITH_YMD, timestamp_get_precision());
432 case COL_ABS_YDOY_TIME:
433 return get_timestamp_column_longest_string(TS_ABSOLUTE_WITH_YDOY, timestamp_get_precision());
435 case COL_UTC_YMD_TIME:
436 return get_timestamp_column_longest_string(TS_UTC_WITH_YMD, timestamp_get_precision());
438 case COL_UTC_YDOY_TIME:
439 return get_timestamp_column_longest_string(TS_UTC_WITH_YDOY, timestamp_get_precision());
442 return get_timestamp_column_longest_string(TS_ABSOLUTE, timestamp_get_precision());
445 return get_timestamp_column_longest_string(TS_UTC, timestamp_get_precision());
448 return get_timestamp_column_longest_string(TS_RELATIVE, timestamp_get_precision());
451 return get_timestamp_column_longest_string(TS_DELTA, timestamp_get_precision());
453 case COL_DELTA_TIME_DIS:
454 return get_timestamp_column_longest_string(TS_DELTA_DIS, timestamp_get_precision());
461 case COL_UNRES_DL_SRC:
462 case COL_DEF_NET_SRC:
463 case COL_RES_NET_SRC:
464 case COL_UNRES_NET_SRC:
470 case COL_UNRES_DL_DST:
471 case COL_DEF_NET_DST:
472 case COL_RES_NET_DST:
473 case COL_UNRES_NET_DST:
474 return "00000000.000000000000"; /* IPX-style */
476 case COL_DEF_SRC_PORT:
477 case COL_RES_SRC_PORT:
478 case COL_UNRES_SRC_PORT:
479 case COL_DEF_DST_PORT:
480 case COL_RES_DST_PORT:
481 case COL_UNRES_DST_PORT:
485 return "Protocol"; /* not the longest, but the longest is too long */
487 case COL_PACKET_LENGTH:
490 case COL_CUMULATIVE_BYTES:
494 return "i 00000000 I";
508 case COL_8021Q_VLAN_ID:
512 return "AAA BBB"; /* not the longest, but the longest is too long */
521 return "9999 MHz [A 999]";
524 return "0000000000"; /* not the longest, but the longest is too long */
526 default: /* COL_INFO */
527 return "Source port: kerberos-master Destination port: kerberos-master";
532 /* Returns the longer string of the column title or the hard-coded width of
533 * its contents for building the packet list layout. */
535 get_column_width_string(const gint format, const gint col)
537 if(strlen(get_column_longest_string(format)) >
538 strlen(get_column_title(col)))
539 return get_column_longest_string(format);
541 return get_column_title(col);
544 /* Returns the longest possible width, in characters, for a particular
547 get_column_char_width(const gint format)
549 return (gint)strlen(get_column_longest_string(format));
553 get_column_format(const gint col)
555 GList *clp = g_list_nth(prefs.col_list, col);
558 if (!clp) /* Invalid column requested */
561 cfmt = (fmt_data *) clp->data;
567 set_column_format(const gint col, const gint fmt)
569 GList *clp = g_list_nth(prefs.col_list, col);
572 if (!clp) /* Invalid column requested */
575 cfmt = (fmt_data *) clp->data;
581 get_column_format_from_str(const gchar *str)
585 for (i = 0; i < NUM_COL_FMTS; i++) {
586 if (strcmp(str, col_format_to_string(i)) == 0)
589 return -1; /* illegal */
593 get_column_title(const gint col)
595 GList *clp = g_list_nth(prefs.col_list, col);
598 if (!clp) /* Invalid column requested */
601 cfmt = (fmt_data *) clp->data;
607 set_column_title(const gint col, const gchar *title)
609 GList *clp = g_list_nth(prefs.col_list, col);
612 if (!clp) /* Invalid column requested */
615 cfmt = (fmt_data *) clp->data;
617 g_free (cfmt->title);
618 cfmt->title = g_strdup (title);
622 get_column_visible(const gint col)
624 GList *clp = g_list_nth(prefs.col_list, col);
627 if (!clp) /* Invalid column requested */
630 cfmt = (fmt_data *) clp->data;
632 return(cfmt->visible);
636 set_column_visible(const gint col, gboolean visible)
638 GList *clp = g_list_nth(prefs.col_list, col);
641 if (!clp) /* Invalid column requested */
644 cfmt = (fmt_data *) clp->data;
646 cfmt->visible = visible;
650 get_column_resolved(const gint col)
652 GList *clp = g_list_nth(prefs.col_list, col);
655 if (!clp) /* Invalid column requested */
658 cfmt = (fmt_data *) clp->data;
660 return(cfmt->resolved);
664 set_column_resolved(const gint col, gboolean resolved)
666 GList *clp = g_list_nth(prefs.col_list, col);
669 if (!clp) /* Invalid column requested */
672 cfmt = (fmt_data *) clp->data;
674 cfmt->resolved = resolved;
678 get_column_custom_fields(const gint col)
680 GList *clp = g_list_nth(prefs.col_list, col);
683 if (!clp) /* Invalid column requested */
686 cfmt = (fmt_data *) clp->data;
688 return(cfmt->custom_fields);
692 set_column_custom_fields(const gint col, const char *custom_fields)
694 GList *clp = g_list_nth(prefs.col_list, col);
697 if (!clp) /* Invalid column requested */
700 cfmt = (fmt_data *) clp->data;
702 g_free (cfmt->custom_fields);
703 cfmt->custom_fields = g_strdup (custom_fields);
707 get_column_custom_occurrence(const gint col)
709 GList *clp = g_list_nth(prefs.col_list, col);
712 if (!clp) /* Invalid column requested */
715 cfmt = (fmt_data *) clp->data;
717 return(cfmt->custom_occurrence);
721 set_column_custom_occurrence(const gint col, const gint custom_occurrence)
723 GList *clp = g_list_nth(prefs.col_list, col);
726 if (!clp) /* Invalid column requested */
729 cfmt = (fmt_data *) clp->data;
731 cfmt->custom_occurrence = custom_occurrence;
735 get_custom_field_tooltip (gchar *custom_field, gint occurrence)
737 header_field_info *hfi = proto_registrar_get_byname(custom_field);
739 /* Not a valid field */
740 return g_strdup_printf("Unknown Field: %s", custom_field);
743 if (hfi->parent == -1) {
745 return g_strdup_printf("%s (%s)", hfi->name, hfi->abbrev);
748 if (occurrence == 0) {
749 /* All occurrences */
750 return g_strdup_printf("%s\n%s (%s)", proto_get_protocol_name(hfi->parent), hfi->name, hfi->abbrev);
753 /* One given occurrence */
754 return g_strdup_printf("%s\n%s (%s#%d)", proto_get_protocol_name(hfi->parent), hfi->name, hfi->abbrev, occurrence);
758 get_column_tooltip(const gint col)
760 GList *clp = g_list_nth(prefs.col_list, col);
763 gboolean first = TRUE;
764 GString *column_tooltip;
767 if (!clp) /* Invalid column requested */
770 cfmt = (fmt_data *) clp->data;
772 if (cfmt->fmt != COL_CUSTOM) {
773 /* Use format description */
774 return g_strdup(col_format_desc(cfmt->fmt));
777 fields = g_regex_split_simple(COL_CUSTOM_PRIME_REGEX, cfmt->custom_fields,
778 G_REGEX_ANCHORED, G_REGEX_MATCH_ANCHORED);
779 column_tooltip = g_string_new("");
781 for (i = 0; i < g_strv_length(fields); i++) {
782 if (fields[i] && *fields[i]) {
783 gchar *field_tooltip = get_custom_field_tooltip(fields[i], cfmt->custom_occurrence);
785 g_string_append(column_tooltip, "\n\nOR\n\n");
787 g_string_append(column_tooltip, field_tooltip);
788 g_free (field_tooltip);
795 return g_string_free (column_tooltip, FALSE);
799 col_finalize(column_info *cinfo)
802 col_item_t* col_item;
804 for (i = 0; i < cinfo->num_cols; i++) {
805 col_item = &cinfo->columns[i];
807 if (col_item->col_fmt == COL_CUSTOM) {
808 if(!dfilter_compile(col_item->col_custom_fields, &col_item->col_custom_dfilter, NULL)) {
809 /* XXX: Should we issue a warning? */
810 g_free(col_item->col_custom_fields);
811 col_item->col_custom_fields = NULL;
812 col_item->col_custom_occurrence = 0;
813 col_item->col_custom_dfilter = NULL;
815 if (col_item->col_custom_fields) {
816 gchar **fields = g_regex_split(cinfo->prime_regex, col_item->col_custom_fields,
817 G_REGEX_MATCH_ANCHORED);
820 for (i_field = 0; i_field < g_strv_length(fields); i_field++) {
821 if (fields[i_field] && *fields[i_field]) {
822 header_field_info *hfinfo = proto_registrar_get_byname(fields[i_field]);
824 int *idx = g_new(int, 1);
826 col_item->col_custom_fields_ids = g_slist_append(col_item->col_custom_fields_ids, idx);
833 col_item->col_custom_fields = NULL;
834 col_item->col_custom_occurrence = 0;
835 col_item->col_custom_dfilter = NULL;
838 col_item->fmt_matx = (gboolean *) g_malloc0(sizeof(gboolean) * NUM_COL_FMTS);
839 get_column_format_matches(col_item->fmt_matx, col_item->col_fmt);
840 col_item->col_data = NULL;
842 if (col_item->col_fmt == COL_INFO)
843 col_item->col_buf = (gchar *) g_malloc(sizeof(gchar) * COL_MAX_INFO_LEN);
845 col_item->col_buf = (gchar *) g_malloc(sizeof(gchar) * COL_MAX_LEN);
847 cinfo->col_expr.col_expr[i] = "";
848 cinfo->col_expr.col_expr_val[i] = (gchar *) g_malloc(sizeof(gchar) * COL_MAX_LEN);
851 cinfo->col_expr.col_expr[i] = NULL;
852 cinfo->col_expr.col_expr_val[i] = NULL;
854 for (i = 0; i < cinfo->num_cols; i++) {
857 for (j = 0; j < NUM_COL_FMTS; j++) {
858 if (!cinfo->columns[i].fmt_matx[j])
861 if (cinfo->col_first[j] == -1)
862 cinfo->col_first[j] = i;
864 cinfo->col_last[j] = i;
870 build_column_format_array(column_info *cinfo, const gint num_cols, const gboolean reset_fences)
873 col_item_t* col_item;
875 /* Build the column format array */
876 col_setup(cinfo, num_cols);
878 for (i = 0; i < cinfo->num_cols; i++) {
879 col_item = &cinfo->columns[i];
880 col_item->col_fmt = get_column_format(i);
881 col_item->col_title = g_strdup(get_column_title(i));
882 if (col_item->col_fmt == COL_CUSTOM) {
883 col_item->col_custom_fields = g_strdup(get_column_custom_fields(i));
884 col_item->col_custom_occurrence = get_column_custom_occurrence(i);
888 col_item->col_fence = 0;
895 * Editor modelines - http://www.wireshark.org/tools/modelines.html
900 * indent-tabs-mode: nil
903 * vi: set shiftwidth=2 tabstop=8 expandtab:
904 * :indentSize=2:tabSize=8:noTabs=true: