epan: Rearrange column includes

Move all the declarations of routines that are internal and
not for use by dissectors from column-utils.h column-info.h
Move the column max length defines into column-utils.h because
dissectors might need that

Since packet.h already includes column-utils.h, dissectors don't
need to include column-utils.h anymore.
Remove or downgrade a few other column header includes that are
unnecessary.
This commit is contained in:
John Thacker 2022-08-06 09:31:23 -04:00 committed by A Wireshark GitLab Utility
parent d0a9de2af1
commit c7a136a5c0
22 changed files with 69 additions and 92 deletions

View File

@ -1,5 +1,7 @@
/* column-info.h /* column-info.h
* Definitions for column structures and routines * Definitions for internal column structures and routines
*
* For internal Wireshark use only. Don't include this header in dissectors!
* *
* Wireshark - Network traffic analyzer * Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org> * By Gerald Combs <gerald@wireshark.org>
@ -22,10 +24,6 @@ extern "C" {
* Column info. * Column info.
*/ */
#define COL_MAX_LEN 2048
#define COL_MAX_INFO_LEN 4096
#define COL_CUSTOM_PRIME_REGEX " *([^ \\|]+) *(?:(?:\\|\\|)|(?:or)| *$){1}"
/** Column expression */ /** Column expression */
typedef struct { typedef struct {
const gchar **col_expr; /**< Filter expression */ const gchar **col_expr; /**< Filter expression */
@ -59,6 +57,55 @@ struct epan_column_info {
GRegex *prime_regex; /**< Used to prime custom columns */ GRegex *prime_regex; /**< Used to prime custom columns */
}; };
/** 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);
/** Fill in all columns of the given packet.
*/
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);
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);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */

View File

@ -1,5 +1,6 @@
/** @file /** @file
* Definitions for column utility structures and routines * Definitions for column utility structures and routines
* Utility routines used by packet*.c
* *
* Wireshark - Network traffic analyzer * Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org> * By Gerald Combs <gerald@wireshark.org>
@ -20,6 +21,10 @@
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
#define COL_MAX_LEN 2048
#define COL_MAX_INFO_LEN 4096
#define COL_CUSTOM_PRIME_REGEX " *([^ \\|]+) *(?:(?:\\|\\|)|(?:or)| *$){1}"
struct epan_dissect; struct epan_dissect;
/** /**
@ -92,54 +97,6 @@ enum {
NUM_COL_FMTS /**< 50) Should always be last */ NUM_COL_FMTS /**< 50) Should always be last */
}; };
/** Allocate all the data structures for constructing column data, given
* the number of columns.
*
* Internal, don't use this in dissectors!
*/
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.
*
* Internal, don't use this in dissectors!
*/
WS_DLL_PUBLIC void col_cleanup(column_info *cinfo);
/** Initialize the data structures for constructing column data.
*
* Internal, don't use this in dissectors!
*/
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.
*
* Internal, don't use this in dissectors!
*/
WS_DLL_PUBLIC void col_fill_in_frame_data(const frame_data *fd, column_info *cinfo, const gint col, gboolean const fill_col_exprs);
/** Fill in all columns of the given packet.
*
* Internal, don't use this in dissectors!
*/
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.
*
* Internal, don't use this in dissectors!
*/
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.
*
* Internal, don't use this in dissectors!
*/
WS_DLL_PUBLIC gboolean col_data_changed(void);
/* Utility routines used by packet*.c */
/** Are the columns writable? /** Are the columns writable?
* *
* @param cinfo the current packet row * @param cinfo the current packet row
@ -227,28 +184,6 @@ WS_DLL_PUBLIC void col_add_lstr(column_info *cinfo, const gint el, const gchar *
WS_DLL_PUBLIC void col_add_fstr(column_info *cinfo, const gint col, const gchar *format, ...) WS_DLL_PUBLIC void col_add_fstr(column_info *cinfo, const gint col, const gchar *format, ...)
G_GNUC_PRINTF(3, 4); G_GNUC_PRINTF(3, 4);
/** For internal Wireshark use only. Not to be called from dissectors. */
void col_custom_set_edt(struct epan_dissect *edt, column_info *cinfo);
/** For internal Wireshark use only. Not to be called from dissectors. */
WS_DLL_PUBLIC
void col_custom_prime_edt(struct epan_dissect *edt, column_info *cinfo);
/** For internal Wireshark use only. Not to be called from dissectors. */
WS_DLL_PUBLIC
gboolean have_custom_cols(column_info *cinfo);
/** For internal Wireshark use only. Not to be called from dissectors. */
WS_DLL_PUBLIC
gboolean have_field_extractors(void);
/** For internal Wireshark use only. Not to be called from dissectors. */
WS_DLL_PUBLIC
gboolean col_has_time_fmt(column_info *cinfo, const gint col);
/** For internal Wireshark use only. Not to be called from dissectors. */
WS_DLL_PUBLIC
gboolean col_based_on_frame_data(column_info *cinfo, const gint col);
/** Append the given text to a column element, the text will be copied. /** Append the given text to a column element, the text will be copied.
* *
* @param cinfo the current packet row * @param cinfo the current packet row

View File

@ -22,6 +22,7 @@
#include <epan/prefs.h> #include <epan/prefs.h>
#include <epan/dfilter/dfilter.h> #include <epan/dfilter/dfilter.h>
#include <epan/column.h> #include <epan/column.h>
#include <epan/column-info.h>
#include <epan/packet.h> #include <epan/packet.h>
#include <wsutil/ws_assert.h> #include <wsutil/ws_assert.h>

View File

@ -1,5 +1,8 @@
/** @file /** @file
* Definitions for column handling routines * Definitions for column handling routines
* Column preference and format settings.
*
* For internal Wireshark useonly. Don't include this header in dissectors!
* *
* Wireshark - Network traffic analyzer * Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org> * By Gerald Combs <gerald@wireshark.org>
@ -12,7 +15,7 @@
#define __COLUMN_H__ #define __COLUMN_H__
#include "ws_symbol_export.h" #include "ws_symbol_export.h"
#include <epan/column-info.h> #include <epan/column-utils.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -27,7 +27,6 @@
#include <epan/expert.h> #include <epan/expert.h>
#include <epan/show_exception.h> #include <epan/show_exception.h>
#include <epan/etypes.h> #include <epan/etypes.h>
#include <epan/column.h>
#include <epan/tvbuff.h> #include <epan/tvbuff.h>
#include <epan/to_str.h> #include <epan/to_str.h>

View File

@ -38,7 +38,6 @@
#include "packet-frame.h" #include "packet-frame.h"
#include "packet-icmp.h" #include "packet-icmp.h"
#include <epan/column-info.h>
#include <epan/color_filters.h> #include <epan/color_filters.h>
void proto_register_frame(void); void proto_register_frame(void);

View File

@ -15,7 +15,6 @@
#include <epan/prefs.h> #include <epan/prefs.h>
#include <epan/expert.h> #include <epan/expert.h>
#include <epan/sequence_analysis.h> #include <epan/sequence_analysis.h>
#include <epan/column-info.h>
#include <epan/to_str.h> #include <epan/to_str.h>
#include <epan/tap.h> #include <epan/tap.h>
#include "packet-lbm.h" #include "packet-lbm.h"

View File

@ -17,11 +17,9 @@
#include "config.h" #include "config.h"
#include <epan/packet.h> #include <epan/packet.h>
#include <epan/expert.h> #include <epan/expert.h>
#include <epan/column-info.h>
#include <epan/to_str.h> #include <epan/to_str.h>
#include <packet-lbm.h> #include <packet-lbm.h>
#include <epan/proto.h> #include <epan/proto.h>
#include <epan/column-utils.h>
#include <epan/prefs.h> #include <epan/prefs.h>
#include <epan/uat.h> #include <epan/uat.h>
#include <wsutil/pint.h> #include <wsutil/pint.h>

View File

@ -60,7 +60,6 @@
#include <epan/addr_resolv.h> #include <epan/addr_resolv.h>
#include <epan/wmem_scopes.h> #include <epan/wmem_scopes.h>
#include <epan/conversation.h> #include <epan/conversation.h>
#include <epan/column.h>
#include <epan/dissectors/packet-tcp.h> #include <epan/dissectors/packet-tcp.h>
#include <epan/dissectors/packet-rtps.h> #include <epan/dissectors/packet-rtps.h>

View File

@ -60,7 +60,6 @@
#include <epan/addr_resolv.h> #include <epan/addr_resolv.h>
#include <epan/wmem_scopes.h> #include <epan/wmem_scopes.h>
#include <epan/conversation.h> #include <epan/conversation.h>
#include <epan/column.h>
#include <epan/dissectors/packet-tcp.h> #include <epan/dissectors/packet-tcp.h>
#include <epan/dissectors/packet-rtps.h> #include <epan/dissectors/packet-rtps.h>

View File

@ -39,7 +39,7 @@
#include "except.h" #include "except.h"
#include "packet.h" #include "packet.h"
#include "prefs.h" #include "prefs.h"
#include "column-utils.h" #include "column-info.h"
#include "tap.h" #include "tap.h"
#include "addr_resolv.h" #include "addr_resolv.h"
#include "oids.h" #include "oids.h"

View File

@ -32,6 +32,7 @@
#include <epan/wmem_scopes.h> #include <epan/wmem_scopes.h>
#include <epan/column-info.h>
#include <epan/exceptions.h> #include <epan/exceptions.h>
#include <epan/reassemble.h> #include <epan/reassemble.h>
#include <epan/stream.h> #include <epan/stream.h>

View File

@ -17,7 +17,7 @@
#include "addr_resolv.h" #include "addr_resolv.h"
#include "proto.h" #include "proto.h"
#include "color_filters.h" #include "color_filters.h"
#include "column-info.h" #include <epan/column.h>
#include "tap.h" #include "tap.h"
#include <epan/wmem_scopes.h> #include <epan/wmem_scopes.h>

View File

@ -34,6 +34,7 @@
#include <epan/timestamp.h> #include <epan/timestamp.h>
#include <epan/prefs.h> #include <epan/prefs.h>
#include <epan/column.h> #include <epan/column.h>
#include <epan/column-info.h>
#include <epan/print.h> #include <epan/print.h>
#include <epan/epan_dissect.h> #include <epan/epan_dissect.h>
#include <epan/disabled_protos.h> #include <epan/disabled_protos.h>

View File

@ -34,6 +34,7 @@
#include <wiretap/wtap.h> #include <wiretap/wtap.h>
#include <epan/column.h> #include <epan/column.h>
#include <epan/column-info.h>
#include <ui/ssl_key_export.h> #include <ui/ssl_key_export.h>

View File

@ -11,7 +11,6 @@
#include <glib.h> #include <glib.h>
#include <epan/column-info.h>
#include <epan/column.h> #include <epan/column.h>
#include <epan/prefs.h> #include <epan/prefs.h>
#include <ui/recent.h> #include <ui/recent.h>

View File

@ -11,7 +11,6 @@
#include <glib.h> #include <glib.h>
#include <epan/column-info.h>
#include <epan/column.h> #include <epan/column.h>
#include <epan/prefs.h> #include <epan/prefs.h>
#include <epan/proto.h> #include <epan/proto.h>

View File

@ -14,7 +14,6 @@
#include <ui/qt/utils/wireshark_mime_data.h> #include <ui/qt/utils/wireshark_mime_data.h>
#include <glib.h> #include <glib.h>
#include <epan/column-info.h>
#include <epan/column.h> #include <epan/column.h>
#include <epan/prefs.h> #include <epan/prefs.h>
#include <epan/proto.h> #include <epan/proto.h>

View File

@ -12,7 +12,6 @@
#include <file.h> #include <file.h>
#include <epan/epan_dissect.h> #include <epan/epan_dissect.h>
#include <epan/column-info.h>
#include <epan/column.h> #include <epan/column.h>
#include <epan/conversation.h> #include <epan/conversation.h>
#include <epan/wmem_scopes.h> #include <epan/wmem_scopes.h>

View File

@ -16,7 +16,7 @@
#include "cfile.h" #include "cfile.h"
#include <epan/column-info.h> #include <epan/column.h>
#include <epan/packet.h> #include <epan/packet.h>
#include <QByteArray> #include <QByteArray>

View File

@ -18,7 +18,6 @@
#include <epan/epan.h> #include <epan/epan.h>
#include <epan/epan_dissect.h> #include <epan/epan_dissect.h>
#include <epan/column-info.h>
#include <epan/column.h> #include <epan/column.h>
#include <epan/expert.h> #include <epan/expert.h>
#include <epan/ipproto.h> #include <epan/ipproto.h>

View File

@ -14,7 +14,7 @@
#include <epan/prefs.h> #include <epan/prefs.h>
#include <epan/proto.h> #include <epan/proto.h>
#include <epan/dfilter/dfilter.h> #include <epan/dfilter/dfilter.h>
#include <epan/column-info.h> #include <epan/column.h>
#include <wsutil/utf8_entities.h> #include <wsutil/utf8_entities.h>