3 * Some content from gtk/help_dlg.c by Laurent Deniel <laurent.deniel@free.fr>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 2000 Gerald Combs
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
31 #include "wsutil/filesystem.h"
36 #include <wsutil/unicode-utils.h>
40 * Given a filename return a filesystem URL. Relative paths are prefixed with
41 * the datafile directory path.
44 data_file_url(const gchar *filename)
51 if((strlen(filename) > 2) && (filename[1] == ':')) {
52 file_path = g_strdup(filename);
54 if((strlen(filename) > 1) && (filename[0] == '/')) {
55 file_path = g_strdup(filename);
57 } else if(running_in_build_directory()) {
58 file_path = g_strdup_printf("%s/doc/%s", get_datafile_dir(), filename);
60 file_path = g_strdup_printf("%s/%s", get_datafile_dir(), filename);
63 /* XXX - check, if the file is really existing, otherwise display a simple_dialog about the problem */
65 /* convert filename to uri */
66 uri = g_filename_to_uri(file_path, NULL, NULL);
72 topic_online_url(topic_action_e action)
75 case(ONLINEPAGE_HOME):
76 return "https://www.wireshark.org";
78 case(ONLINEPAGE_WIKI):
79 return "https://wiki.wireshark.org";
81 case(ONLINEPAGE_DOWNLOAD):
82 return "https://www.wireshark.org/download.html";
84 case(ONLINEPAGE_USERGUIDE):
85 return "https://www.wireshark.org/docs/wsug_html_chunked/";
88 return "http://www.wireshark.org/faq.html";
91 return "https://ask.wireshark.org";
93 case(ONLINEPAGE_SAMPLE_FILES):
94 return "https://wiki.wireshark.org/SampleCaptures";
96 case(ONLINEPAGE_CAPTURE_SETUP):
97 return "https://wiki.wireshark.org/CaptureSetup";
99 case(ONLINEPAGE_NETWORK_MEDIA):
100 return "https://wiki.wireshark.org/CaptureSetup/NetworkMedia";
102 case(ONLINEPAGE_SAMPLE_CAPTURES):
103 return "https://wiki.wireshark.org/SampleCaptures";
105 case(ONLINEPAGE_SECURITY):
106 return "https://wiki.wireshark.org/Security";
108 case(ONLINEPAGE_CHIMNEY):
109 return "https://wiki.wireshark.org/CaptureSetup/Offloading#chimney";
117 * Open the help dialog and show a specific HTML help page.
120 user_guide_url(const gchar *page) {
121 GString *url = g_string_new("");
124 * Try to open local .chm file. This is not the most intuitive way to
125 * go about this but it fits in with the rest of the _url functions.
130 g_string_printf(url, "%s\\user-guide.chm::/wsug_chm/%s>Wireshark Help",
131 get_datafile_dir(), page);
135 HH_DISPLAY_TOPIC, 0);
137 /* if the .chm file could be opened, stop here */
139 g_string_free(url, TRUE /* free_segment */);
145 if (g_file_test(DOC_DIR "/guides/wsug_html_chunked", G_FILE_TEST_IS_DIR)) {
146 /* try to open the HTML page from wireshark.org instead */
147 g_string_printf(url, "file://" DOC_DIR "/guides/wsug_html_chunked/%s", page);
149 #endif /* ifdef DOC_DIR */
150 /* try to open the HTML page from wireshark.org instead */
151 g_string_printf(url, "https://www.wireshark.org/docs/wsug_html_chunked/%s", page);
154 #endif /* ifdef DOC_DIR */
157 return g_string_free(url, FALSE);
161 topic_action_url(topic_action_e action)
165 /* pages online at www.wireshark.org */
166 url = g_strdup(topic_online_url(action));
172 /* local manual pages */
173 case(LOCALPAGE_MAN_WIRESHARK):
174 url = data_file_url("wireshark.html");
176 case(LOCALPAGE_MAN_WIRESHARK_FILTER):
177 url = data_file_url("wireshark-filter.html");
179 case(LOCALPAGE_MAN_CAPINFOS):
180 url = data_file_url("capinfos.html");
182 case(LOCALPAGE_MAN_DUMPCAP):
183 url = data_file_url("dumpcap.html");
185 case(LOCALPAGE_MAN_EDITCAP):
186 url = data_file_url("editcap.html");
188 case(LOCALPAGE_MAN_MERGECAP):
189 url = data_file_url("mergecap.html");
191 case(LOCALPAGE_MAN_RAWSHARK):
192 url = data_file_url("rawshark.html");
194 case(LOCALPAGE_MAN_REORDERCAP):
195 url = data_file_url("reordercap.html");
197 case(LOCALPAGE_MAN_TEXT2PCAP):
198 url = data_file_url("text2pcap.html");
200 case(LOCALPAGE_MAN_TSHARK):
201 url = data_file_url("tshark.html");
204 /* local help pages (User's Guide) */
206 url = user_guide_url( "index.html");
208 case(HELP_CAPTURE_OPTIONS_DIALOG):
209 url = user_guide_url("ChCapCaptureOptions.html");
211 case(HELP_CAPTURE_FILTERS_DIALOG):
212 url = user_guide_url("ChWorkDefineFilterSection.html");
214 case(HELP_DISPLAY_FILTERS_DIALOG):
215 url = user_guide_url("ChWorkDefineFilterSection.html");
217 case(HELP_FILTER_EXPRESSION_DIALOG):
218 url = user_guide_url("ChWorkFilterAddExpressionSection.html");
220 case(HELP_COLORING_RULES_DIALOG):
221 url = user_guide_url("ChCustColorizationSection.html");
223 case(HELP_CONFIG_PROFILES_DIALOG):
224 url = user_guide_url("ChCustConfigProfilesSection.html");
226 case (HELP_MANUAL_ADDR_RESOLVE_DIALOG):
227 url = user_guide_url("ChManualAddressResolveSection.html");
229 case(HELP_PRINT_DIALOG):
230 url = user_guide_url("ChIOPrintSection.html");
232 case(HELP_FIND_DIALOG):
233 url = user_guide_url("ChWorkFindPacketSection.html");
235 case(HELP_FIREWALL_DIALOG):
236 url = user_guide_url("ChUseToolsMenuSection.html");
238 case(HELP_GOTO_DIALOG):
239 url = user_guide_url("ChWorkGoToPacketSection.html");
241 case(HELP_CAPTURE_INTERFACES_DIALOG):
242 url = user_guide_url("ChCapInterfaceSection.html");
244 case(HELP_CAPTURE_INFO_DIALOG):
245 url = user_guide_url("ChCapRunningSection.html");
247 case(HELP_CAPTURE_MANAGE_INTERFACES_DIALOG):
248 url = user_guide_url("ChCapManageInterfacesSection.html");
250 case(HELP_ENABLED_PROTOCOLS_DIALOG):
251 url = user_guide_url("ChCustProtocolDissectionSection.html");
253 case(HELP_ENABLED_HEURISTICS_DIALOG):
254 url = user_guide_url("ChCustProtocolDissectionSection.html");
256 case(HELP_DECODE_AS_DIALOG):
257 url = user_guide_url("ChCustProtocolDissectionSection.html");
259 case(HELP_DECODE_AS_SHOW_DIALOG):
260 url = user_guide_url("ChCustProtocolDissectionSection.html");
262 case(HELP_FOLLOW_STREAM_DIALOG):
263 url = user_guide_url("ChAdvFollowTCPSection.html");
265 case(HELP_EXPERT_INFO_DIALOG):
266 url = user_guide_url("ChAdvExpert.html");
268 case(HELP_EXTCAP_OPTIONS_DIALOG):
269 url = user_guide_url("ChExtcapOptions.html");
271 case(HELP_STATS_SUMMARY_DIALOG):
272 url = user_guide_url("ChStatSummary.html");
274 case(HELP_STATS_PROTO_HIERARCHY_DIALOG):
275 url = user_guide_url("ChStatHierarchy.html");
277 case(HELP_STATS_ENDPOINTS_DIALOG):
278 url = user_guide_url("ChStatEndpoints.html");
280 case(HELP_STATS_CONVERSATIONS_DIALOG):
281 url = user_guide_url("ChStatConversations.html");
283 case(HELP_STATS_IO_GRAPH_DIALOG):
284 url = user_guide_url("ChStatIOGraphs.html");
286 case(HELP_STATS_COMPARE_FILES_DIALOG):
287 url = user_guide_url("ChStatCompareCaptureFiles.html");
289 case(HELP_STATS_LTE_MAC_TRAFFIC_DIALOG):
290 url = user_guide_url("ChTelLTEMACTraffic.html");
292 case(HELP_STATS_LTE_RLC_TRAFFIC_DIALOG):
293 url = user_guide_url("ChTelLTERLCTraffic.html");
295 case(HELP_STATS_WLAN_TRAFFIC_DIALOG):
296 url = user_guide_url("ChStatWLANTraffic.html");
298 case(HELP_FILESET_DIALOG):
299 url = user_guide_url("ChIOFileSetSection.html");
301 case(HELP_CAPTURE_INTERFACE_OPTIONS_DIALOG):
302 url = user_guide_url("ChCustPreferencesSection.html#ChCustInterfaceOptionsSection");
304 case(HELP_CAPTURE_INTERFACES_DETAILS_DIALOG):
305 url = user_guide_url("ChCapInterfaceDetailsSection.html");
307 case(HELP_PREFERENCES_DIALOG):
308 url = user_guide_url("ChCustPreferencesSection.html");
310 case(HELP_EXPORT_FILE_DIALOG):
311 case(HELP_EXPORT_FILE_WIN32_DIALOG):
312 url = user_guide_url("ChIOExportSection.html");
314 case(HELP_EXPORT_BYTES_DIALOG):
315 case(HELP_EXPORT_BYTES_WIN32_DIALOG):
316 url = user_guide_url("ChIOExportSection.html#ChIOExportSelectedDialog");
318 case(HELP_EXPORT_OBJECT_LIST):
319 url = user_guide_url("ChIOExportSection.html#ChIOExportObjectsDialog");
321 case(HELP_OPEN_DIALOG):
322 case(HELP_OPEN_WIN32_DIALOG):
323 url = user_guide_url("ChIOOpenSection.html");
325 case(HELP_MERGE_DIALOG):
326 case(HELP_MERGE_WIN32_DIALOG):
327 url = user_guide_url("ChIOMergeSection.html");
329 case(HELP_IMPORT_DIALOG):
330 url = user_guide_url("ChIOImportSection.html");
332 case(HELP_SAVE_DIALOG):
333 case(HELP_SAVE_WIN32_DIALOG):
334 url = user_guide_url("ChIOSaveSection.html");
336 case(HELP_TIME_SHIFT_DIALOG):
337 url = user_guide_url("ChWorkShiftTimePacketSection.html");
339 case(HELP_FILTER_SAVE_DIALOG):
340 url = user_guide_url("ChWorkFilterSaveSection.html");
342 case(HELP_TELEPHONY_VOIP_CALLS_DIALOG):
343 url = user_guide_url("ChTelVoipCalls.html");
345 case(HELP_RTP_ANALYSIS_DIALOG):
346 url = user_guide_url("ChTelRTPAnalysis.html");
348 case(HELP_NEW_PACKET_DIALOG):
349 url = user_guide_url("ChapterWork.html#ChWorkPacketSepView");
351 case(HELP_IAX2_ANALYSIS_DIALOG):
352 url = user_guide_url("ChTelIAX2Analysis.html");
354 case(HELP_TELEPHONY_RTP_PLAYER_DIALOG):
355 url = user_guide_url("ChTelRtpPlayer.html");
358 case(TOPIC_ACTION_NONE):
360 g_assert_not_reached();
372 * indent-tabs-mode: nil
375 * ex: set shiftwidth=4 tabstop=8 expandtab:
376 * :indentSize=4:tabSize=8:noTabs=true: