1 /* version_info.h
2  * Declarations of routines to report version information for Wireshark
3  * programs
4  *
5  * Wireshark - Network traffic analyzer
6  * By Gerald Combs <gerald@wireshark.org>
7  * Copyright 1998 Gerald Combs
8  *
9  * SPDX-License-Identifier: GPL-2.0-or-later
10  */
11 
12 #ifndef __WS_VERSION_INFO_H__
13 #define __WS_VERSION_INFO_H__
14 
15 #include <glib.h>
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif /* __cplusplus */
20 
21 /*
22  * Initialize information about the program for various purposes, including
23  * reporting the version and build information for the program, putting
24  * that information into crash dumps if possible, and giving the program
25  * name and version information into capture files written by the program
26  * if possible.
27  *
28  * "appname" is a string that appears at the beginning of the information;
29  * it should include the application name, followed by "(Wireshark)" if
30  * the program isn't Wireshark.
31  *
32  * "prepend_compile_time_info" is called at the start to prepend any
33  * additional build information before the standard library information.
34  *
35  * "append_compile_time_info" is called at the end to append any additional
36  * build information after the standard library information.  This is
37  * required in order to, for example, put Qt information at the
38  * end of the string, as we don't use Qt in TShark.
39  *
40  * "additional_info" is called at the end to append any additional
41  * run-time information; this is required in order to, for example,
42  * put the libcap information at the end of the string, as we currently
43  * don't use libcap in TShark.
44  */
45 void ws_init_version_info(const char *appname,
46     void (*prepend_compile_time_info)(GString *),
47     void (*append_compile_time_info)(GString *),
48     void (*additional_run_time_info)(GString *));
49 
50 /*
51  * Get a string giving the application name, as provided to
52  * ws_init_version_info(), followed by a string giving the
53  * application version.
54  */
55 const char *get_appname_and_version(void);
56 
57 /*
58  * Get various library compile-time versions, put them in a GString,
59  * and return the GString.
60  *
61  * "prepend_info" is called at the start to prepend any additional
62  * information before the standard library information.
63  *
64  * "append_info" is called at the end to append any additional
65  * information after the standard library information.  This is
66  * required in order to, for example, put Qt information at the
67  * end of the string, as we don't use Qt in TShark.
68  */
69 GString *get_compiled_version_info(void (*prepend_info)(GString *),
70                                                  void (*append_info)(GString *));
71 
72 /*
73  * Get various library run-time versions, and the OS version, put them in
74  * a GString, and return the GString.
75  *
76  * "additional_info" is called at the end to append any additional
77  * information; this is required in order to, for example, put the
78  * libcap information at the end of the string, as we currently
79  * don't use libcap in TShark.
80  */
81 GString *get_runtime_version_info(void (*additional_info)(GString *));
82 
83 /*
84  * Return a version number string for Wireshark, including, for builds
85  * from a tree checked out from Wireshark's version control system,
86  * something identifying what version was checked out.
87  */
88 const char *get_ws_vcs_version_info(void);
89 
90 /*
91  * Shorter version of get_ws_vcs_version_info().
92  */
93 const char *get_ws_vcs_version_info_short(void);
94 
95 /*
96  * Return version number as integers.
97  */
98 void get_ws_version_number(int *major, int *minor, int *micro);
99 
100 /*
101  * Show the program name and version number information on the standard
102  * output; this is used for command-line "show the version" options.
103  */
104 void show_version(void);
105 
106 /*
107  * Show the program name and version number information, a supplied
108  * description string, and a "See {URL} for more information" message.
109  * This is used for command-line "help" options.
110  */
111 void show_help_header(const char *description);
112 
113 #ifdef __cplusplus
114 }
115 #endif /* __cplusplus */
116 
117 #endif /* __WS_VERSION_INFO_H__ */
118