2 * Wrappers and routines to check for software updates.
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 #include "software_update.h"
28 #include "../epan/prefs.h"
31 * Version 0 of the update URI path has the following elements:
32 * - The update path prefix (fixed, "update")
33 * - The schema version (fixed, 0)
34 * - The application name (fixed, "Wireshark")
35 * - The application version ("<major>.<minor>.<micro>")
36 * - The operating system (varable, one of "windows" or "osx")
37 * - The architecture name (variable, one of "x86", "x86-64")
38 * - The locale (fixed, "en-US)
39 * - The update channel (variable, one of "development" or "stable") + .xml
41 * Based on https://wiki.mozilla.org/Software_Update:Checking_For_Updates
44 #ifdef HAVE_SOFTWARE_UPDATE
45 #define SU_SCHEMA_PREFIX "update"
46 #define SU_SCHEMA_VERSION 0
47 #define SU_APPLICATION "Wireshark"
48 #define SU_LOCALE "en-US"
49 #endif /* HAVE_SOFTWARE_UPDATE */
51 #if defined(HAVE_SOFTWARE_UPDATE) && defined (_WIN32)
55 #include <winsparkle.h>
57 #define SU_OSNAME "Windows"
59 static GString
*update_url_str
= NULL
;
61 static const char *get_appcast_update_url(software_update_channel_e chan
) {
62 const char *chan_name
;
63 const char *arch
= "x86";
65 if (!update_url_str
) {
66 update_url_str
= g_string_new("");
69 /* XXX Add WOW64 checks similar to version_info.c? */
70 if (sizeof(arch
) != 4) {
75 case UPDATE_CHANNEL_DEVELOPMENT
:
76 chan_name
= "development";
82 g_string_printf(update_url_str
, "https://www.wireshark.org/%s/%u/%s/%s/%s/%s/en-US/%s.xml",
90 return update_url_str
->str
;
93 /** Initialize software updates.
96 software_update_init(void) {
97 const char *update_url
= get_appcast_update_url(prefs
.gui_update_channel
);
99 win_sparkle_set_registry_path("Software\\Wireshark\\WinSparkle Settings");
100 win_sparkle_set_appcast_url(update_url
);
101 win_sparkle_set_automatic_check_for_updates(prefs
.gui_update_enabled
? 1 : 0);
102 win_sparkle_set_update_check_interval(prefs
.gui_update_interval
);
106 /** Force a software update check.
109 software_update_check(void) {
110 win_sparkle_check_update_with_ui();
113 /** Clean up software update checking.
115 * Does nothing on platforms that don't support software updates.
117 extern void software_update_cleanup(void) {
118 win_sparkle_cleanup();
121 #else /* defined(HAVE_SOFTWARE_UPDATE) && defined (_WIN32) */
123 /** Initialize software updates.
126 software_update_init(void) {
129 /** Force a software update check.
132 software_update_check(void) {
135 /** Clean up software update checking.
137 * Does nothing on platforms that don't support software updates.
139 extern void software_update_cleanup(void) {
142 #endif /* defined(HAVE_SOFTWARE_UPDATE) && defined (_WIN32) */
150 * indent-tabs-mode: nil
153 * ex: set shiftwidth=4 tabstop=8 expandtab:
154 * :indentSize=4:tabSize=8:noTabs=true: