attr_dissector_fn_t
[wireshark-sm.git] / epan / column-info.h
blobc6d7fa090daea3f514d14d2aec476098496c53f7
1 /* column-info.h
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>
18 #ifdef __cplusplus
19 extern "C" {
20 #endif /* __cplusplus */
22 /** @file
23 * Column info.
26 typedef struct _proto_node proto_tree;
28 #define COLUMN_FIELD_FILTER "_ws.col."
30 /** Column expression */
31 typedef struct {
32 const char **col_expr; /**< Filter expression */
33 char **col_expr_val; /**< Value for filter expression */
34 } col_expr_t;
36 /** Custom column filter expression information used in the GSList below.
37 * One for each expression in a multifield column.
39 typedef struct {
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 */
43 } col_custom_t;
45 /** Individual column info */
46 typedef struct {
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 */
58 int hf_id;
59 } col_item_t;
61 /** Column info */
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
97 * message.
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);
107 WS_DLL_PUBLIC
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.
112 WS_DLL_PUBLIC
113 char* col_custom_get_filter(struct epan_dissect *edt, column_info *cinfo, const int col);
115 WS_DLL_PUBLIC
116 bool have_custom_cols(column_info *cinfo);
118 WS_DLL_PUBLIC
119 bool have_field_extractors(void);
121 WS_DLL_PUBLIC
122 bool col_has_time_fmt(column_info *cinfo, const int col);
124 WS_DLL_PUBLIC
125 bool col_based_on_frame_data(column_info *cinfo, const int col);
127 void
128 col_register_protocol(void);
130 extern
131 void col_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
133 #ifdef __cplusplus
135 #endif /* __cplusplus */
137 #endif /* __COLUMN_INFO_H__ */