nexmon – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | /* packet_list_utils.c |
2 | * Packet list display utilities |
||
3 | * Copied from gtk/packet_list.c |
||
4 | * |
||
5 | * Wireshark - Network traffic analyzer |
||
6 | * By Gerald Combs <gerald@wireshark.org> |
||
7 | * Copyright 1998 Gerald Combs |
||
8 | * |
||
9 | * This program is free software; you can redistribute it and/or |
||
10 | * modify it under the terms of the GNU General Public License |
||
11 | * as published by the Free Software Foundation; either version 2 |
||
12 | * of the License, or (at your option) any later version. |
||
13 | * |
||
14 | * This program is distributed in the hope that it will be useful, |
||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
17 | * GNU General Public License for more details. |
||
18 | * |
||
19 | * You should have received a copy of the GNU General Public License |
||
20 | * along with this program; if not, write to the Free Software |
||
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
||
22 | * USA. |
||
23 | */ |
||
24 | |||
25 | #include "config.h" |
||
26 | |||
27 | |||
28 | #include "packet_list_utils.h" |
||
29 | |||
30 | #include <epan/column.h> |
||
31 | |||
32 | gboolean |
||
33 | right_justify_column (gint col, capture_file *cf) |
||
34 | { |
||
35 | header_field_info *hfi; |
||
36 | gboolean right_justify = FALSE; |
||
37 | |||
38 | if (!cf) return FALSE; |
||
39 | |||
40 | switch (cf->cinfo.columns[col].col_fmt) { |
||
41 | |||
42 | case COL_NUMBER: |
||
43 | case COL_PACKET_LENGTH: |
||
44 | case COL_CUMULATIVE_BYTES: |
||
45 | case COL_DCE_CALL: |
||
46 | case COL_DSCP_VALUE: |
||
47 | case COL_UNRES_DST_PORT: |
||
48 | case COL_UNRES_SRC_PORT: |
||
49 | case COL_DEF_DST_PORT: |
||
50 | case COL_DEF_SRC_PORT: |
||
51 | case COL_DELTA_TIME: |
||
52 | case COL_DELTA_TIME_DIS: |
||
53 | right_justify = TRUE; |
||
54 | break; |
||
55 | |||
56 | case COL_CUSTOM: |
||
57 | hfi = proto_registrar_get_byname(cf->cinfo.columns[col].col_custom_fields); |
||
58 | /* Check if this is a valid field and we have no strings lookup table */ |
||
59 | if ((hfi != NULL) && ((hfi->strings == NULL) || !get_column_resolved(col))) { |
||
60 | /* Check for bool, framenum and decimal/octal integer types */ |
||
61 | if ((hfi->type == FT_BOOLEAN) || (hfi->type == FT_FRAMENUM) || |
||
62 | (((hfi->display == BASE_DEC) || (hfi->display == BASE_OCT)) && |
||
63 | (IS_FT_INT(hfi->type) || IS_FT_UINT(hfi->type)))) { |
||
64 | right_justify = TRUE; |
||
65 | } |
||
66 | } |
||
67 | break; |
||
68 | |||
69 | default: |
||
70 | break; |
||
71 | } |
||
72 | |||
73 | return right_justify; |
||
74 | } |
||
75 | |||
76 | gboolean |
||
77 | resolve_column (gint col, capture_file *cf) |
||
78 | { |
||
79 | header_field_info *hfi; |
||
80 | gboolean resolve = FALSE; |
||
81 | guint num_fields, *field_idx, ii; |
||
82 | |||
83 | if (!cf) return FALSE; |
||
84 | |||
85 | switch (cf->cinfo.columns[col].col_fmt) { |
||
86 | |||
87 | case COL_CUSTOM: |
||
88 | num_fields = g_slist_length(cf->cinfo.columns[col].col_custom_fields_ids); |
||
89 | for (ii = 0; ii < num_fields; ii++) { |
||
90 | field_idx = (guint *) g_slist_nth_data(cf->cinfo.columns[col].col_custom_fields_ids, ii); |
||
91 | hfi = proto_registrar_get_nth(*field_idx); |
||
92 | |||
93 | /* Check if we have an OID or a strings table with integer values */ |
||
94 | if ((hfi->type == FT_OID) || (hfi->type == FT_REL_OID) || |
||
95 | ((hfi->strings != NULL) && |
||
96 | ((hfi->type == FT_BOOLEAN) || (hfi->type == FT_FRAMENUM) || |
||
97 | IS_FT_INT(hfi->type) || IS_FT_UINT(hfi->type)))) |
||
98 | { |
||
99 | resolve = TRUE; |
||
100 | break; |
||
101 | } |
||
102 | } |
||
103 | break; |
||
104 | |||
105 | default: |
||
106 | break; |
||
107 | } |
||
108 | |||
109 | return resolve; |
||
110 | } |
||
111 | |||
112 | /* |
||
113 | * Editor modelines |
||
114 | * |
||
115 | * Local Variables: |
||
116 | * c-basic-offset: 4 |
||
117 | * tab-width: 8 |
||
118 | * indent-tabs-mode: nil |
||
119 | * End: |
||
120 | * |
||
121 | * ex: set shiftwidth=4 tabstop=8 expandtab: |
||
122 | * :indentSize=4:tabSize=8:noTabs=true: |
||
123 | */ |