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 * SPDX-License-Identifier: GPL-2.0-or-later
20 #include "wsutil/filesystem.h"
21 #include <wsutil/ws_assert.h>
24 // - Automatically generate part or all of this, e.g. by parsing
25 // the DocBook XML or the chunked HTML.
28 * Open the help dialog and show a specific HTML help page.
31 user_guide_url(const char *page
) {
32 GString
*url
= g_string_new("");
36 * The User's Guide is in a directory named "Wireshark User's Guide" in
37 * the program directory.
40 GString
*ug_dir
= g_string_new("");
41 g_string_printf(ug_dir
, "%s\\Wireshark User's Guide", get_datafile_dir());
42 if (g_file_test(ug_dir
->str
, G_FILE_TEST_IS_DIR
)) {
43 g_string_printf(url
, "file:///%s/%s", ug_dir
->str
, page
);
45 g_string_free(ug_dir
, TRUE
);
47 char *path
= g_build_filename(get_doc_dir(), "wsug_html_chunked", page
, NULL
);
48 if (g_file_test(path
, G_FILE_TEST_IS_REGULAR
)) {
49 /* try to open the HTML page from the filesystem */
50 g_string_printf(url
, "file://%s", path
);
57 /* Fall back to wireshark.org. */
59 g_string_printf(url
, WS_DOCS_URL
"wsug_html_chunked/%s", page
);
61 return g_string_free(url
, FALSE
);
65 topic_action_url(topic_action_e action
)
70 /* pages online at www.wireshark.org */
71 case(ONLINEPAGE_HOME
):
72 url
= g_strdup(WS_HOME_PAGE_URL
);
74 case(ONLINEPAGE_WIKI
):
75 url
= g_strdup(WS_WIKI_HOME_URL
);
77 case(ONLINEPAGE_DOWNLOAD
):
78 url
= g_strdup(WS_DOWNLOAD_URL
);
80 case(ONLINEPAGE_DOCS
):
81 url
= g_strdup(WS_DOCS_URL
);
83 case(ONLINEPAGE_USERGUIDE
):
84 url
= g_strdup(WS_DOCS_URL
"wsug_html_chunked/");
87 url
= g_strdup(WS_FAQ_URL
);
90 url
= g_strdup(WS_Q_AND_A_URL
);
92 case(ONLINEPAGE_SAMPLE_FILES
):
93 url
= g_strdup(WS_WIKI_URL("SampleCaptures"));
95 case(ONLINEPAGE_CAPTURE_SETUP
):
96 url
= g_strdup(WS_WIKI_URL("CaptureSetup"));
98 case(ONLINEPAGE_NETWORK_MEDIA
):
99 url
= g_strdup(WS_WIKI_URL("CaptureSetup/NetworkMedia"));
101 case(ONLINEPAGE_SAMPLE_CAPTURES
):
102 url
= g_strdup(WS_WIKI_URL("SampleCaptures"));
104 case(ONLINEPAGE_SECURITY
):
105 url
= g_strdup(WS_WIKI_URL("Security"));
107 case(ONLINEPAGE_DFILTER_REF
):
108 url
= g_strdup(WS_DOCS_URL
"dfref/");
111 /* local manual pages */
112 case(LOCALPAGE_MAN_WIRESHARK
):
113 url
= doc_file_url("wireshark.html");
115 case(LOCALPAGE_MAN_WIRESHARK_FILTER
):
116 url
= doc_file_url("wireshark-filter.html");
118 case(LOCALPAGE_MAN_CAPINFOS
):
119 url
= doc_file_url("capinfos.html");
121 case(LOCALPAGE_MAN_DUMPCAP
):
122 url
= doc_file_url("dumpcap.html");
124 case(LOCALPAGE_MAN_EDITCAP
):
125 url
= doc_file_url("editcap.html");
127 case(LOCALPAGE_MAN_MERGECAP
):
128 url
= doc_file_url("mergecap.html");
130 case(LOCALPAGE_MAN_RAWSHARK
):
131 url
= doc_file_url("rawshark.html");
133 case(LOCALPAGE_MAN_REORDERCAP
):
134 url
= doc_file_url("reordercap.html");
136 case(LOCALPAGE_MAN_TEXT2PCAP
):
137 url
= doc_file_url("text2pcap.html");
139 case(LOCALPAGE_MAN_TSHARK
):
140 url
= doc_file_url("tshark.html");
144 case(LOCALPAGE_RELEASE_NOTES
):
145 url
= doc_file_url("release-notes.html");
148 /* local help pages (User's Guide) */
150 url
= user_guide_url( "index.html");
152 case(HELP_CAPTURE_OPTIONS
):
153 url
= user_guide_url("ChCapCaptureOptions.html");
155 case(HELP_CAPTURE_FILTERS_DIALOG
):
156 url
= user_guide_url("ChWorkDefineFilterSection.html");
158 case(HELP_DISPLAY_FILTERS_DIALOG
):
159 url
= user_guide_url("ChWorkDefineFilterSection.html");
161 case(HELP_DISPLAY_MACRO_DIALOG
):
162 url
= user_guide_url("ChWorkDefineFilterMacrosSection.html");
164 case(HELP_FILTER_EXPRESSION_DIALOG
):
165 url
= user_guide_url("ChWorkFilterAddExpressionSection.html");
167 case(HELP_COLORING_RULES_DIALOG
):
168 url
= user_guide_url("ChCustColorizationSection.html");
170 case(HELP_CONFIG_PROFILES_DIALOG
):
171 url
= user_guide_url("ChCustConfigProfilesSection.html");
173 case(HELP_PRINT_DIALOG
):
174 url
= user_guide_url("ChIOPrintSection.html");
176 case(HELP_FIND_DIALOG
):
177 url
= user_guide_url("ChWorkFindPacketSection.html");
179 case(HELP_FIREWALL_DIALOG
):
180 url
= user_guide_url("ChUseToolsMenuSection.html");
182 case(HELP_GOTO_DIALOG
):
183 url
= user_guide_url("ChWorkGoToPacketSection.html");
185 case(HELP_CAPTURE_OPTIONS_DIALOG
):
186 url
= user_guide_url("ChCapCaptureOptions.html");
188 case(HELP_CAPTURE_INFO_DIALOG
):
189 url
= user_guide_url("ChCapRunningSection.html");
191 case(HELP_CAPTURE_MANAGE_INTERFACES_DIALOG
):
192 url
= user_guide_url("ChCapManageInterfacesSection.html");
194 case(HELP_ENABLED_PROTOCOLS_DIALOG
):
195 url
= user_guide_url("ChCustProtocolDissectionSection.html");
197 case(HELP_ENABLED_HEURISTICS_DIALOG
):
198 url
= user_guide_url("ChCustProtocolDissectionSection.html");
200 case(HELP_DECODE_AS_DIALOG
):
201 url
= user_guide_url("ChCustProtocolDissectionSection.html");
203 case(HELP_DECODE_AS_SHOW_DIALOG
):
204 url
= user_guide_url("ChCustProtocolDissectionSection.html");
206 case(HELP_FOLLOW_STREAM_DIALOG
):
207 url
= user_guide_url("ChAdvFollowStreamSection.html");
209 case(HELP_SHOW_PACKET_BYTES_DIALOG
):
210 url
= user_guide_url("ChAdvShowPacketBytes.html");
212 case(HELP_EXPERT_INFO_DIALOG
):
213 url
= user_guide_url("ChAdvExpert.html");
215 case(HELP_EXTCAP_OPTIONS_DIALOG
):
216 url
= doc_file_url("extcap.html");
218 case(HELP_STATS_SUMMARY_DIALOG
):
219 url
= user_guide_url("ChStatSummary.html");
221 case(HELP_STATS_PROTO_HIERARCHY_DIALOG
):
222 url
= user_guide_url("ChStatHierarchy.html");
224 case(HELP_STATS_ENDPOINTS_DIALOG
):
225 url
= user_guide_url("ChStatEndpoints.html");
227 case(HELP_STATS_CONVERSATIONS_DIALOG
):
228 url
= user_guide_url("ChStatConversations.html");
230 case(HELP_STATS_IO_GRAPH_DIALOG
):
231 url
= user_guide_url("ChStatIOGraphs.html");
233 case(HELP_STATS_LTE_MAC_TRAFFIC_DIALOG
):
234 url
= user_guide_url("ChTelLTE.html#ChTelLTEMACTraffic");
236 case(HELP_STATS_LTE_RLC_TRAFFIC_DIALOG
):
237 url
= user_guide_url("ChTelLTE.html#ChTelLTERLCTraffic");
239 case(HELP_STATS_TCP_STREAM_GRAPHS_DIALOG
):
240 url
= user_guide_url("ChStatTCPStreamGraphs.html");
242 case(HELP_STATS_WLAN_TRAFFIC_DIALOG
):
243 url
= user_guide_url("ChWirelessWLANTraffic.html");
245 case(HELP_FILESET_DIALOG
):
246 url
= user_guide_url("ChIOFileSetSection.html");
248 case(HELP_CAPTURE_INTERFACE_OPTIONS_DIALOG
):
249 url
= user_guide_url("ChCustPreferencesSection.html#ChCustInterfaceOptionsSection");
251 case(HELP_PREFERENCES_DIALOG
):
252 url
= user_guide_url("ChCustPreferencesSection.html");
254 case(HELP_EXPORT_FILE_DIALOG
):
255 case(HELP_EXPORT_FILE_WIN32_DIALOG
):
256 url
= user_guide_url("ChIOExportSection.html");
258 case(HELP_EXPORT_BYTES_DIALOG
):
259 url
= user_guide_url("ChIOExportSection.html#ChIOExportSelectedDialog");
261 case(HELP_EXPORT_PDUS_DIALOG
):
262 url
= user_guide_url("ChIOExportSection.html#ChIOExportPDUSDialog");
264 case(HELP_STRIP_HEADERS_DIALOG
):
265 url
= user_guide_url("ChIOExportSection.html#ChIOStripHeadersDialog");
267 case(HELP_EXPORT_OBJECT_LIST
):
268 url
= user_guide_url("ChIOExportSection.html#ChIOExportObjectsDialog");
270 case(HELP_OPEN_DIALOG
):
271 case(HELP_OPEN_WIN32_DIALOG
):
272 url
= user_guide_url("ChIOOpenSection.html");
274 case(HELP_MERGE_DIALOG
):
275 case(HELP_MERGE_WIN32_DIALOG
):
276 url
= user_guide_url("ChIOMergeSection.html");
278 case(HELP_IMPORT_DIALOG
):
279 url
= user_guide_url("ChIOImportSection.html");
281 case(HELP_SAVE_DIALOG
):
282 case(HELP_SAVE_WIN32_DIALOG
):
283 url
= user_guide_url("ChIOSaveSection.html");
285 case(HELP_TIME_SHIFT_DIALOG
):
286 url
= user_guide_url("ChWorkShiftTimePacketSection.html");
288 case(HELP_TELEPHONY_VOIP_CALLS_DIALOG
):
289 url
= user_guide_url("ChTelVoipCalls.html");
291 case(HELP_TELEPHONY_RTP_ANALYSIS_DIALOG
):
292 url
= user_guide_url("ChTelRTP.html#ChTelRTPAnalysis");
294 case(HELP_TELEPHONY_RTP_STREAMS_DIALOG
):
295 url
= user_guide_url("ChTelRTP.html#ChTelRTPStreams");
297 case(HELP_NEW_PACKET_DIALOG
):
298 url
= user_guide_url("ChapterWork.html#ChWorkPacketSepView");
300 case(HELP_IAX2_ANALYSIS_DIALOG
):
301 url
= user_guide_url("ChTelIAX2Analysis.html");
303 case(HELP_TELEPHONY_RTP_PLAYER_DIALOG
):
304 url
= user_guide_url("ChTelRTP.html#ChTelRtpPlayer");
306 case(HELP_STAT_FLOW_GRAPH
):
307 url
= user_guide_url("ChStatFlowGraph.html");
310 case(TOPIC_ACTION_NONE
):
312 url
= g_strdup(WS_HOME_PAGE_URL
);
313 ws_assert_not_reached();