1 /* column-info.h
2  * Definitions for column 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_INFO_H__
12 #define __COLUMN_INFO_H__
13 
14 #include <glib.h>
15 #include <epan/column-utils.h>
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif /* __cplusplus */
20 
21 /** @file
22  * Column info.
23  */
24 
25 #define COL_MAX_LEN 2048
26 #define COL_MAX_INFO_LEN 4096
27 #define COL_CUSTOM_PRIME_REGEX " *([^ \\|]+) *(?:(?:\\|\\|)|(?:or)| *$){1}"
28 
29 /** Column expression */
30 typedef struct {
31   const gchar **col_expr;     /**< Filter expression */
32   gchar      **col_expr_val;  /**< Value for filter expression */
33 } col_expr_t;
34 
35 /** Individual column info */
36 typedef struct {
37   gint                col_fmt;              /**< Format of column */
38   gboolean           *fmt_matx;             /**< Specifies which formats apply to a column */
39   gchar              *col_title;            /**< Column titles */
40   gchar              *col_custom_fields;    /**< Custom column fields */
41   gint                col_custom_occurrence;/**< Custom column field occurrence */
42   GSList             *col_custom_fields_ids;/**< Custom column fields id */
43   struct epan_dfilter *col_custom_dfilter;  /**< Compiled custom column field */
44   const gchar        *col_data;             /**< Column data */
45   gchar              *col_buf;              /**< Buffer into which to copy data for column */
46   int                 col_fence;            /**< Stuff in column buffer before this index is immutable */
47   gboolean            writable;             /**< writable or not */
48 } col_item_t;
49 
50 /** Column info */
51 struct epan_column_info {
52   const struct epan_session *epan;
53   gint                num_cols;             /**< Number of columns */
54   col_item_t         *columns;              /**< All column data */
55   gint               *col_first;            /**< First column number with a given format */
56   gint               *col_last;             /**< Last column number with a given format */
57   col_expr_t          col_expr;             /**< Column expressions and values */
58   gboolean            writable;             /**< writable or not @todo Are we still writing to the columns? */
59   GRegex             *prime_regex;          /**< Used to prime custom columns */
60 };
61 
62 #ifdef __cplusplus
63 }
64 #endif /* __cplusplus */
65 
66 #endif /* __COLUMN_INFO_H__ */
67