HACK: 1. try to match RowsetProperties
[wireshark-wip.git] / ui / packet_list_utils.c
blob542633466347204411b2131537a8ad32201ddcd4
1 /* packet_list_utils.c
2 * Packet list display utilities
3 * Copied from gtk/packet_list.c
5 * $Id$
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,
24 * USA.
27 #include "config.h"
29 #include <glib.h>
31 #include "packet_list_utils.h"
33 #include <epan/column.h>
34 #include <epan/proto.h>
36 gboolean
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]) {
46 case COL_NUMBER:
47 case COL_PACKET_LENGTH:
48 case COL_CUMULATIVE_BYTES:
49 case COL_DCE_CALL:
50 case COL_DSCP_VALUE:
51 case COL_UNRES_DST_PORT:
52 case COL_UNRES_SRC_PORT:
53 case COL_DEF_DST_PORT:
54 case COL_DEF_SRC_PORT:
55 case COL_DELTA_TIME:
56 case COL_DELTA_TIME_DIS:
57 right_justify = TRUE;
58 break;
60 case COL_CUSTOM:
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)))) {
68 right_justify = TRUE;
71 break;
73 default:
74 break;
77 return right_justify;
80 gboolean
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]) {
90 case COL_CUSTOM:
91 hfi = proto_registrar_get_byname(cf->cinfo.col_custom_field[col]);
92 /* Check if this is a valid field */
93 if (hfi != NULL) {
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)))) {
99 resolve = TRUE;
102 break;
104 default:
105 break;
108 return resolve;
112 * Editor modelines
114 * Local Variables:
115 * c-basic-offset: 4
116 * tab-width: 8
117 * indent-tabs-mode: nil
118 * End:
120 * ex: set shiftwidth=4 tabstop=8 expandtab:
121 * :indentSize=4:tabSize=8:noTabs=true: