5 * Some content from gtk/help_dlg.c by Laurent Deniel <laurent.deniel@free.fr>
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 2000 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
33 #include "epan/filesystem.h"
38 #include <wsutil/unicode-utils.h>
42 * Given a filename return a filesystem URL. Relative paths are prefixed with
43 * the datafile directory path.
46 data_file_url(const gchar
*filename
)
53 if((strlen(filename
) > 2) && (filename
[1] == ':')) {
54 file_path
= g_strdup(filename
);
56 if((strlen(filename
) > 1) && (filename
[0] == '/')) {
57 file_path
= g_strdup(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 "http://www.wireshark.org";
78 case(ONLINEPAGE_WIKI
):
79 return "http://wiki.wireshark.org";
81 case(ONLINEPAGE_DOWNLOAD
):
82 return "http://www.wireshark.org/download.html";
84 case(ONLINEPAGE_USERGUIDE
):
85 return "http://www.wireshark.org/docs/wsug_html_chunked/";
88 return "http://www.wireshark.org/faq.html";
91 return "http://ask.wireshark.org";
93 case(ONLINEPAGE_SAMPLE_FILES
):
94 return "http://wiki.wireshark.org/SampleCaptures";
96 case(ONLINEPAGE_CAPTURE_SETUP
):
97 return "http://wiki.wireshark.org/CaptureSetup";
99 case(ONLINEPAGE_NETWORK_MEDIA
):
100 return "http://wiki.wireshark.org/CaptureSetup/NetworkMedia";
102 case(ONLINEPAGE_SAMPLE_CAPTURES
):
103 return "http://wiki.wireshark.org/SampleCaptures";
105 case(ONLINEPAGE_SECURITY
):
106 return "http://wiki.wireshark.org/Security";
108 case(ONLINEPAGE_CHIMNEY
):
109 return "http://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("");
122 gchar
*ug_url
= NULL
;
125 * Try to open local .chm file. This is not the most intuitive way to
126 * go about this but it fits in with the rest of the _url functions.
131 g_string_printf(url
, "%s\\user-guide.chm::/wsug_chm/%s>Wireshark Help",
132 get_datafile_dir(), page
);
136 HH_DISPLAY_TOPIC
, 0);
138 /* if the .chm file could be opened, stop here */
140 g_string_free(url
, TRUE
/* free_segment */);
146 if (g_file_test(DOC_DIR
"/guides/wsug_html_chunked", G_FILE_TEST_IS_DIR
)) {
147 /* try to open the HTML page from wireshark.org instead */
148 g_string_printf(url
, "file://" DOC_DIR
"/guides/wsug_html_chunked/%s", page
);
150 #endif /* ifdef DOC_DIR */
151 /* try to open the HTML page from wireshark.org instead */
152 g_string_printf(url
, "http://www.wireshark.org/docs/wsug_html_chunked/%s", page
);
155 #endif /* ifdef DOC_DIR */
159 g_string_free(url
, FALSE
);
164 topic_action_url(topic_action_e action
)
168 /* pages online at www.wireshark.org */
169 url
= g_strdup(topic_online_url(action
));
175 /* local manual pages */
176 case(LOCALPAGE_MAN_WIRESHARK
):
177 url
= data_file_url("wireshark.html");
179 case(LOCALPAGE_MAN_WIRESHARK_FILTER
):
180 url
= data_file_url("wireshark-filter.html");
182 case(LOCALPAGE_MAN_CAPINFOS
):
183 url
= data_file_url("capinfos.html");
185 case(LOCALPAGE_MAN_DUMPCAP
):
186 url
= data_file_url("dumpcap.html");
188 case(LOCALPAGE_MAN_EDITCAP
):
189 url
= data_file_url("editcap.html");
191 case(LOCALPAGE_MAN_MERGECAP
):
192 url
= data_file_url("mergecap.html");
194 case(LOCALPAGE_MAN_RAWSHARK
):
195 url
= data_file_url("rawshark.html");
197 case(LOCALPAGE_MAN_REORDERCAP
):
198 url
= data_file_url("reordercap.html");
200 case(LOCALPAGE_MAN_TEXT2PCAP
):
201 url
= data_file_url("text2pcap.html");
203 case(LOCALPAGE_MAN_TSHARK
):
204 url
= data_file_url("tshark.html");
207 /* local help pages (User's Guide) */
209 url
= user_guide_url( "index.html");
211 case(HELP_CAPTURE_OPTIONS_DIALOG
):
212 url
= user_guide_url("ChCapCaptureOptions.html");
214 case(HELP_CAPTURE_FILTERS_DIALOG
):
215 url
= user_guide_url("ChWorkDefineFilterSection.html");
217 case(HELP_DISPLAY_FILTERS_DIALOG
):
218 url
= user_guide_url("ChWorkDefineFilterSection.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_ENABLED_PROTOCOLS_DIALOG
):
248 url
= user_guide_url("ChCustProtocolDissectionSection.html");
250 case(HELP_DECODE_AS_DIALOG
):
251 url
= user_guide_url("ChCustProtocolDissectionSection.html");
253 case(HELP_DECODE_AS_SHOW_DIALOG
):
254 url
= user_guide_url("ChCustProtocolDissectionSection.html");
256 case(HELP_FOLLOW_STREAM_DIALOG
):
257 url
= user_guide_url("ChAdvFollowTCPSection.html");
259 case(HELP_EXPERT_INFO_DIALOG
):
260 url
= user_guide_url("ChAdvExpert.html");
262 case(HELP_STATS_SUMMARY_DIALOG
):
263 url
= user_guide_url("ChStatSummary.html");
265 case(HELP_STATS_PROTO_HIERARCHY_DIALOG
):
266 url
= user_guide_url("ChStatHierarchy.html");
268 case(HELP_STATS_ENDPOINTS_DIALOG
):
269 url
= user_guide_url("ChStatEndpoints.html");
271 case(HELP_STATS_CONVERSATIONS_DIALOG
):
272 url
= user_guide_url("ChStatConversations.html");
274 case(HELP_STATS_IO_GRAPH_DIALOG
):
275 url
= user_guide_url("ChStatIOGraphs.html");
277 case(HELP_STATS_COMPARE_FILES_DIALOG
):
278 url
= user_guide_url("ChStatCompareCaptureFiles.html");
280 case(HELP_STATS_LTE_MAC_TRAFFIC_DIALOG
):
281 url
= user_guide_url("ChTelLTEMACTraffic.html");
283 case(HELP_STATS_LTE_RLC_TRAFFIC_DIALOG
):
284 url
= user_guide_url("ChTelLTERLCTraffic.html");
286 case(HELP_STATS_WLAN_TRAFFIC_DIALOG
):
287 url
= user_guide_url("ChStatWLANTraffic.html");
289 case(HELP_FILESET_DIALOG
):
290 url
= user_guide_url("ChIOFileSetSection.html");
292 case(HELP_CAPTURE_INTERFACE_OPTIONS_DIALOG
):
293 url
= user_guide_url("ChCustPreferencesSection.html#ChCustInterfaceOptionsSection");
295 case(HELP_CAPTURE_INTERFACES_DETAILS_DIALOG
):
296 url
= user_guide_url("ChCapInterfaceDetailsSection.html");
298 case(HELP_PREFERENCES_DIALOG
):
299 url
= user_guide_url("ChCustPreferencesSection.html");
301 case(HELP_EXPORT_FILE_DIALOG
):
302 case(HELP_EXPORT_FILE_WIN32_DIALOG
):
303 url
= user_guide_url("ChIOExportSection.html");
305 case(HELP_EXPORT_BYTES_DIALOG
):
306 case(HELP_EXPORT_BYTES_WIN32_DIALOG
):
307 url
= user_guide_url("ChIOExportSection.html#ChIOExportSelectedDialog");
309 case(HELP_EXPORT_OBJECT_LIST
):
310 url
= user_guide_url("ChIOExportSection.html#ChIOExportObjectsDialog");
312 case(HELP_OPEN_DIALOG
):
313 case(HELP_OPEN_WIN32_DIALOG
):
314 url
= user_guide_url("ChIOOpenSection.html");
316 case(HELP_MERGE_DIALOG
):
317 case(HELP_MERGE_WIN32_DIALOG
):
318 url
= user_guide_url("ChIOMergeSection.html");
320 case(HELP_IMPORT_DIALOG
):
321 url
= user_guide_url("ChIOImportSection.html");
323 case(HELP_SAVE_DIALOG
):
324 case(HELP_SAVE_WIN32_DIALOG
):
325 url
= user_guide_url("ChIOSaveSection.html");
327 case(HELP_TIME_SHIFT_DIALOG
):
328 url
= user_guide_url("ChWorkShiftTimePacketSection.html");
330 case(HELP_FILTER_SAVE_DIALOG
):
331 url
= user_guide_url("ChWorkFilterSaveSection.html");
334 case(TOPIC_ACTION_NONE
):
336 g_assert_not_reached();
348 * indent-tabs-mode: nil
351 * ex: set shiftwidth=4 tabstop=8 expandtab:
352 * :indentSize=4:tabSize=8:noTabs=true: