kerberos: make use of &NT_errors_ext
[wireshark-sm.git] / ui / help_url.c
blob989c3296d6c397e46c569c7c910b41de582230a5
1 /* help_url.c
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
12 #include "config.h"
14 #include <string.h>
16 #include <glib.h>
18 #include "help_url.h"
19 #include "urls.h"
20 #include "wsutil/filesystem.h"
21 #include <wsutil/ws_assert.h>
23 // To do:
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.
30 char *
31 user_guide_url(const char *page) {
32 GString *url = g_string_new("");
34 #if defined(_WIN32)
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);
46 #else
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);
52 g_free(path);
53 path = NULL;
54 #endif /* _WIN32 */
57 /* Fall back to wireshark.org. */
58 if (url->len == 0) {
59 g_string_printf(url, WS_DOCS_URL "wsug_html_chunked/%s", page);
61 return g_string_free(url, FALSE);
64 char *
65 topic_action_url(topic_action_e action)
67 char *url;
69 switch(action) {
70 /* pages online at www.wireshark.org */
71 case(ONLINEPAGE_HOME):
72 url = g_strdup(WS_HOME_PAGE_URL);
73 break;
74 case(ONLINEPAGE_WIKI):
75 url = g_strdup(WS_WIKI_HOME_URL);
76 break;
77 case(ONLINEPAGE_DOWNLOAD):
78 url = g_strdup(WS_DOWNLOAD_URL);
79 break;
80 case(ONLINEPAGE_DOCS):
81 url = g_strdup(WS_DOCS_URL);
82 break;
83 case(ONLINEPAGE_USERGUIDE):
84 url = g_strdup(WS_DOCS_URL "wsug_html_chunked/");
85 break;
86 case(ONLINEPAGE_FAQ):
87 url = g_strdup(WS_FAQ_URL);
88 break;
89 case(ONLINEPAGE_ASK):
90 url = g_strdup(WS_Q_AND_A_URL);
91 break;
92 case(ONLINEPAGE_SAMPLE_FILES):
93 url = g_strdup(WS_WIKI_URL("SampleCaptures"));
94 break;
95 case(ONLINEPAGE_CAPTURE_SETUP):
96 url = g_strdup(WS_WIKI_URL("CaptureSetup"));
97 break;
98 case(ONLINEPAGE_NETWORK_MEDIA):
99 url = g_strdup(WS_WIKI_URL("CaptureSetup/NetworkMedia"));
100 break;
101 case(ONLINEPAGE_SAMPLE_CAPTURES):
102 url = g_strdup(WS_WIKI_URL("SampleCaptures"));
103 break;
104 case(ONLINEPAGE_SECURITY):
105 url = g_strdup(WS_WIKI_URL("Security"));
106 break;
108 /* local manual pages */
109 case(LOCALPAGE_MAN_WIRESHARK):
110 url = doc_file_url("wireshark.html");
111 break;
112 case(LOCALPAGE_MAN_WIRESHARK_FILTER):
113 url = doc_file_url("wireshark-filter.html");
114 break;
115 case(LOCALPAGE_MAN_CAPINFOS):
116 url = doc_file_url("capinfos.html");
117 break;
118 case(LOCALPAGE_MAN_DUMPCAP):
119 url = doc_file_url("dumpcap.html");
120 break;
121 case(LOCALPAGE_MAN_EDITCAP):
122 url = doc_file_url("editcap.html");
123 break;
124 case(LOCALPAGE_MAN_MERGECAP):
125 url = doc_file_url("mergecap.html");
126 break;
127 case(LOCALPAGE_MAN_RAWSHARK):
128 url = doc_file_url("rawshark.html");
129 break;
130 case(LOCALPAGE_MAN_REORDERCAP):
131 url = doc_file_url("reordercap.html");
132 break;
133 case(LOCALPAGE_MAN_TEXT2PCAP):
134 url = doc_file_url("text2pcap.html");
135 break;
136 case(LOCALPAGE_MAN_TSHARK):
137 url = doc_file_url("tshark.html");
138 break;
140 /* Release Notes */
141 case(LOCALPAGE_RELEASE_NOTES):
142 url = doc_file_url("release-notes.html");
143 break;
145 /* local help pages (User's Guide) */
146 case(HELP_CONTENT):
147 url = user_guide_url( "index.html");
148 break;
149 case(HELP_CAPTURE_OPTIONS):
150 url = user_guide_url("ChCapCaptureOptions.html");
151 break;
152 case(HELP_CAPTURE_FILTERS_DIALOG):
153 url = user_guide_url("ChWorkDefineFilterSection.html");
154 break;
155 case(HELP_DISPLAY_FILTERS_DIALOG):
156 url = user_guide_url("ChWorkDefineFilterSection.html");
157 break;
158 case(HELP_DISPLAY_MACRO_DIALOG):
159 url = user_guide_url("ChWorkDefineFilterMacrosSection.html");
160 break;
161 case(HELP_FILTER_EXPRESSION_DIALOG):
162 url = user_guide_url("ChWorkFilterAddExpressionSection.html");
163 break;
164 case(HELP_COLORING_RULES_DIALOG):
165 url = user_guide_url("ChCustColorizationSection.html");
166 break;
167 case(HELP_CONFIG_PROFILES_DIALOG):
168 url = user_guide_url("ChCustConfigProfilesSection.html");
169 break;
170 case(HELP_PRINT_DIALOG):
171 url = user_guide_url("ChIOPrintSection.html");
172 break;
173 case(HELP_FIND_DIALOG):
174 url = user_guide_url("ChWorkFindPacketSection.html");
175 break;
176 case(HELP_FIREWALL_DIALOG):
177 url = user_guide_url("ChUseToolsMenuSection.html");
178 break;
179 case(HELP_GOTO_DIALOG):
180 url = user_guide_url("ChWorkGoToPacketSection.html");
181 break;
182 case(HELP_CAPTURE_OPTIONS_DIALOG):
183 url = user_guide_url("ChCapCaptureOptions.html");
184 break;
185 case(HELP_CAPTURE_INFO_DIALOG):
186 url = user_guide_url("ChCapRunningSection.html");
187 break;
188 case(HELP_CAPTURE_MANAGE_INTERFACES_DIALOG):
189 url = user_guide_url("ChCapManageInterfacesSection.html");
190 break;
191 case(HELP_ENABLED_PROTOCOLS_DIALOG):
192 url = user_guide_url("ChCustProtocolDissectionSection.html");
193 break;
194 case(HELP_ENABLED_HEURISTICS_DIALOG):
195 url = user_guide_url("ChCustProtocolDissectionSection.html");
196 break;
197 case(HELP_DECODE_AS_DIALOG):
198 url = user_guide_url("ChCustProtocolDissectionSection.html");
199 break;
200 case(HELP_DECODE_AS_SHOW_DIALOG):
201 url = user_guide_url("ChCustProtocolDissectionSection.html");
202 break;
203 case(HELP_FOLLOW_STREAM_DIALOG):
204 url = user_guide_url("ChAdvFollowStreamSection.html");
205 break;
206 case(HELP_SHOW_PACKET_BYTES_DIALOG):
207 url = user_guide_url("ChAdvShowPacketBytes.html");
208 break;
209 case(HELP_EXPERT_INFO_DIALOG):
210 url = user_guide_url("ChAdvExpert.html");
211 break;
212 case(HELP_EXTCAP_OPTIONS_DIALOG):
213 url = doc_file_url("extcap.html");
214 break;
215 case(HELP_STATS_SUMMARY_DIALOG):
216 url = user_guide_url("ChStatSummary.html");
217 break;
218 case(HELP_STATS_PROTO_HIERARCHY_DIALOG):
219 url = user_guide_url("ChStatHierarchy.html");
220 break;
221 case(HELP_STATS_ENDPOINTS_DIALOG):
222 url = user_guide_url("ChStatEndpoints.html");
223 break;
224 case(HELP_STATS_CONVERSATIONS_DIALOG):
225 url = user_guide_url("ChStatConversations.html");
226 break;
227 case(HELP_STATS_IO_GRAPH_DIALOG):
228 url = user_guide_url("ChStatIOGraphs.html");
229 break;
230 case(HELP_STATS_LTE_MAC_TRAFFIC_DIALOG):
231 url = user_guide_url("ChTelLTE.html#ChTelLTEMACTraffic");
232 break;
233 case(HELP_STATS_LTE_RLC_TRAFFIC_DIALOG):
234 url = user_guide_url("ChTelLTE.html#ChTelLTERLCTraffic");
235 break;
236 case(HELP_STATS_TCP_STREAM_GRAPHS_DIALOG):
237 url = user_guide_url("ChStatTCPStreamGraphs.html");
238 break;
239 case(HELP_STATS_WLAN_TRAFFIC_DIALOG):
240 url = user_guide_url("ChWirelessWLANTraffic.html");
241 break;
242 case(HELP_FILESET_DIALOG):
243 url = user_guide_url("ChIOFileSetSection.html");
244 break;
245 case(HELP_CAPTURE_INTERFACE_OPTIONS_DIALOG):
246 url = user_guide_url("ChCustPreferencesSection.html#ChCustInterfaceOptionsSection");
247 break;
248 case(HELP_PREFERENCES_DIALOG):
249 url = user_guide_url("ChCustPreferencesSection.html");
250 break;
251 case(HELP_EXPORT_FILE_DIALOG):
252 case(HELP_EXPORT_FILE_WIN32_DIALOG):
253 url = user_guide_url("ChIOExportSection.html");
254 break;
255 case(HELP_EXPORT_BYTES_DIALOG):
256 url = user_guide_url("ChIOExportSection.html#ChIOExportSelectedDialog");
257 break;
258 case(HELP_EXPORT_OBJECT_LIST):
259 url = user_guide_url("ChIOExportSection.html#ChIOExportObjectsDialog");
260 break;
261 case(HELP_OPEN_DIALOG):
262 case(HELP_OPEN_WIN32_DIALOG):
263 url = user_guide_url("ChIOOpenSection.html");
264 break;
265 case(HELP_MERGE_DIALOG):
266 case(HELP_MERGE_WIN32_DIALOG):
267 url = user_guide_url("ChIOMergeSection.html");
268 break;
269 case(HELP_IMPORT_DIALOG):
270 url = user_guide_url("ChIOImportSection.html");
271 break;
272 case(HELP_SAVE_DIALOG):
273 case(HELP_SAVE_WIN32_DIALOG):
274 url = user_guide_url("ChIOSaveSection.html");
275 break;
276 case(HELP_TIME_SHIFT_DIALOG):
277 url = user_guide_url("ChWorkShiftTimePacketSection.html");
278 break;
279 case(HELP_TELEPHONY_VOIP_CALLS_DIALOG):
280 url = user_guide_url("ChTelVoipCalls.html");
281 break;
282 case(HELP_TELEPHONY_RTP_ANALYSIS_DIALOG):
283 url = user_guide_url("ChTelRTP.html#ChTelRTPAnalysis");
284 break;
285 case(HELP_TELEPHONY_RTP_STREAMS_DIALOG):
286 url = user_guide_url("ChTelRTP.html#ChTelRTPStreams");
287 break;
288 case(HELP_NEW_PACKET_DIALOG):
289 url = user_guide_url("ChapterWork.html#ChWorkPacketSepView");
290 break;
291 case(HELP_IAX2_ANALYSIS_DIALOG):
292 url = user_guide_url("ChTelIAX2Analysis.html");
293 break;
294 case(HELP_TELEPHONY_RTP_PLAYER_DIALOG):
295 url = user_guide_url("ChTelRTP.html#ChTelRtpPlayer");
296 break;
297 case(HELP_STAT_FLOW_GRAPH):
298 url = user_guide_url("ChStatFlowGraph.html");
299 break;
301 case(TOPIC_ACTION_NONE):
302 default:
303 url = g_strdup(WS_HOME_PAGE_URL);
304 ws_assert_not_reached();
307 return url;