2 * Wrappers and routines to check for software updates.
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #include "software_update.h"
26 #include "../epan/prefs.h"
29 * Version 0 of the update URI path has the following elements:
30 * - The update path prefix (fixed, "update")
31 * - The schema version (fixed, 0)
32 * - The application name (fixed, "Wireshark")
33 * - The application version ("<major>.<minor>.<micro>")
34 * - The operating system (varable, one of "windows" or "osx")
35 * - The architecture name (variable, one of "x86", "x86-64")
36 * - The locale (fixed, "en-US)
37 * - The update channel (variable, one of "development" or "stable") + .xml
39 * Based on https://wiki.mozilla.org/Software_Update:Checking_For_Updates
42 #ifdef HAVE_SOFTWARE_UPDATE
43 #define SU_SCHEMA_PREFIX "update"
44 #define SU_SCHEMA_VERSION 0
45 #define SU_APPLICATION "Wireshark"
46 #define SU_LOCALE "en-US"
47 #endif /* HAVE_SOFTWARE_UPDATE */
49 #if defined(HAVE_SOFTWARE_UPDATE) && defined (_WIN32)
53 #include <winsparkle.h>
55 #define SU_OSNAME "Windows"
57 static GString *update_url_str = NULL;
59 static const char *get_appcast_update_url(software_update_channel_e chan) {
60 const char *chan_name;
61 const char *arch = "x86";
63 if (!update_url_str) {
64 update_url_str = g_string_new("");
67 /* XXX Add WOW64 checks similar to version_info.c? */
68 if (sizeof(arch) != 4) {
73 case UPDATE_CHANNEL_DEVELOPMENT:
74 chan_name = "development";
80 g_string_printf(update_url_str, "https://www.wireshark.org/%s/%u/%s/%s/%s/%s/en-US/%s.xml",
88 return update_url_str->str;
91 /** Initialize software updates.
94 software_update_init(void) {
95 const char *update_url = get_appcast_update_url(prefs.gui_update_channel);
97 win_sparkle_set_registry_path("Software\\Wireshark\\WinSparkle Settings");
98 win_sparkle_set_appcast_url(update_url);
99 win_sparkle_set_automatic_check_for_updates(prefs.gui_update_enabled ? 1 : 0);
100 win_sparkle_set_update_check_interval(prefs.gui_update_interval);
104 /** Force a software update check.
107 software_update_check(void) {
108 win_sparkle_check_update_with_ui();
111 /** Clean up software update checking.
113 * Does nothing on platforms that don't support software updates.
115 extern void software_update_cleanup(void) {
116 win_sparkle_cleanup();
119 #else /* defined(HAVE_SOFTWARE_UPDATE) && defined (_WIN32) */
121 /** Initialize software updates.
124 software_update_init(void) {
127 /** Force a software update check.
130 software_update_check(void) {
133 /** Clean up software update checking.
135 * Does nothing on platforms that don't support software updates.
137 extern void software_update_cleanup(void) {
140 #endif /* defined(HAVE_SOFTWARE_UPDATE) && defined (_WIN32) */
148 * indent-tabs-mode: nil
151 * ex: set shiftwidth=4 tabstop=8 expandtab:
152 * :indentSize=4:tabSize=8:noTabs=true: