2 * Packet list display utilities
3 * Copied from gtk/packet_list.c
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
31 #include "packet_list_utils.h"
33 #include <epan/column.h>
34 #include <epan/proto.h>
37 right_justify_column (gint col
, capture_file
*cf
)
39 header_field_info
*hfi
;
40 gboolean right_justify
= FALSE
;
42 if (!cf
) return FALSE
;
44 switch (cf
->cinfo
.col_fmt
[col
]) {
47 case COL_PACKET_LENGTH
:
48 case COL_CUMULATIVE_BYTES
:
51 case COL_UNRES_DST_PORT
:
52 case COL_UNRES_SRC_PORT
:
53 case COL_DEF_DST_PORT
:
54 case COL_DEF_SRC_PORT
:
56 case COL_DELTA_TIME_DIS
:
61 hfi
= proto_registrar_get_byname(cf
->cinfo
.col_custom_field
[col
]);
62 /* Check if this is a valid field and we have no strings lookup table */
63 if ((hfi
!= NULL
) && ((hfi
->strings
== NULL
) || !get_column_resolved(col
))) {
64 /* Check for bool, framenum and decimal/octal integer types */
65 if ((hfi
->type
== FT_BOOLEAN
) || (hfi
->type
== FT_FRAMENUM
) ||
66 (((hfi
->display
== BASE_DEC
) || (hfi
->display
== BASE_OCT
)) &&
67 (IS_FT_INT(hfi
->type
) || IS_FT_UINT(hfi
->type
)))) {
81 resolve_column (gint col
, capture_file
*cf
)
83 header_field_info
*hfi
;
84 gboolean resolve
= FALSE
;
86 if (!cf
) return FALSE
;
88 switch (cf
->cinfo
.col_fmt
[col
]) {
91 hfi
= proto_registrar_get_byname(cf
->cinfo
.col_custom_field
[col
]);
92 /* Check if this is a valid field */
94 /* Check if we have an OID or a strings table with integer values */
95 if ((hfi
->type
== FT_OID
) || (hfi
->type
== FT_REL_OID
) ||
96 ((hfi
->strings
!= NULL
) &&
97 ((hfi
->type
== FT_BOOLEAN
) || (hfi
->type
== FT_FRAMENUM
) ||
98 IS_FT_INT(hfi
->type
) || IS_FT_UINT(hfi
->type
)))) {
117 * indent-tabs-mode: nil
120 * ex: set shiftwidth=4 tabstop=8 expandtab:
121 * :indentSize=4:tabSize=8:noTabs=true: