wireshark/ui/help_url.c

301 lines
9.6 KiB
C
Raw Normal View History

/* help_url.c
*
* Some content from gtk/help_dlg.c by Laurent Deniel <laurent.deniel@free.fr>
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 2000 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "config.h"
#include <string.h>
#include <glib.h>
#include "help_url.h"
#include "urls.h"
#include "wsutil/filesystem.h"
2021-06-18 18:21:42 +00:00
#include <wsutil/ws_assert.h>
// To do:
// - Automatically generate part or all of this, e.g. by parsing
// the DocBook XML or the chunked HTML.
/*
* Open the help dialog and show a specific HTML help page.
*/
gchar *
user_guide_url(const gchar *page) {
GString *url = g_string_new("");
#if defined(_WIN32)
/*
* The User's Guide is in a directory named "Wireshark User's Guide" in
* the program directory.
*/
GString *ug_dir = g_string_new("");
g_string_printf(ug_dir, "%s\\Wireshark User's Guide", get_datafile_dir());
if (g_file_test(ug_dir->str, G_FILE_TEST_IS_DIR)) {
g_string_printf(url, "file:///%s/%s", ug_dir->str, page);
}
g_string_free(ug_dir, TRUE);
#elif defined(DOC_DIR)
if (g_file_test(DOC_DIR "/guides/wsug_html_chunked", G_FILE_TEST_IS_DIR)) {
/* try to open the HTML page from wireshark.org instead */
g_string_printf(url, "file://" DOC_DIR "/guides/wsug_html_chunked/%s", page);
}
#endif /* _WIN32 / DOC_DIR */
/* Fall back to wireshark.org. */
if (url->len == 0) {
g_string_printf(url, WS_DOCS_URL "wsug_html_chunked/%s", page);
}
return g_string_free(url, FALSE);
}
gchar *
topic_action_url(topic_action_e action)
{
gchar *url;
switch(action) {
/* pages online at www.wireshark.org */
case(ONLINEPAGE_HOME):
url = g_strdup(WS_HOME_PAGE_URL);
break;
case(ONLINEPAGE_WIKI):
url = g_strdup(WS_WIKI_HOME_URL);
break;
case(ONLINEPAGE_DOWNLOAD):
url = g_strdup(WS_DOWNLOAD_URL);
break;
case(ONLINEPAGE_DOCS):
url = g_strdup(WS_DOCS_URL);
break;
case(ONLINEPAGE_USERGUIDE):
url = g_strdup(WS_DOCS_URL "wsug_html_chunked/");
break;
case(ONLINEPAGE_FAQ):
url = g_strdup(WS_FAQ_URL);
break;
case(ONLINEPAGE_ASK):
url = g_strdup(WS_Q_AND_A_URL);
break;
case(ONLINEPAGE_SAMPLE_FILES):
url = g_strdup(WS_WIKI_URL("SampleCaptures"));
break;
case(ONLINEPAGE_CAPTURE_SETUP):
url = g_strdup(WS_WIKI_URL("CaptureSetup"));
break;
case(ONLINEPAGE_NETWORK_MEDIA):
url = g_strdup(WS_WIKI_URL("CaptureSetup/NetworkMedia"));
break;
case(ONLINEPAGE_SAMPLE_CAPTURES):
url = g_strdup(WS_WIKI_URL("SampleCaptures"));
break;
case(ONLINEPAGE_SECURITY):
url = g_strdup(WS_WIKI_URL("Security"));
break;
case(ONLINEPAGE_CHIMNEY):
url = g_strdup(WS_WIKI_URL("CaptureSetup/Offloading#chimney"));
break;
/* local manual pages */
case(LOCALPAGE_MAN_WIRESHARK):
url = data_file_url("wireshark.html");
break;
case(LOCALPAGE_MAN_WIRESHARK_FILTER):
url = data_file_url("wireshark-filter.html");
break;
case(LOCALPAGE_MAN_CAPINFOS):
url = data_file_url("capinfos.html");
break;
case(LOCALPAGE_MAN_DUMPCAP):
url = data_file_url("dumpcap.html");
break;
case(LOCALPAGE_MAN_EDITCAP):
url = data_file_url("editcap.html");
break;
case(LOCALPAGE_MAN_MERGECAP):
url = data_file_url("mergecap.html");
break;
case(LOCALPAGE_MAN_RAWSHARK):
url = data_file_url("rawshark.html");
break;
case(LOCALPAGE_MAN_REORDERCAP):
url = data_file_url("reordercap.html");
break;
case(LOCALPAGE_MAN_TEXT2PCAP):
url = data_file_url("text2pcap.html");
break;
case(LOCALPAGE_MAN_TSHARK):
url = data_file_url("tshark.html");
break;
/* local help pages (User's Guide) */
case(HELP_CONTENT):
url = user_guide_url( "index.html");
break;
case(HELP_CAPTURE_OPTIONS):
url = user_guide_url("ChCapCaptureOptions.html");
break;
case(HELP_CAPTURE_FILTERS_DIALOG):
url = user_guide_url("ChWorkDefineFilterSection.html");
break;
case(HELP_DISPLAY_FILTERS_DIALOG):
url = user_guide_url("ChWorkDefineFilterSection.html");
break;
case(HELP_FILTER_EXPRESSION_DIALOG):
url = user_guide_url("ChWorkFilterAddExpressionSection.html");
break;
case(HELP_COLORING_RULES_DIALOG):
url = user_guide_url("ChCustColorizationSection.html");
break;
case(HELP_CONFIG_PROFILES_DIALOG):
url = user_guide_url("ChCustConfigProfilesSection.html");
break;
case(HELP_PRINT_DIALOG):
url = user_guide_url("ChIOPrintSection.html");
break;
case(HELP_FIND_DIALOG):
url = user_guide_url("ChWorkFindPacketSection.html");
break;
case(HELP_FIREWALL_DIALOG):
url = user_guide_url("ChUseToolsMenuSection.html");
break;
case(HELP_GOTO_DIALOG):
url = user_guide_url("ChWorkGoToPacketSection.html");
break;
case(HELP_CAPTURE_OPTIONS_DIALOG):
url = user_guide_url("ChCapCaptureOptions.html");
break;
case(HELP_CAPTURE_INFO_DIALOG):
url = user_guide_url("ChCapRunningSection.html");
break;
Qt: Rework the "Manage Interfaces" dialog. Convert QTableWidget to QTreeWidget. It looks like the GTK+ version has a separate set of apply/save buttons for each tab which *only* operates on that tab. This can result unexpected behavior which throws away changes if the user updates more than one tab. Use a single "OK" button that applies all of our changes instead. Reorder the tabs. Put Local Interfaces first and select it by default. Always show Remote Interfaces. Disable it on platforms that don't have PCAP_REMOTE. Automatically start editing when we add a new pipe. Don't immediately update pipe interface settings. Wait until we hit "OK" instead. Rename NewFileDelegate to PathChooserDelegate. Note that we might want to move it use it elsewhere in the application. Try switching the user-facing terminology from "Hide" to the more positive "Show". Tell the user that we don't save pipe or remote interface settings. Add a help URL for the "Manage Interfaces" dialog box. Use the GLib and Qt string functions and classes to split and join comma-separated preferences. This makes sure capture_dev_user_descr_find doesn't skip over the first interface. It also keeps the Qt code from adding a leading comma to our capture preferences. Add a note about strings to README.qt. Summary: Use QStrings. For another day: - If we *do* save remote settings we need to store credentials securely, e.g. with CryptProtectData. - Get rid of the remote settings dialogs. Their controls should fit in the remote settings tab. - Add an extcap tab. - We need getter/setter functions for global_capture_opts.all_ifaces. We iterate over it *way* too much. Change-Id: Ib7b61972f3ece4325e0230f725e7f2678acbb24b Reviewed-on: https://code.wireshark.org/review/3873 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-08-14 20:20:09 +00:00
case(HELP_CAPTURE_MANAGE_INTERFACES_DIALOG):
url = user_guide_url("ChCapManageInterfacesSection.html");
break;
case(HELP_ENABLED_PROTOCOLS_DIALOG):
url = user_guide_url("ChCustProtocolDissectionSection.html");
break;
case(HELP_ENABLED_HEURISTICS_DIALOG):
url = user_guide_url("ChCustProtocolDissectionSection.html");
break;
case(HELP_DECODE_AS_DIALOG):
url = user_guide_url("ChCustProtocolDissectionSection.html");
break;
case(HELP_DECODE_AS_SHOW_DIALOG):
url = user_guide_url("ChCustProtocolDissectionSection.html");
break;
case(HELP_FOLLOW_STREAM_DIALOG):
url = user_guide_url("ChAdvFollowStreamSection.html");
break;
case(HELP_SHOW_PACKET_BYTES_DIALOG):
url = user_guide_url("ChAdvShowPacketBytes.html");
break;
case(HELP_EXPERT_INFO_DIALOG):
url = user_guide_url("ChAdvExpert.html");
break;
case(HELP_EXTCAP_OPTIONS_DIALOG):
url = data_file_url("extcap.html");
break;
case(HELP_STATS_SUMMARY_DIALOG):
url = user_guide_url("ChStatSummary.html");
break;
case(HELP_STATS_PROTO_HIERARCHY_DIALOG):
url = user_guide_url("ChStatHierarchy.html");
break;
case(HELP_STATS_ENDPOINTS_DIALOG):
url = user_guide_url("ChStatEndpoints.html");
break;
case(HELP_STATS_CONVERSATIONS_DIALOG):
url = user_guide_url("ChStatConversations.html");
break;
case(HELP_STATS_IO_GRAPH_DIALOG):
url = user_guide_url("ChStatIOGraphs.html");
break;
case(HELP_STATS_LTE_MAC_TRAFFIC_DIALOG):
url = user_guide_url("ChTelLTEMACTraffic.html");
break;
case(HELP_STATS_LTE_RLC_TRAFFIC_DIALOG):
url = user_guide_url("ChTelLTERLCTraffic.html");
break;
case(HELP_STATS_TCP_STREAM_GRAPHS_DIALOG):
url = user_guide_url("ChStatTCPStreamGraphs.html");
break;
case(HELP_STATS_WLAN_TRAFFIC_DIALOG):
url = user_guide_url("ChStatWLANTraffic.html");
break;
case(HELP_FILESET_DIALOG):
url = user_guide_url("ChIOFileSetSection.html");
break;
case(HELP_CAPTURE_INTERFACE_OPTIONS_DIALOG):
url = user_guide_url("ChCustPreferencesSection.html#ChCustInterfaceOptionsSection");
break;
case(HELP_PREFERENCES_DIALOG):
url = user_guide_url("ChCustPreferencesSection.html");
break;
case(HELP_EXPORT_FILE_DIALOG):
case(HELP_EXPORT_FILE_WIN32_DIALOG):
url = user_guide_url("ChIOExportSection.html");
break;
case(HELP_EXPORT_BYTES_DIALOG):
url = user_guide_url("ChIOExportSection.html#ChIOExportSelectedDialog");
break;
case(HELP_EXPORT_OBJECT_LIST):
url = user_guide_url("ChIOExportSection.html#ChIOExportObjectsDialog");
break;
case(HELP_OPEN_DIALOG):
case(HELP_OPEN_WIN32_DIALOG):
url = user_guide_url("ChIOOpenSection.html");
break;
case(HELP_MERGE_DIALOG):
case(HELP_MERGE_WIN32_DIALOG):
url = user_guide_url("ChIOMergeSection.html");
break;
case(HELP_IMPORT_DIALOG):
url = user_guide_url("ChIOImportSection.html");
break;
case(HELP_SAVE_DIALOG):
case(HELP_SAVE_WIN32_DIALOG):
url = user_guide_url("ChIOSaveSection.html");
break;
case(HELP_TIME_SHIFT_DIALOG):
url = user_guide_url("ChWorkShiftTimePacketSection.html");
break;
case(HELP_TELEPHONY_VOIP_CALLS_DIALOG):
url = user_guide_url("ChTelVoipCalls.html");
break;
case(HELP_TELEPHONY_RTP_ANALYSIS_DIALOG):
url = user_guide_url("ChTelRTPAnalysis.html");
break;
case(HELP_TELEPHONY_RTP_STREAMS_DIALOG):
url = user_guide_url("ChTelRTPStreams.html");
break;
case(HELP_NEW_PACKET_DIALOG):
url = user_guide_url("ChapterWork.html#ChWorkPacketSepView");
break;
case(HELP_IAX2_ANALYSIS_DIALOG):
url = user_guide_url("ChTelIAX2Analysis.html");
break;
Qt: Initial RTP playback. Note the "initial". This is woefully incomplete. See the "to do" lists below and in the code. This differs a bit from the GTK+ version in that you specify one or more streams to be decoded. Instead of showing waveforms in individual widgets, add them all to a single QCustomPlot. This conserves screen real estate and lets us more easily take advantage of the QCP API. It also looks better IMHO. Change a bunch of checks for QtMultimediaWidgets to QtMultimedia. We probably won't use the widgets until we make 5.0 our minimum Qt version and plain old QtMultimedia lets us support Qt 4 more easily (in theory at least). Add resampling code from libspeex. I initially used this to resample each packet to match the preferred rate of our output device, but this resulted in poorer audio quality than expected. Leave it in and use to create visual samples for QCP and to match rates any time the rate changes. The latter is currently untested. Add some debugging macros. Note that both the RTP player and RTP analysis dialogs decode audio data using different code. Note that voip_calls_packet and voip_calls_init_tap appear to be dead code. To do: - Add silence frames where needed. - Implement the jitter buffer. - Implement the playback timing controls. - Tapping / scanning streams might be too slow. Change-Id: I20dd3b66d3df53c9b1f3501262dc01458849f6b4 Bug: 9007 Reviewed-on: https://code.wireshark.org/review/10458 Petri-Dish: Gerald Combs <gerald@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-12-13 00:51:40 +00:00
case(HELP_TELEPHONY_RTP_PLAYER_DIALOG):
url = user_guide_url("ChTelRtpPlayer.html");
break;
case(HELP_STAT_FLOW_GRAPH):
url = user_guide_url("ChStatFlowGraph.html");
break;
Qt: Initial RTP playback. Note the "initial". This is woefully incomplete. See the "to do" lists below and in the code. This differs a bit from the GTK+ version in that you specify one or more streams to be decoded. Instead of showing waveforms in individual widgets, add them all to a single QCustomPlot. This conserves screen real estate and lets us more easily take advantage of the QCP API. It also looks better IMHO. Change a bunch of checks for QtMultimediaWidgets to QtMultimedia. We probably won't use the widgets until we make 5.0 our minimum Qt version and plain old QtMultimedia lets us support Qt 4 more easily (in theory at least). Add resampling code from libspeex. I initially used this to resample each packet to match the preferred rate of our output device, but this resulted in poorer audio quality than expected. Leave it in and use to create visual samples for QCP and to match rates any time the rate changes. The latter is currently untested. Add some debugging macros. Note that both the RTP player and RTP analysis dialogs decode audio data using different code. Note that voip_calls_packet and voip_calls_init_tap appear to be dead code. To do: - Add silence frames where needed. - Implement the jitter buffer. - Implement the playback timing controls. - Tapping / scanning streams might be too slow. Change-Id: I20dd3b66d3df53c9b1f3501262dc01458849f6b4 Bug: 9007 Reviewed-on: https://code.wireshark.org/review/10458 Petri-Dish: Gerald Combs <gerald@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-12-13 00:51:40 +00:00
case(TOPIC_ACTION_NONE):
default:
url = g_strdup(WS_HOME_PAGE_URL);
ws_assert_not_reached();
}
return url;
}