summaryrefslogtreecommitdiff
path: root/ui/win32
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2013-11-29 22:47:59 +0000
committerMichael Mann <mmann78@netscape.net>2013-11-29 22:47:59 +0000
commit60d6b05e2340ae90c09fbdd2f25b6513131a0bd1 (patch)
treeb6e5a1637da1197aa7faad6cd480693ee1deee13 /ui/win32
parenteaaf4437aba897df51bfb31829f98cf198dd1887 (diff)
downloadwireshark-60d6b05e2340ae90c09fbdd2f25b6513131a0bd1.tar.gz
Stats_tree enhancements for sorting, averages and burst rate. Bug 9452 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9452)
From Deon van der Westhuysen - Bug fix: object leak in stats_tree after a tap reset (for example apply statistics preferences with a stats_tree window open) - Bug fix: correct sample code in README.stats_tree - Add: slash in plug-in name now creates submenu as docs describe (was a bug?) - Add: menu separator before the stat_tree registered plug-ins - Add: stats_tree can now calculate averages for nodes; automatically calculated for range nodes. Add section in README.stats_tree describing averages. - Add: stats_tree can now calculate burst rate of each node (like rate but with a shorter, sliding time window) - Add: sorting for stats_tree plug-ins. Can sort on node name, count, average, min, max values and burst rate. - Add: preferences for stats_tree system (default sort column, burst calc params) - Add: stats_tree window copy to clipboard and export and plain text, csv and XML. - Added sample of new functionality in $srcdir/plugins/stats_tree/pinfo_stats_tree.c - Moved all stats_tree sample plug-ins to "IP Statistics" submenu. svn path=/trunk/; revision=53657
Diffstat (limited to 'ui/win32')
-rw-r--r--ui/win32/file_dlg_win32.c87
-rw-r--r--ui/win32/file_dlg_win32.h11
2 files changed, 98 insertions, 0 deletions
diff --git a/ui/win32/file_dlg_win32.c b/ui/win32/file_dlg_win32.c
index 7b4d829ed2..187e38eff8 100644
--- a/ui/win32/file_dlg_win32.c
+++ b/ui/win32/file_dlg_win32.c
@@ -95,6 +95,7 @@
static UINT_PTR CALLBACK open_file_hook_proc(HWND of_hwnd, UINT ui_msg, WPARAM w_param, LPARAM l_param);
static UINT_PTR CALLBACK save_as_file_hook_proc(HWND of_hwnd, UINT ui_msg, WPARAM w_param, LPARAM l_param);
+static UINT_PTR CALLBACK save_as_statstree_hook_proc(HWND of_hwnd, UINT ui_msg, WPARAM w_param, LPARAM l_param);
static UINT_PTR CALLBACK export_specified_packets_file_hook_proc(HWND of_hwnd, UINT ui_msg, WPARAM w_param, LPARAM l_param);
static UINT_PTR CALLBACK merge_file_hook_proc(HWND mf_hwnd, UINT ui_msg, WPARAM w_param, LPARAM l_param);
static UINT_PTR CALLBACK export_file_hook_proc(HWND of_hwnd, UINT ui_msg, WPARAM w_param, LPARAM l_param);
@@ -426,6 +427,72 @@ win32_save_as_file(HWND h_wnd, capture_file *cf, GString *file_name, int *file_t
return gsfn_ok;
}
+gboolean win32_save_as_statstree(HWND h_wnd, GString *file_name, int *file_type)
+{
+ OPENFILENAME *ofn;
+ TCHAR file_name16[MAX_PATH] = _T("");
+ int ofnsize;
+ gboolean gsfn_ok;
+#if (_MSC_VER >= 1500)
+ OSVERSIONINFO osvi;
+#endif
+
+ if (!file_name || !file_type)
+ return FALSE;
+
+ if (file_name->len > 0) {
+ StringCchCopy(file_name16, MAX_PATH, utf_8to16(file_name->str));
+ }
+
+ /* see OPENFILENAME comment in win32_open_file */
+#if (_MSC_VER >= 1500)
+ SecureZeroMemory(&osvi, sizeof(OSVERSIONINFO));
+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ GetVersionEx(&osvi);
+ if (osvi.dwMajorVersion >= 5) {
+ ofnsize = sizeof(OPENFILENAME);
+ } else {
+ ofnsize = OPENFILENAME_SIZE_VERSION_400;
+ }
+#else
+ ofnsize = sizeof(OPENFILENAME) + 12;
+#endif
+ ofn = g_malloc0(ofnsize);
+
+ ofn->lStructSize = ofnsize;
+ ofn->hwndOwner = h_wnd;
+ ofn->hInstance = (HINSTANCE) GetWindowLongPtr(h_wnd, GWLP_HINSTANCE);
+ ofn->lpstrFilter = _T("Plain text file (.txt)\0*.txt\0Comma separated values (.csv)\0*.csv\0XML document (.xml)\0*.xml\0");
+ ofn->lpstrCustomFilter = NULL;
+ ofn->nMaxCustFilter = 0;
+ ofn->nFilterIndex = 1; /* the first entry is the best match; 1-origin indexing */
+ ofn->lpstrFile = file_name16;
+ ofn->nMaxFile = MAX_PATH;
+ ofn->lpstrFileTitle = NULL;
+ ofn->nMaxFileTitle = 0;
+ ofn->lpstrInitialDir = utf_8to16(get_last_open_dir());
+ ofn->lpstrTitle = _T("Wireshark: Save stats tree as ...");
+ ofn->Flags = OFN_ENABLESIZING | OFN_ENABLETEMPLATE | OFN_EXPLORER |
+ OFN_NOCHANGEDIR | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY |
+ OFN_PATHMUSTEXIST | OFN_ENABLEHOOK;
+ ofn->lpstrDefExt = NULL;
+ ofn->lpfnHook = save_as_statstree_hook_proc;
+ ofn->lpTemplateName = _T("WIRESHARK_SAVEASSTATSTREENAME_TEMPLATE");
+
+ gsfn_ok = GetSaveFileName(ofn);
+
+ if (gsfn_ok) {
+ g_string_printf(file_name, "%s", utf_16to8(file_name16));
+ /* What file format was specified? */
+ *file_type = ofn->nFilterIndex - 1;
+ }
+
+ g_sf_hwnd = NULL;
+ g_free( (void *) ofn);
+ return gsfn_ok;
+}
+
+
gboolean
win32_export_specified_packets_file(HWND h_wnd, capture_file *cf,
GString *file_name,
@@ -1705,6 +1772,26 @@ save_as_file_hook_proc(HWND sf_hwnd, UINT msg, WPARAM w_param, LPARAM l_param) {
return 0;
}
+static UINT_PTR CALLBACK
+save_as_statstree_hook_proc(HWND sf_hwnd, UINT msg, WPARAM w_param, LPARAM l_param) {
+
+ switch(msg) {
+ case WM_INITDIALOG:
+ g_sf_hwnd = sf_hwnd;
+ break;
+
+ case WM_COMMAND:
+ break;
+
+ case WM_NOTIFY:
+ break;
+
+ default:
+ break;
+ }
+ return 0;
+}
+
#define RANGE_TEXT_MAX 128
static UINT_PTR CALLBACK
export_specified_packets_file_hook_proc(HWND sf_hwnd, UINT msg, WPARAM w_param, LPARAM l_param) {
diff --git a/ui/win32/file_dlg_win32.h b/ui/win32/file_dlg_win32.h
index a317f49d9e..94662ee6e6 100644
--- a/ui/win32/file_dlg_win32.h
+++ b/ui/win32/file_dlg_win32.h
@@ -122,6 +122,17 @@ void win32_export_color_file(HWND h_wnd, capture_file *cf, gpointer filter_list)
*/
void win32_import_color_file(HWND h_wnd, gpointer color_filters);
+/** Open the "Save As" dialog box for stats_tree statistics window.
+ *
+ * @param h_wnd HWND of the parent window.
+ * @param file_name File name. May be empty.
+ * @param file_type stats_tree file type.
+ *
+ * @return FALSE if the dialog was cancelled
+ */
+gboolean win32_save_as_statstree(HWND h_wnd, GString *file_name,
+ int *file_type);
+
void file_set_save_marked_sensitive();
/* Open dialog defines */