2021-11-29 23:27:19 -05:00
|
|
|
/** @file
|
2016-10-15 20:48:17 +02:00
|
|
|
*
|
|
|
|
* Copyright (C) 2016 Jakub Zawadzki
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-02-07 12:26:45 +01:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2016-10-15 20:48:17 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __SHARKD_H
|
|
|
|
#define __SHARKD_H
|
|
|
|
|
|
|
|
#include <file.h>
|
2021-04-29 07:23:21 -04:00
|
|
|
#include <wiretap/wtap_opttypes.h>
|
2016-10-15 20:48:17 +02:00
|
|
|
|
2018-06-16 18:22:00 +02: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 13:07:54 +01: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);
|
|
|
|
|
2025-04-28 13:30:46 +00:00
|
|
|
#define LONGOPT_FOREGROUND 4000
|
|
|
|
|
2016-10-15 20:48:17 +02:00
|
|
|
/* sharkd.c */
|
2024-07-07 16:00:12 -04:00
|
|
|
cf_status_t sharkd_cf_open(const char *fname, unsigned int type, bool is_tempfile, int *err);
|
2016-10-15 20:48:17 +02:00
|
|
|
int sharkd_load_cap_file(void);
|
|
|
|
int sharkd_retap(void);
|
2024-07-07 20:58:43 -04:00
|
|
|
int sharkd_filter(const char *dftext, uint8_t **result);
|
|
|
|
frame_data *sharkd_get_frame(uint32_t 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 03:06:10 -07:00
|
|
|
enum dissect_request_status {
|
|
|
|
DISSECT_REQUEST_SUCCESS,
|
|
|
|
DISSECT_REQUEST_NO_SUCH_FRAME,
|
|
|
|
DISSECT_REQUEST_READ_ERROR
|
|
|
|
};
|
|
|
|
enum dissect_request_status
|
2024-07-07 20:58:43 -04:00
|
|
|
sharkd_dissect_request(uint32_t framenum, uint32_t frame_ref_num,
|
2024-12-29 14:04:53 -08:00
|
|
|
uint32_t prev_dis_num, wtap_rec *rec,
|
2024-07-07 20:58:43 -04:00
|
|
|
column_info *cinfo, uint32_t dissect_flags,
|
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 03:06:10 -07:00
|
|
|
sharkd_dissect_func_t cb, void *data,
|
2024-07-07 20:58:43 -04:00
|
|
|
int *err, char **err_info);
|
2021-07-07 22:43:29 -07:00
|
|
|
wtap_block_t sharkd_get_modified_block(const frame_data *fd);
|
2021-04-29 07:23:21 -04:00
|
|
|
wtap_block_t sharkd_get_packet_block(const frame_data *fd);
|
2021-07-07 22:43:29 -07:00
|
|
|
int sharkd_set_modified_block(frame_data *fd, wtap_block_t new_block);
|
2021-04-29 07:23:21 -04:00
|
|
|
const char *sharkd_version(void);
|
2025-04-28 13:30:46 +00:00
|
|
|
const struct ws_option* sharkd_long_options(void);
|
|
|
|
const char* sharkd_optstring(void);
|
|
|
|
|
2016-10-15 20:48:17 +02: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 20:48:17 +02:00
|
|
|
|
|
|
|
/* sharkd_session.c */
|
2021-02-08 10:27:18 +00:00
|
|
|
int sharkd_session_main(int mode_setting);
|
2016-10-15 20:48:17 +02:00
|
|
|
|
|
|
|
#endif /* __SHARKD_H */
|
|
|
|
|
|
|
|
/*
|
2019-07-26 11:43:17 -07:00
|
|
|
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
2016-10-15 20:48:17 +02: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:
|
|
|
|
*/
|