Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
column-utils.h
1 /* column-utils.h
2  * Definitions for column utility structures and routines
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * SPDX-License-Identifier: GPL-2.0-or-later
9  */
10 
11 #ifndef __COLUMN_UTILS_H__
12 #define __COLUMN_UTILS_H__
13 
14 #include <glib.h>
15 
16 #include "packet_info.h"
17 #include "ws_symbol_export.h"
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif /* __cplusplus */
22 
23 struct epan_dissect;
24 
29 struct epan_column_info;
30 typedef struct epan_column_info column_info;
31 
41 enum {
42  COL_8021Q_VLAN_ID,
43  COL_ABS_YMD_TIME,
44  COL_ABS_YDOY_TIME,
45  COL_ABS_TIME,
46  COL_VSAN,
47  COL_CUMULATIVE_BYTES,
48  COL_CUSTOM,
49  COL_DCE_CALL,
50  COL_DELTA_TIME,
51  COL_DELTA_TIME_DIS,
52  COL_RES_DST,
53  COL_UNRES_DST,
54  COL_RES_DST_PORT,
55  COL_UNRES_DST_PORT,
56  COL_DEF_DST,
57  COL_DEF_DST_PORT,
58  COL_EXPERT,
59  COL_IF_DIR,
60  COL_FREQ_CHAN,
61  COL_DEF_DL_DST,
62  COL_DEF_DL_SRC,
63  COL_RES_DL_DST,
64  COL_UNRES_DL_DST,
65  COL_RES_DL_SRC,
66  COL_UNRES_DL_SRC,
67  COL_RSSI,
68  COL_TX_RATE,
69  COL_DSCP_VALUE,
70  COL_INFO,
71  COL_RES_NET_DST,
72  COL_UNRES_NET_DST,
73  COL_RES_NET_SRC,
74  COL_UNRES_NET_SRC,
75  COL_DEF_NET_DST,
76  COL_DEF_NET_SRC,
77  COL_NUMBER,
78  COL_PACKET_LENGTH,
79  COL_PROTOCOL,
80  COL_REL_TIME,
81  COL_DEF_SRC,
82  COL_DEF_SRC_PORT,
83  COL_RES_SRC,
84  COL_UNRES_SRC,
85  COL_RES_SRC_PORT,
86  COL_UNRES_SRC_PORT,
87  COL_TEI,
88  COL_UTC_YMD_TIME,
89  COL_UTC_YDOY_TIME,
90  COL_UTC_TIME,
91  COL_CLS_TIME,
92  NUM_COL_FMTS
93 };
94 
100 WS_DLL_PUBLIC void col_setup(column_info *cinfo, const gint num_cols);
101 
107 WS_DLL_PUBLIC void col_cleanup(column_info *cinfo);
108 
113 extern void col_init(column_info *cinfo, const struct epan_session *epan);
114 
119 WS_DLL_PUBLIC void col_fill_in_frame_data(const frame_data *fd, column_info *cinfo, const gint col, gboolean const fill_col_exprs);
120 
125 WS_DLL_PUBLIC void col_fill_in(packet_info *pinfo, const gboolean fill_col_exprs, const gboolean fill_fd_colums);
126 
133 WS_DLL_PUBLIC void col_fill_in_error(column_info *cinfo, frame_data *fdata, const gboolean fill_col_exprs, const gboolean fill_fd_colums);
134 
139 WS_DLL_PUBLIC gboolean col_data_changed(void);
140 
141 /* Utility routines used by packet*.c */
142 
149 WS_DLL_PUBLIC gboolean col_get_writable(column_info *cinfo, const gint col);
150 
157 WS_DLL_PUBLIC void col_set_writable(column_info *cinfo, const gint col, const gboolean writable);
158 
168 WS_DLL_PUBLIC void col_set_fence(column_info *cinfo, const gint col);
169 
178 WS_DLL_PUBLIC void col_clear_fence(column_info *cinfo, const gint col);
179 
187 WS_DLL_PUBLIC const gchar *col_get_text(column_info *cinfo, const gint col);
188 
194 WS_DLL_PUBLIC void col_clear(column_info *cinfo, const gint col);
195 
204 WS_DLL_PUBLIC void col_set_str(column_info *cinfo, const gint col, const gchar * str);
205 
212 WS_DLL_PUBLIC void col_add_str(column_info *cinfo, const gint col, const gchar *str);
213 
214 /* terminator argument for col_add_lstr() function */
215 #define COL_ADD_LSTR_TERMINATOR (const char *) -1
216 WS_DLL_PUBLIC void col_add_lstr(column_info *cinfo, const gint el, const gchar *str, ...);
217 
227 WS_DLL_PUBLIC void col_add_fstr(column_info *cinfo, const gint col, const gchar *format, ...)
228  G_GNUC_PRINTF(3, 4);
229 
231 void col_custom_set_edt(struct epan_dissect *edt, column_info *cinfo);
232 
234 WS_DLL_PUBLIC
235 void col_custom_prime_edt(struct epan_dissect *edt, column_info *cinfo);
236 
238 WS_DLL_PUBLIC
239 gboolean have_custom_cols(column_info *cinfo);
240 
242 WS_DLL_PUBLIC
243 gboolean have_field_extractors(void);
244 
246 WS_DLL_PUBLIC
247 gboolean col_has_time_fmt(column_info *cinfo, const gint col);
249 WS_DLL_PUBLIC
250 gboolean col_based_on_frame_data(column_info *cinfo, const gint col);
251 
258 WS_DLL_PUBLIC void col_append_str(column_info *cinfo, const gint col, const gchar *str);
259 
268 WS_DLL_PUBLIC void col_append_str_uint(column_info *cinfo, const gint col, const gchar *abbrev, guint32 val, const gchar *sep);
269 
278 WS_DLL_PUBLIC void col_append_ports(column_info *cinfo, const gint col, port_type typ, guint16 src, guint16 dst);
279 
288 WS_DLL_PUBLIC void col_append_frame_number(packet_info *pinfo, const gint col, const gchar *fmt_str, guint frame_num);
289 
290 /* Append the given strings (terminated by COL_ADD_LSTR_TERMINATOR) to a column element,
291  *
292  * Same result as col_append_str() called for every string element.
293  */
294 WS_DLL_PUBLIC void col_append_lstr(column_info *cinfo, const gint el, const gchar *str, ...);
295 
305 WS_DLL_PUBLIC void col_append_fstr(column_info *cinfo, const gint col, const gchar *format, ...)
306  G_GNUC_PRINTF(3, 4);
307 
315 WS_DLL_PUBLIC void col_prepend_fstr(column_info *cinfo, const gint col, const gchar *format, ...)
316  G_GNUC_PRINTF(3, 4);
317 
326 WS_DLL_PUBLIC void col_prepend_fence_fstr(column_info *cinfo, const gint col, const gchar *format, ...)
327  G_GNUC_PRINTF(3, 4);
328 
338 WS_DLL_PUBLIC void col_append_sep_str(column_info *cinfo, const gint col, const gchar *sep,
339  const gchar *str);
340 
351 WS_DLL_PUBLIC void col_append_sep_fstr(column_info *cinfo, const gint col, const gchar *sep,
352  const gchar *format, ...)
353  G_GNUC_PRINTF(4, 5);
354 
365 WS_DLL_PUBLIC void col_set_time(column_info *cinfo, const int col,
366  const nstime_t *ts, const char *fieldname);
367 
368 WS_DLL_PUBLIC void set_fd_time(const struct epan_session *epan, frame_data *fd, gchar *buf);
369 
370 #ifdef __cplusplus
371 }
372 #endif /* __cplusplus */
373 
374 #endif /* __COLUMN_UTILS_H__ */
gboolean writable
Definition: column-info.h:58
Definition: packet_info.h:44
Definition: column-info.h:51
Definition: nstime.h:27
Definition: frame_data.h:53
Definition: epan_dissect.h:28
gint num_cols
Definition: column-info.h:53
Definition: epan.c:348