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"));
108 /* local manual pages */
109 case(LOCALPAGE_MAN_WIRESHARK
):
110 url
= doc_file_url("wireshark.html");
112 case(LOCALPAGE_MAN_WIRESHARK_FILTER
):
113 url
= doc_file_url("wireshark-filter.html");
115 case(LOCALPAGE_MAN_CAPINFOS
):
116 url
= doc_file_url("capinfos.html");
118 case(LOCALPAGE_MAN_DUMPCAP
):
119 url
= doc_file_url("dumpcap.html");
121 case(LOCALPAGE_MAN_EDITCAP
):
122 url
= doc_file_url("editcap.html");
124 case(LOCALPAGE_MAN_MERGECAP
):
125 url
= doc_file_url("mergecap.html");
127 case(LOCALPAGE_MAN_RAWSHARK
):
128 url
= doc_file_url("rawshark.html");
130 case(LOCALPAGE_MAN_REORDERCAP
):
131 url
= doc_file_url("reordercap.html");
133 case(LOCALPAGE_MAN_TEXT2PCAP
):
134 url
= doc_file_url("text2pcap.html");
136 case(LOCALPAGE_MAN_TSHARK
):
137 url
= doc_file_url("tshark.html");
141 case(LOCALPAGE_RELEASE_NOTES
):
142 url
= doc_file_url("release-notes.html");
145 /* local help pages (User's Guide) */
147 url
= user_guide_url( "index.html");
149 case(HELP_CAPTURE_OPTIONS
):
150 url
= user_guide_url("ChCapCaptureOptions.html");
152 case(HELP_CAPTURE_FILTERS_DIALOG
):
153 url
= user_guide_url("ChWorkDefineFilterSection.html");
155 case(HELP_DISPLAY_FILTERS_DIALOG
):
156 url
= user_guide_url("ChWorkDefineFilterSection.html");
158 case(HELP_DISPLAY_MACRO_DIALOG
):
159 url
= user_guide_url("ChWorkDefineFilterMacrosSection.html");
161 case(HELP_FILTER_EXPRESSION_DIALOG
):
162 url
= user_guide_url("ChWorkFilterAddExpressionSection.html");
164 case(HELP_COLORING_RULES_DIALOG
):
165 url
= user_guide_url("ChCustColorizationSection.html");
167 case(HELP_CONFIG_PROFILES_DIALOG
):
168 url
= user_guide_url("ChCustConfigProfilesSection.html");
170 case(HELP_PRINT_DIALOG
):
171 url
= user_guide_url("ChIOPrintSection.html");
173 case(HELP_FIND_DIALOG
):
174 url
= user_guide_url("ChWorkFindPacketSection.html");
176 case(HELP_FIREWALL_DIALOG
):
177 url
= user_guide_url("ChUseToolsMenuSection.html");
179 case(HELP_GOTO_DIALOG
):
180 url
= user_guide_url("ChWorkGoToPacketSection.html");
182 case(HELP_CAPTURE_OPTIONS_DIALOG
):
183 url
= user_guide_url("ChCapCaptureOptions.html");
185 case(HELP_CAPTURE_INFO_DIALOG
):
186 url
= user_guide_url("ChCapRunningSection.html");
188 case(HELP_CAPTURE_MANAGE_INTERFACES_DIALOG
):
189 url
= user_guide_url("ChCapManageInterfacesSection.html");
191 case(HELP_ENABLED_PROTOCOLS_DIALOG
):
192 url
= user_guide_url("ChCustProtocolDissectionSection.html");
194 case(HELP_ENABLED_HEURISTICS_DIALOG
):
195 url
= user_guide_url("ChCustProtocolDissectionSection.html");
197 case(HELP_DECODE_AS_DIALOG
):
198 url
= user_guide_url("ChCustProtocolDissectionSection.html");
200 case(HELP_DECODE_AS_SHOW_DIALOG
):
201 url
= user_guide_url("ChCustProtocolDissectionSection.html");
203 case(HELP_FOLLOW_STREAM_DIALOG
):
204 url
= user_guide_url("ChAdvFollowStreamSection.html");
206 case(HELP_SHOW_PACKET_BYTES_DIALOG
):
207 url
= user_guide_url("ChAdvShowPacketBytes.html");
209 case(HELP_EXPERT_INFO_DIALOG
):
210 url
= user_guide_url("ChAdvExpert.html");
212 case(HELP_EXTCAP_OPTIONS_DIALOG
):
213 url
= doc_file_url("extcap.html");
215 case(HELP_STATS_SUMMARY_DIALOG
):
216 url
= user_guide_url("ChStatSummary.html");
218 case(HELP_STATS_PROTO_HIERARCHY_DIALOG
):
219 url
= user_guide_url("ChStatHierarchy.html");
221 case(HELP_STATS_ENDPOINTS_DIALOG
):
222 url
= user_guide_url("ChStatEndpoints.html");
224 case(HELP_STATS_CONVERSATIONS_DIALOG
):
225 url
= user_guide_url("ChStatConversations.html");
227 case(HELP_STATS_IO_GRAPH_DIALOG
):
228 url
= user_guide_url("ChStatIOGraphs.html");
230 case(HELP_STATS_LTE_MAC_TRAFFIC_DIALOG
):
231 url
= user_guide_url("ChTelLTE.html#ChTelLTEMACTraffic");
233 case(HELP_STATS_LTE_RLC_TRAFFIC_DIALOG
):
234 url
= user_guide_url("ChTelLTE.html#ChTelLTERLCTraffic");
236 case(HELP_STATS_TCP_STREAM_GRAPHS_DIALOG
):
237 url
= user_guide_url("ChStatTCPStreamGraphs.html");
239 case(HELP_STATS_WLAN_TRAFFIC_DIALOG
):
240 url
= user_guide_url("ChWirelessWLANTraffic.html");
242 case(HELP_FILESET_DIALOG
):
243 url
= user_guide_url("ChIOFileSetSection.html");
245 case(HELP_CAPTURE_INTERFACE_OPTIONS_DIALOG
):
246 url
= user_guide_url("ChCustPreferencesSection.html#ChCustInterfaceOptionsSection");
248 case(HELP_PREFERENCES_DIALOG
):
249 url
= user_guide_url("ChCustPreferencesSection.html");
251 case(HELP_EXPORT_FILE_DIALOG
):
252 case(HELP_EXPORT_FILE_WIN32_DIALOG
):
253 url
= user_guide_url("ChIOExportSection.html");
255 case(HELP_EXPORT_BYTES_DIALOG
):
256 url
= user_guide_url("ChIOExportSection.html#ChIOExportSelectedDialog");
258 case(HELP_EXPORT_OBJECT_LIST
):
259 url
= user_guide_url("ChIOExportSection.html#ChIOExportObjectsDialog");
261 case(HELP_OPEN_DIALOG
):
262 case(HELP_OPEN_WIN32_DIALOG
):
263 url
= user_guide_url("ChIOOpenSection.html");
265 case(HELP_MERGE_DIALOG
):
266 case(HELP_MERGE_WIN32_DIALOG
):
267 url
= user_guide_url("ChIOMergeSection.html");
269 case(HELP_IMPORT_DIALOG
):
270 url
= user_guide_url("ChIOImportSection.html");
272 case(HELP_SAVE_DIALOG
):
273 case(HELP_SAVE_WIN32_DIALOG
):
274 url
= user_guide_url("ChIOSaveSection.html");
276 case(HELP_TIME_SHIFT_DIALOG
):
277 url
= user_guide_url("ChWorkShiftTimePacketSection.html");
279 case(HELP_TELEPHONY_VOIP_CALLS_DIALOG
):
280 url
= user_guide_url("ChTelVoipCalls.html");
282 case(HELP_TELEPHONY_RTP_ANALYSIS_DIALOG
):
283 url
= user_guide_url("ChTelRTP.html#ChTelRTPAnalysis");
285 case(HELP_TELEPHONY_RTP_STREAMS_DIALOG
):
286 url
= user_guide_url("ChTelRTP.html#ChTelRTPStreams");
288 case(HELP_NEW_PACKET_DIALOG
):
289 url
= user_guide_url("ChapterWork.html#ChWorkPacketSepView");
291 case(HELP_IAX2_ANALYSIS_DIALOG
):
292 url
= user_guide_url("ChTelIAX2Analysis.html");
294 case(HELP_TELEPHONY_RTP_PLAYER_DIALOG
):
295 url
= user_guide_url("ChTelRTP.html#ChTelRtpPlayer");
297 case(HELP_STAT_FLOW_GRAPH
):
298 url
= user_guide_url("ChStatFlowGraph.html");
301 case(TOPIC_ACTION_NONE
):
303 url
= g_strdup(WS_HOME_PAGE_URL
);
304 ws_assert_not_reached();