Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
column-utils.h
Go to the documentation of this file.
1
12#ifndef __COLUMN_UTILS_H__
13#define __COLUMN_UTILS_H__
14
15#include "packet_info.h"
16#include "ws_symbol_export.h"
17
18#ifdef __cplusplus
19extern "C" {
20#endif /* __cplusplus */
21
22#define COL_MAX_LEN 2048
23#define COL_MAX_INFO_LEN 4096
24
25/* A regex to split possibly multifield custom columns into components
26 *
27 * Split on operator "||" (with optional space around it) and on "or"
28 * (which must have space around it to avoid matching in the middle of
29 * a word, field in the "synphasor" protocol, etc. This is somewhat too
30 * strict, as "or" adjacent to parentheses ought to be fine so long
31 * as the filter matches the grammar, like "(tcp.port)or(udp.port)",
32 * but that's the cost of using regex instead of the real parser.)
33 * Also split on space at the beginning or end of the expression (in
34 * lieu of always stripping whitespace at the beginning and end, but it
35 * does mean that we have to ignore any empty tokens in the result.)
36 *
37 * Use negative lookahead to avoid matching "||" or "or" that are contained
38 * within parentheses. Don't match if a close parenthesis comes before an
39 * open parenthesis. The regex doesn't help with unmatched parentheses, but
40 * such an expression already won't satisfy the grammar and won't compile.
41 */
42#define COL_CUSTOM_PRIME_REGEX "(?:^ *| *\\|\\| *| +or +| *$)(?![^(]*\\))"
43
44struct epan_dissect;
45
50struct epan_column_info;
51typedef struct epan_column_info column_info;
52
62enum {
112
119WS_DLL_PUBLIC bool col_get_writable(column_info *cinfo, const int col);
120
127WS_DLL_PUBLIC void col_set_writable(column_info *cinfo, const int col, const bool writable);
128
138WS_DLL_PUBLIC void col_set_fence(column_info *cinfo, const int col);
139
148WS_DLL_PUBLIC void col_clear_fence(column_info *cinfo, const int col);
149
157WS_DLL_PUBLIC const char *col_get_text(column_info *cinfo, const int col);
158
164WS_DLL_PUBLIC void col_clear(column_info *cinfo, const int col);
165
177WS_DLL_PUBLIC void col_set_str(column_info *cinfo, const int col, const char * str);
178
187WS_DLL_PUBLIC void col_add_str(column_info *cinfo, const int col, const char *str);
188
189/* terminator argument for col_add_lstr() function */
190#define COL_ADD_LSTR_TERMINATOR (const char *) -1
191
192WS_DLL_PUBLIC void col_add_lstr(column_info *cinfo, const int el, const char *str, ...);
193
205WS_DLL_PUBLIC void col_add_fstr(column_info *cinfo, const int col, const char *format, ...)
206 G_GNUC_PRINTF(3, 4);
207
216WS_DLL_PUBLIC void col_append_str(column_info *cinfo, const int col, const char *str);
217
226WS_DLL_PUBLIC void col_append_str_uint(column_info *cinfo, const int col, const char *abbrev, uint32_t val, const char *sep);
227
236WS_DLL_PUBLIC void col_append_ports(column_info *cinfo, const int col, port_type typ, uint16_t src, uint16_t dst);
237
246WS_DLL_PUBLIC void col_append_frame_number(packet_info *pinfo, const int col, const char *fmt_str, unsigned frame_num);
247
248/* Append the given strings (terminated by COL_ADD_LSTR_TERMINATOR) to a column element,
249 *
250 * Same result as col_append_str() called for every string element.
251 */
252WS_DLL_PUBLIC void col_append_lstr(column_info *cinfo, const int el, const char *str, ...);
253
265WS_DLL_PUBLIC void col_append_fstr(column_info *cinfo, const int col, const char *format, ...)
266 G_GNUC_PRINTF(3, 4);
267
277WS_DLL_PUBLIC void col_prepend_fstr(column_info *cinfo, const int col, const char *format, ...)
278 G_GNUC_PRINTF(3, 4);
279
291WS_DLL_PUBLIC void col_prepend_fence_fstr(column_info *cinfo, const int col, const char *format, ...)
292 G_GNUC_PRINTF(3, 4);
293
305WS_DLL_PUBLIC void col_append_sep_str(column_info *cinfo, const int col, const char *sep,
306 const char *str);
307
320WS_DLL_PUBLIC void col_append_sep_fstr(column_info *cinfo, const int col, const char *sep,
321 const char *format, ...)
322 G_GNUC_PRINTF(4, 5);
323
334WS_DLL_PUBLIC void col_set_time(column_info *cinfo, const int col,
335 const nstime_t *ts, const char *fieldname);
336
337WS_DLL_PUBLIC void set_fd_time(const struct epan_session *epan, frame_data *fd, char *buf);
338
339#ifdef __cplusplus
340}
341#endif /* __cplusplus */
342
343#endif /* __COLUMN_UTILS_H__ */
WS_DLL_PUBLIC const char * col_get_text(column_info *cinfo, const int col)
Definition column-utils.c:255
WS_DLL_PUBLIC void col_clear_fence(column_info *cinfo, const int col)
Definition column-utils.c:237
WS_DLL_PUBLIC void col_add_fstr(column_info *cinfo, const int col, const char *format,...) G_GNUC_PRINTF(3
WS_DLL_PUBLIC void col_append_ports(column_info *cinfo, const int col, port_type typ, uint16_t src, uint16_t dst)
Definition column-utils.c:523
WS_DLL_PUBLIC void col_set_fence(column_info *cinfo, const int col)
Definition column-utils.c:219
WS_DLL_PUBLIC void col_add_str(column_info *cinfo, const int col, const char *str)
Definition column-utils.c:739
WS_DLL_PUBLIC void WS_DLL_PUBLIC void col_append_str(column_info *cinfo, const int col, const char *str)
Definition column-utils.c:948
WS_DLL_PUBLIC void WS_DLL_PUBLIC void WS_DLL_PUBLIC void WS_DLL_PUBLIC void col_append_sep_str(column_info *cinfo, const int col, const char *sep, const char *str)
Definition column-utils.c:957
WS_DLL_PUBLIC void WS_DLL_PUBLIC void WS_DLL_PUBLIC void col_prepend_fence_fstr(column_info *cinfo, const int col, const char *format,...) G_GNUC_PRINTF(3
@ COL_ABS_TIME
Definition column-utils.h:65
@ COL_RES_DST
Definition column-utils.h:70
@ COL_NUMBER
Definition column-utils.h:95
@ COL_UNRES_NET_DST
Definition column-utils.h:90
@ COL_RES_SRC
Definition column-utils.h:102
@ COL_DEF_NET_SRC
Definition column-utils.h:94
@ COL_INFO
Definition column-utils.h:88
@ COL_DEF_DL_SRC
Definition column-utils.h:80
@ COL_UNRES_DL_SRC
Definition column-utils.h:84
@ COL_TX_RATE
Definition column-utils.h:86
@ COL_RES_DL_DST
Definition column-utils.h:81
@ COL_DEF_DST_PORT
Definition column-utils.h:75
@ COL_CUSTOM
Definition column-utils.h:67
@ COL_ABS_YMD_TIME
Definition column-utils.h:63
@ COL_RES_DL_SRC
Definition column-utils.h:83
@ COL_DELTA_TIME_DIS
Definition column-utils.h:69
@ COL_FREQ_CHAN
Definition column-utils.h:78
@ COL_DEF_DST
Definition column-utils.h:74
@ COL_RSSI
Definition column-utils.h:85
@ COL_DELTA_TIME
Definition column-utils.h:68
@ COL_CLS_TIME
Definition column-utils.h:109
@ COL_UTC_YMD_TIME
Definition column-utils.h:106
@ COL_UNRES_SRC_PORT
Definition column-utils.h:105
@ COL_PROTOCOL
Definition column-utils.h:98
@ COL_IF_DIR
Definition column-utils.h:77
@ COL_RES_NET_DST
Definition column-utils.h:89
@ COL_UNRES_DST_PORT
Definition column-utils.h:73
@ COL_UNRES_SRC
Definition column-utils.h:103
@ COL_DEF_SRC_PORT
Definition column-utils.h:101
@ COL_RES_NET_SRC
Definition column-utils.h:91
@ COL_DEF_SRC
Definition column-utils.h:100
@ COL_UNRES_DST
Definition column-utils.h:71
@ COL_UTC_TIME
Definition column-utils.h:108
@ NUM_COL_FMTS
Definition column-utils.h:110
@ COL_RES_SRC_PORT
Definition column-utils.h:104
@ COL_UNRES_DL_DST
Definition column-utils.h:82
@ COL_REL_TIME
Definition column-utils.h:99
@ COL_DEF_NET_DST
Definition column-utils.h:93
@ COL_UNRES_NET_SRC
Definition column-utils.h:92
@ COL_DSCP_VALUE
Definition column-utils.h:87
@ COL_NUMBER_DIS
Definition column-utils.h:96
@ COL_UTC_YDOY_TIME
Definition column-utils.h:107
@ COL_PACKET_LENGTH
Definition column-utils.h:97
@ COL_ABS_YDOY_TIME
Definition column-utils.h:64
@ COL_DEF_DL_DST
Definition column-utils.h:79
@ COL_EXPERT
Definition column-utils.h:76
@ COL_CUMULATIVE_BYTES
Definition column-utils.h:66
@ COL_RES_DST_PORT
Definition column-utils.h:72
WS_DLL_PUBLIC void col_set_writable(column_info *cinfo, const int col, const bool writable)
Definition column-utils.c:191
WS_DLL_PUBLIC void WS_DLL_PUBLIC void col_set_time(column_info *cinfo, const int col, const nstime_t *ts, const char *fieldname)
Definition column-utils.c:1660
WS_DLL_PUBLIC void col_append_frame_number(packet_info *pinfo, const int col, const char *fmt_str, unsigned frame_num)
Definition column-utils.c:536
WS_DLL_PUBLIC void col_clear(column_info *cinfo, const int col)
Definition column-utils.c:282
WS_DLL_PUBLIC void WS_DLL_PUBLIC void col_prepend_fstr(column_info *cinfo, const int col, const char *format,...) G_GNUC_PRINTF(3
WS_DLL_PUBLIC void col_append_sep_fstr(column_info *cinfo, const int col, const char *sep, const char *format,...) G_GNUC_PRINTF(4
WS_DLL_PUBLIC void col_append_str_uint(column_info *cinfo, const int col, const char *abbrev, uint32_t val, const char *sep)
Definition column-utils.c:498
WS_DLL_PUBLIC void col_append_fstr(column_info *cinfo, const int col, const char *format,...) G_GNUC_PRINTF(3
WS_DLL_PUBLIC bool col_get_writable(column_info *cinfo, const int col)
Definition column-utils.c:166
WS_DLL_PUBLIC void col_set_str(column_info *cinfo, const int col, const char *str)
Definition column-utils.c:777
Definition packet_info.h:43
Definition column-info.h:62
bool writable
Definition column-info.h:69
Definition epan_dissect.h:28
Definition epan.c:467
Definition nstime.h:26