Lua: Add redissect_packets()
Add Lua function redissect_packets() to redissect packets in live capture. The use case is to reload packets after a preference change.
This commit is contained in:
parent
79bdde7c82
commit
553e9e83d2
|
@ -82,6 +82,7 @@ typedef struct _funnel_ops_t {
|
|||
void (*set_color_filter_slot)(guint8 filt_nr, const gchar* filter);
|
||||
gboolean (*open_file)(funnel_ops_id_t *ops_id, const char* fname, const char* filter, char** error);
|
||||
void (*reload_packets)(funnel_ops_id_t *ops_id);
|
||||
void (*redissect_packets)(funnel_ops_id_t *ops_id);
|
||||
void (*reload_lua_plugins)(funnel_ops_id_t *ops_id);
|
||||
void (*apply_filter)(funnel_ops_id_t *ops_id);
|
||||
|
||||
|
|
|
@ -1090,6 +1090,28 @@ WSLUA_FUNCTION wslua_reload_packets(lua_State* L) { /*
|
|||
}
|
||||
|
||||
|
||||
WSLUA_FUNCTION wslua_redissect_packets(lua_State* L) { /*
|
||||
Redissect all packets in the current capture file.
|
||||
Requires a GUI.
|
||||
|
||||
[WARNING]
|
||||
====
|
||||
Avoid calling this from within a dissector function or else an infinite loop can occur if it causes the dissector to be called again.
|
||||
This function is best used in a button callback (from a dialog or text window) or menu callback.
|
||||
====
|
||||
*/
|
||||
|
||||
if (!ops->redissect_packets) {
|
||||
WSLUA_ERROR(reload, "GUI not available");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ops->redissect_packets(ops->ops_id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
WSLUA_FUNCTION wslua_reload_lua_plugins(lua_State* L) { /* Reload all Lua plugins. */
|
||||
|
||||
if (!ops->reload_lua_plugins) {
|
||||
|
|
|
@ -105,6 +105,7 @@ static const funnel_ops_t funnel_ops = {
|
|||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ static gchar* funnel_statistics_get_color_filter_slot(guint8 filter_num);
|
|||
static void funnel_statistics_set_color_filter_slot(guint8 filter_num, const gchar* filter_string);
|
||||
static gboolean funnel_statistics_open_file(funnel_ops_id_t *ops_id, const char* fname, const char* filter, char**);
|
||||
static void funnel_statistics_reload_packets(funnel_ops_id_t *ops_id);
|
||||
static void funnel_statistics_redissect_packets(funnel_ops_id_t *ops_id);
|
||||
static void funnel_statistics_reload_lua_plugins(funnel_ops_id_t *ops_id);
|
||||
static void funnel_statistics_apply_filter(funnel_ops_id_t *ops_id);
|
||||
static gboolean browser_open_url(const gchar *url);
|
||||
|
@ -140,6 +141,7 @@ FunnelStatistics::FunnelStatistics(QObject *parent, CaptureFile &cf) :
|
|||
funnel_ops_->set_color_filter_slot = funnel_statistics_set_color_filter_slot;
|
||||
funnel_ops_->open_file = funnel_statistics_open_file;
|
||||
funnel_ops_->reload_packets = funnel_statistics_reload_packets;
|
||||
funnel_ops_->redissect_packets = funnel_statistics_redissect_packets;
|
||||
funnel_ops_->reload_lua_plugins = funnel_statistics_reload_lua_plugins;
|
||||
funnel_ops_->apply_filter = funnel_statistics_apply_filter;
|
||||
funnel_ops_->browser_open_url = browser_open_url;
|
||||
|
@ -188,6 +190,12 @@ void FunnelStatistics::reloadPackets()
|
|||
capture_file_.reload();
|
||||
}
|
||||
|
||||
void FunnelStatistics::redissectPackets()
|
||||
{
|
||||
// This will trigger a packet redissection.
|
||||
wsApp->emitAppSignal(WiresharkApplication::PacketDissectionChanged);
|
||||
}
|
||||
|
||||
void FunnelStatistics::reloadLuaPlugins()
|
||||
{
|
||||
wsApp->reloadLuaPluginsDelayed();
|
||||
|
@ -275,6 +283,12 @@ void funnel_statistics_reload_packets(funnel_ops_id_t *ops_id) {
|
|||
ops_id->funnel_statistics->reloadPackets();
|
||||
}
|
||||
|
||||
void funnel_statistics_redissect_packets(funnel_ops_id_t *ops_id) {
|
||||
if (!ops_id || !ops_id->funnel_statistics) return;
|
||||
|
||||
ops_id->funnel_statistics->redissectPackets();
|
||||
}
|
||||
|
||||
void funnel_statistics_reload_lua_plugins(funnel_ops_id_t *ops_id) {
|
||||
if (!ops_id || !ops_id->funnel_statistics) return;
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ public:
|
|||
const char *displayFilter();
|
||||
void emitSetDisplayFilter(const QString filter);
|
||||
void reloadPackets();
|
||||
void redissectPackets();
|
||||
void reloadLuaPlugins();
|
||||
void emitApplyDisplayFilter();
|
||||
void emitOpenCaptureFile(QString cf_path, QString filter);
|
||||
|
|
Loading…
Reference in New Issue