2 * Routines to report version information for stuff used by Wireshark
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.
31 #include <zlib.h> /* to get the libz version number */
34 #include "version_info.h"
35 #include "capture-pcap-util.h"
36 #include <wsutil/os_version_info.h>
37 #include <wsutil/compiler_info.h>
38 #include <wsutil/cpu_info.h>
39 #include <wsutil/mem_info.h>
42 # include <sys/capability.h>
46 * If the string doesn't end with a newline, append one.
47 * Then word-wrap it to 80 columns.
50 end_string(GString *str)
56 if (point == 0 || str->str[point - 1] != '\n')
57 g_string_append(str, "\n");
63 * Break at or before this point.
66 while (q > p && *q != ' ')
76 * Get various library compile-time versions and append them to
77 * the specified GString.
79 * "additional_info" is called at the end to append any additional
80 * information; this is required in order to, for example, put the
81 * Portaudio information at the end of the string, as we currently
82 * don't use Portaudio in TShark.
85 get_compiled_version_info(GString *str, void (*prepend_info)(GString *),
86 void (*append_info)(GString *))
89 g_string_append(str, "(32-bit) ");
91 g_string_append(str, "(64-bit) ");
97 g_string_append(str, "with ");
98 g_string_append_printf(str,
99 #ifdef GLIB_MAJOR_VERSION
100 "GLib %d.%d.%d", GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION,
103 "GLib (version unknown)");
107 g_string_append(str, ", ");
108 get_compiled_pcap_version(str);
111 g_string_append(str, ", ");
113 g_string_append(str, "with libz ");
115 g_string_append(str, ZLIB_VERSION);
116 #else /* ZLIB_VERSION */
117 g_string_append(str, "(version unknown)");
118 #endif /* ZLIB_VERSION */
119 #else /* HAVE_LIBZ */
120 g_string_append(str, "without libz");
121 #endif /* HAVE_LIBZ */
124 /* This is UN*X-only. */
126 g_string_append(str, ", ");
128 g_string_append(str, "with POSIX capabilities");
129 #ifdef _LINUX_CAPABILITY_VERSION
130 g_string_append(str, " (Linux)");
131 #endif /* _LINUX_CAPABILITY_VERSION */
132 #else /* HAVE_LIBCAP */
133 g_string_append(str, "without POSIX capabilities");
134 #endif /* HAVE_LIBCAP */
138 /* This is a Linux-specific library. */
140 g_string_append(str, ", ");
141 #if defined(HAVE_LIBNL1)
142 g_string_append(str, "with libnl 1");
143 #elif defined(HAVE_LIBNL2)
144 g_string_append(str, "with libnl 2");
145 #elif defined(HAVE_LIBNL3)
146 g_string_append(str, "with libnl 3");
148 g_string_append(str, "without libnl");
149 #endif /* libnl version */
150 #endif /* __linux__ */
152 /* Additional application-dependent information */
155 g_string_append(str, ".");
161 * Get various library run-time versions, and the OS version, and append
162 * them to the specified GString.
165 get_runtime_version_info(GString *str, void (*additional_info)(GString *))
171 g_string_append(str, "on ");
173 get_os_version_info(str);
177 if ((lang = getenv ("LANG")) != NULL)
178 g_string_append_printf(str, ", with locale %s", lang);
180 g_string_append(str, ", without locale");
184 g_string_append(str, ", ");
185 get_runtime_pcap_version(str);
188 #if defined(HAVE_LIBZ) && !defined(_WIN32)
189 g_string_append_printf(str, ", with libz %s", zlibVersion());
192 /* Additional application-dependent information */
194 (*additional_info)(str);
196 g_string_append(str, ".");
201 /* Get info about installed memory Windows only */
205 get_compiler_info(str);
216 * indent-tabs-mode: t
219 * ex: set shiftwidth=8 tabstop=8 noexpandtab:
220 * :indentSize=8:tabSize=8:noTabs=false: