2013-10-18 13:06:05 +00:00
|
|
|
/* column-info.h
|
2022-08-06 13:31:23 +00:00
|
|
|
* Definitions for internal column structures and routines
|
|
|
|
*
|
|
|
|
* For internal Wireshark use only. Don't include this header in dissectors!
|
2001-04-01 03:42:00 +00:00
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2001-04-01 03:42:00 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-02-08 16:59:17 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2001-04-01 03:42:00 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __COLUMN_INFO_H__
|
|
|
|
#define __COLUMN_INFO_H__
|
|
|
|
|
|
|
|
#include <glib.h>
|
2013-12-22 10:41:27 +00:00
|
|
|
#include <epan/column-utils.h>
|
2001-04-01 03:42:00 +00:00
|
|
|
|
2007-01-18 18:43:30 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2010-08-29 10:47:38 +00:00
|
|
|
/** @file
|
|
|
|
* Column info.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** Column expression */
|
2008-03-01 05:16:45 +00:00
|
|
|
typedef struct {
|
2010-08-29 10:47:38 +00:00
|
|
|
const gchar **col_expr; /**< Filter expression */
|
|
|
|
gchar **col_expr_val; /**< Value for filter expression */
|
2008-03-01 05:16:45 +00:00
|
|
|
} col_expr_t;
|
|
|
|
|
2015-06-27 03:00:33 +00:00
|
|
|
/** Individual column info */
|
|
|
|
typedef struct {
|
|
|
|
gint col_fmt; /**< Format of column */
|
|
|
|
gboolean *fmt_matx; /**< Specifies which formats apply to a column */
|
|
|
|
gchar *col_title; /**< Column titles */
|
2015-12-11 08:34:08 +00:00
|
|
|
gchar *col_custom_fields; /**< Custom column fields */
|
2015-06-27 03:00:33 +00:00
|
|
|
gint col_custom_occurrence;/**< Custom column field occurrence */
|
2015-12-11 08:34:08 +00:00
|
|
|
GSList *col_custom_fields_ids;/**< Custom column fields id */
|
2015-06-27 03:00:33 +00:00
|
|
|
struct epan_dfilter *col_custom_dfilter; /**< Compiled custom column field */
|
|
|
|
const gchar *col_data; /**< Column data */
|
|
|
|
gchar *col_buf; /**< Buffer into which to copy data for column */
|
|
|
|
int col_fence; /**< Stuff in column buffer before this index is immutable */
|
2016-06-14 15:55:08 +00:00
|
|
|
gboolean writable; /**< writable or not */
|
2015-06-27 03:00:33 +00:00
|
|
|
} col_item_t;
|
|
|
|
|
2010-09-22 20:56:14 +00:00
|
|
|
/** Column info */
|
2013-12-22 10:41:27 +00:00
|
|
|
struct epan_column_info {
|
2013-07-21 20:48:30 +00:00
|
|
|
const struct epan_session *epan;
|
2010-08-29 10:47:38 +00:00
|
|
|
gint num_cols; /**< Number of columns */
|
2015-06-27 03:00:33 +00:00
|
|
|
col_item_t *columns; /**< All column data */
|
2010-08-29 10:47:38 +00:00
|
|
|
gint *col_first; /**< First column number with a given format */
|
|
|
|
gint *col_last; /**< Last column number with a given format */
|
|
|
|
col_expr_t col_expr; /**< Column expressions and values */
|
|
|
|
gboolean writable; /**< writable or not @todo Are we still writing to the columns? */
|
2015-08-27 00:14:39 +00:00
|
|
|
GRegex *prime_regex; /**< Used to prime custom columns */
|
2001-04-01 03:42:00 +00:00
|
|
|
};
|
|
|
|
|
2022-08-06 13:31:23 +00:00
|
|
|
/** Allocate all the data structures for constructing column data, given
|
|
|
|
* the number of columns.
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC void col_setup(column_info *cinfo, const gint num_cols);
|
|
|
|
|
|
|
|
/** Cleanup all the data structures for constructing column data;
|
|
|
|
* undoes the alocations that col_setup() does.
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC void col_cleanup(column_info *cinfo);
|
|
|
|
|
|
|
|
/** Initialize the data structures for constructing column data.
|
|
|
|
*/
|
|
|
|
extern void col_init(column_info *cinfo, const struct epan_session *epan);
|
|
|
|
|
|
|
|
/** Fill in all columns of the given packet which are based on values from frame_data.
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC void col_fill_in_frame_data(const frame_data *fd, column_info *cinfo, const gint col, gboolean const fill_col_exprs);
|
|
|
|
|
2022-11-02 13:11:30 +00:00
|
|
|
/** Fill in all (non-custom) columns of the given packet.
|
2022-08-06 13:31:23 +00:00
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC void col_fill_in(packet_info *pinfo, const gboolean fill_col_exprs, const gboolean fill_fd_colums);
|
|
|
|
|
|
|
|
/** Fill in columns if we got an error reading the packet.
|
|
|
|
* We set most columns to "???", and set the Info column to an error
|
|
|
|
* message.
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC void col_fill_in_error(column_info *cinfo, frame_data *fdata, const gboolean fill_col_exprs, const gboolean fill_fd_colums);
|
|
|
|
|
|
|
|
/** Check to see if our column data has changed, e.g. we have new request/response info.
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC gboolean col_data_changed(void);
|
|
|
|
|
|
|
|
void col_custom_set_edt(struct epan_dissect *edt, column_info *cinfo);
|
|
|
|
|
|
|
|
WS_DLL_PUBLIC
|
|
|
|
void col_custom_prime_edt(struct epan_dissect *edt, column_info *cinfo);
|
|
|
|
|
2022-11-02 13:11:30 +00:00
|
|
|
/** Get a filter expression for a custom column. This string must be g_free'd.
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC
|
|
|
|
char* col_custom_get_filter(struct epan_dissect *edt, column_info *cinfo, const gint col);
|
|
|
|
|
2022-08-06 13:31:23 +00:00
|
|
|
WS_DLL_PUBLIC
|
|
|
|
gboolean have_custom_cols(column_info *cinfo);
|
|
|
|
|
|
|
|
WS_DLL_PUBLIC
|
|
|
|
gboolean have_field_extractors(void);
|
|
|
|
|
|
|
|
WS_DLL_PUBLIC
|
|
|
|
gboolean col_has_time_fmt(column_info *cinfo, const gint col);
|
|
|
|
|
|
|
|
WS_DLL_PUBLIC
|
|
|
|
gboolean col_based_on_frame_data(column_info *cinfo, const gint col);
|
|
|
|
|
2007-01-18 18:43:30 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
2001-04-01 03:42:00 +00:00
|
|
|
|
2007-01-18 18:43:30 +00:00
|
|
|
#endif /* __COLUMN_INFO_H__ */
|