2021-11-30 04:27:19 +00:00
|
|
|
/** @file
|
2016-10-15 18:48:17 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2016 Jakub Zawadzki
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-02-07 11:26:45 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2016-10-15 18:48:17 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __SHARKD_H
|
|
|
|
#define __SHARKD_H
|
|
|
|
|
|
|
|
#include <file.h>
|
2021-04-29 11:23:21 +00:00
|
|
|
#include <wiretap/wtap_opttypes.h>
|
2016-10-15 18:48:17 +00:00
|
|
|
|
2018-06-16 16:22:00 +00:00
|
|
|
#define SHARKD_DISSECT_FLAG_NULL 0x00u
|
|
|
|
#define SHARKD_DISSECT_FLAG_BYTES 0x01u
|
|
|
|
#define SHARKD_DISSECT_FLAG_COLUMNS 0x02u
|
|
|
|
#define SHARKD_DISSECT_FLAG_PROTO_TREE 0x04u
|
|
|
|
#define SHARKD_DISSECT_FLAG_COLOR 0x08u
|
|
|
|
|
2021-02-08 10:27:18 +00:00
|
|
|
#define SHARKD_MODE_CLASSIC_CONSOLE 1
|
|
|
|
#define SHARKD_MODE_CLASSIC_DAEMON 2
|
|
|
|
#define SHARKD_MODE_GOLD_CONSOLE 3
|
|
|
|
#define SHARKD_MODE_GOLD_DAEMON 4
|
|
|
|
|
2017-12-28 12:07:54 +00:00
|
|
|
typedef void (*sharkd_dissect_func_t)(epan_dissect_t *edt, proto_tree *tree, struct epan_column_info *cinfo, const GSList *data_src, void *data);
|
|
|
|
|
2016-10-15 18:48:17 +00:00
|
|
|
/* sharkd.c */
|
|
|
|
cf_status_t sharkd_cf_open(const char *fname, unsigned int type, gboolean is_tempfile, int *err);
|
|
|
|
int sharkd_load_cap_file(void);
|
|
|
|
int sharkd_retap(void);
|
|
|
|
int sharkd_filter(const char *dftext, guint8 **result);
|
2017-12-07 20:56:11 +00:00
|
|
|
frame_data *sharkd_get_frame(guint32 framenum);
|
sharkd: various cleanups.
Extend sharkd_dissect_request() so that it can replace
sharkd_dissect_columns().
Have it return a status indicating success, invalid frame number, or
read error, so that the caller knows what the problem is.
Pass it pointers to the wtap_rec and Buffer to use when reading packets
from the file, so that if it's called in a loop iterating over all
frames, those structures can be initialized once, before the loop, and
cleaned up once, after the loop, rather than doing both once per loop
iteration.
Pass pointers to the read error code and additional read error
information string pointer, so that, on a file read error, that
information is available to the caller.
Get rid of sharkd_dissect_columns(); instead, use
sharkd_dissect_request(), with code from the loop body pulled into a
callback routine. Fix that code to correctly determine whether the
current frame has any comments, rather than just treating all frames
that have blocks as having comments.
Use _U_ to mark arguments as unused, rather than throwing in a
(void) variablename;
statement.
Move some variables used only within a loop into the for() statement or
the loop body.
2021-07-11 10:06:10 +00:00
|
|
|
enum dissect_request_status {
|
|
|
|
DISSECT_REQUEST_SUCCESS,
|
|
|
|
DISSECT_REQUEST_NO_SUCH_FRAME,
|
|
|
|
DISSECT_REQUEST_READ_ERROR
|
|
|
|
};
|
|
|
|
enum dissect_request_status
|
|
|
|
sharkd_dissect_request(guint32 framenum, guint32 frame_ref_num,
|
|
|
|
guint32 prev_dis_num, wtap_rec *rec, Buffer *buf,
|
|
|
|
column_info *cinfo, guint32 dissect_flags,
|
|
|
|
sharkd_dissect_func_t cb, void *data,
|
|
|
|
int *err, gchar **err_info);
|
2021-07-08 05:43:29 +00:00
|
|
|
wtap_block_t sharkd_get_modified_block(const frame_data *fd);
|
2021-04-29 11:23:21 +00:00
|
|
|
wtap_block_t sharkd_get_packet_block(const frame_data *fd);
|
2021-07-08 05:43:29 +00:00
|
|
|
int sharkd_set_modified_block(frame_data *fd, wtap_block_t new_block);
|
2021-04-29 11:23:21 +00:00
|
|
|
const char *sharkd_version(void);
|
2016-10-15 18:48:17 +00:00
|
|
|
|
|
|
|
/* sharkd_daemon.c */
|
|
|
|
int sharkd_init(int argc, char **argv);
|
2021-02-08 10:27:18 +00:00
|
|
|
int sharkd_loop(int argc _U_, char* argv[] _U_);
|
2016-10-15 18:48:17 +00:00
|
|
|
|
|
|
|
/* sharkd_session.c */
|
2021-02-08 10:27:18 +00:00
|
|
|
int sharkd_session_main(int mode_setting);
|
2016-10-15 18:48:17 +00:00
|
|
|
|
|
|
|
#endif /* __SHARKD_H */
|
|
|
|
|
|
|
|
/*
|
2019-07-26 18:43:17 +00:00
|
|
|
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
2016-10-15 18:48:17 +00:00
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 8
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: t
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
|
|
|
|
* :indentSize=8:tabSize=8:noTabs=false:
|
|
|
|
*/
|