2 * Definitions for internal column structures and routines
4 * For internal Wireshark use only. Don't include this header in dissectors!
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
13 #ifndef __COLUMN_INFO_H__
14 #define __COLUMN_INFO_H__
16 #include <epan/column-utils.h>
20 #endif /* __cplusplus */
26 typedef struct _proto_node proto_tree
;
28 #define COLUMN_FIELD_FILTER "_ws.col."
30 /** Column expression */
32 const char **col_expr
; /**< Filter expression */
33 char **col_expr_val
; /**< Value for filter expression */
36 /** Custom column filter expression information used in the GSList below.
37 * One for each expression in a multifield column.
40 char *dftext
; /**< Filter expression */
41 struct epan_dfilter
*dfilter
; /**< Compiled filter expression */
42 int field_id
; /**< ID for a single field expression, or 0 */
45 /** Individual column info */
47 int col_fmt
; /**< Format of column */
48 bool *fmt_matx
; /**< Specifies which formats apply to a column */
49 char *col_title
; /**< Column titles */
50 char *col_custom_fields
; /**< Custom column fields */
51 int col_custom_occurrence
;/**< Custom column field occurrence */
52 GSList
*col_custom_fields_ids
;/**< Custom column fields id */
53 struct epan_dfilter
*col_custom_dfilter
; /**< Compiled custom column field */
54 const char *col_data
; /**< Column data */
55 char *col_buf
; /**< Buffer into which to copy data for column */
56 int col_fence
; /**< Stuff in column buffer before this index is immutable */
57 bool writable
; /**< writable or not */
62 struct epan_column_info
{
63 const struct epan_session
*epan
;
64 int num_cols
; /**< Number of columns */
65 col_item_t
*columns
; /**< All column data */
66 int *col_first
; /**< First column number with a given format */
67 int *col_last
; /**< Last column number with a given format */
68 col_expr_t col_expr
; /**< Column expressions and values */
69 bool writable
; /**< writable or not @todo Are we still writing to the columns? */
70 GRegex
*prime_regex
; /**< Used to prime custom columns */
73 /** Allocate all the data structures for constructing column data, given
74 * the number of columns.
76 WS_DLL_PUBLIC
void col_setup(column_info
*cinfo
, const int num_cols
);
78 /** Cleanup all the data structures for constructing column data;
79 * undoes the allocations that col_setup() does.
81 WS_DLL_PUBLIC
void col_cleanup(column_info
*cinfo
);
83 /** Initialize the data structures for constructing column data.
85 extern void col_init(column_info
*cinfo
, const struct epan_session
*epan
);
87 /** Fill in all columns of the given packet which are based on values from frame_data.
89 WS_DLL_PUBLIC
void col_fill_in_frame_data(const frame_data
*fd
, column_info
*cinfo
, const int col
, bool const fill_col_exprs
);
91 /** Fill in all (non-custom) columns of the given packet.
93 WS_DLL_PUBLIC
void col_fill_in(packet_info
*pinfo
, const bool fill_col_exprs
, const bool fill_fd_colums
);
95 /** Fill in columns if we got an error reading the packet.
96 * We set most columns to "???", and set the Info column to an error
99 WS_DLL_PUBLIC
void col_fill_in_error(column_info
*cinfo
, frame_data
*fdata
, const bool fill_col_exprs
, const bool fill_fd_colums
);
101 /** Check to see if our column data has changed, e.g. we have new request/response info.
103 WS_DLL_PUBLIC
bool col_data_changed(void);
105 void col_custom_set_edt(struct epan_dissect
*edt
, column_info
*cinfo
);
108 void col_custom_prime_edt(struct epan_dissect
*edt
, column_info
*cinfo
);
110 /** Get a filter expression for a custom column. This string must be g_free'd.
113 char* col_custom_get_filter(struct epan_dissect
*edt
, column_info
*cinfo
, const int col
);
116 bool have_custom_cols(column_info
*cinfo
);
119 bool have_field_extractors(void);
122 bool col_has_time_fmt(column_info
*cinfo
, const int col
);
125 bool col_based_on_frame_data(column_info
*cinfo
, const int col
);
128 col_register_protocol(void);
131 void col_dissect(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
);
135 #endif /* __cplusplus */
137 #endif /* __COLUMN_INFO_H__ */