1 /*
2  * Copyright (c) 2002-2016 Balabit
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17  *
18  * As an additional exemption you are allowed to compile & link against the
19  * OpenSSL libraries as published by the OpenSSL project. See the file
20  * COPYING for details.
21  *
22  */
23 
24 #ifndef __VERSIONING_H__
25 #define __VERSIONING_H__
26 
27 /* The aim of this header file is to make it easy to track version
28  * identification in code when porting code from the PE tree to the OSE tree
29  * or vice versa.  Error and warning messages should always use these macros
30  * instead of inlining a concrete version number.  Runtime checks should
31  * always use the get_version_value() function to convert OSE version codes
32  * to PE ones.
33  *
34  ****************************************************************************
35  * The code _should_ always use OSE version numbering, otherwise it'd break *
36  * and confuse the user when code gets ported between trees.                *
37  ****************************************************************************
38  *
39  * Versions in error messages
40  * ==========================
41  *
42  * Whenever using an error message that needs to state a version number, it
43  * should use one of the VERSION_X_Y macros, X_Y identifying the OSE version
44  * number where the incompatible change was applied.
45  *
46  * Example:
47  *
48  *   msg_warning("WARNING: foo got changed to bar in " VERSION_3_4");
49  *
50  * Incompatible changes in non-OSE products
51  * ========================================
52  *
53  * If you introduce an incompatible change in a private tree (but don't do
54  * that), you should explicitly define a macro that identifies your version,
55  * e.g.  if you have a product named foo, which is based on syslog-ng 3.3
56  * and you decide to change the interpretation of a config syntax in your
57  * 1.0 release, you should create a macro:
58  *
59  *    VERSION_FOO_1_0   "foo 1.0"
60  *
61  * This would be changed once the code gets integrated into syslog-ng, to
62  * the "integrated-to" release.  That way, users that always used OSE gets
63  * the version number properly.
64  *
65  * Rebasing to a tree that already has your incompatible change
66  * ============================================================
67  *
68  * Assuming your change makes it to the OSE tree, the FOO specific version
69  * references will be changed to OSE version macros, which could be a
70  * problem for you when rebase your product, since your rebased product will
71  * claim that the incompatible change happened _after_ it really happened.
72  * The best solution is not to introduce incompatible changes or do that in
73  * the OSE tree first.  If you have to something like this, make sure that
74  * you take care about these at rebase time.
75  *
76  * Version number barrier
77  * ======================
78  *
79  * For now there's an explicit barrier in version numbering between PE and
80  * OSE, which is "4.0"; everything below "4.0" is an OSE version number,
81  * everything ahead is a PE one.  This will change once there's sufficient
82  * gap between the two (e.g.  PE 4.0 is long forgotten), in that case
83  * OSE can also use version 4 and later.
84  *
85  * If there's another similar products built on syslog-ng (e.g. someone
86  * other than BB creates such a product, the same scheme can be used by them
87  * too).
88  */
89 
90 /* version references for major syslog-ng OSE versions. All error messages
91  * should reference the syslog-ng version number through these macros, in order
92  * to make it relatively simple to explain PE/OSE version numbers to users. */
93 
94 #define PRODUCT_DOCUMENTATION "https://www.syslog-ng.com/technical-documents/list/syslog-ng-open-source-edition"
95 #define PRODUCT_CONTACT "https://lists.balabit.hu/mailman/listinfo/syslog-ng"
96 
97 #define VERSION_3_0 "syslog-ng 3.0"
98 #define VERSION_3_1 "syslog-ng 3.1"
99 #define VERSION_3_2 "syslog-ng 3.2"
100 #define VERSION_3_3 "syslog-ng 3.3"
101 #define VERSION_3_4 "syslog-ng 3.4"
102 #define VERSION_3_5 "syslog-ng 3.5"
103 #define VERSION_3_6 "syslog-ng 3.6"
104 #define VERSION_3_7 "syslog-ng 3.7"
105 #define VERSION_3_8 "syslog-ng 3.8"
106 #define VERSION_3_9 "syslog-ng 3.9"
107 #define VERSION_3_10 "syslog-ng 3.10"
108 #define VERSION_3_11 "syslog-ng 3.11"
109 #define VERSION_3_12 "syslog-ng 3.12"
110 #define VERSION_3_13 "syslog-ng 3.13"
111 #define VERSION_3_14 "syslog-ng 3.14"
112 #define VERSION_3_15 "syslog-ng 3.15"
113 #define VERSION_3_16 "syslog-ng 3.16"
114 #define VERSION_3_17 "syslog-ng 3.17"
115 #define VERSION_3_18 "syslog-ng 3.18"
116 #define VERSION_3_19 "syslog-ng 3.19"
117 #define VERSION_3_20 "syslog-ng 3.20"
118 #define VERSION_3_21 "syslog-ng 3.21"
119 #define VERSION_3_22 "syslog-ng 3.22"
120 #define VERSION_3_23 "syslog-ng 3.23"
121 #define VERSION_3_24 "syslog-ng 3.24"
122 #define VERSION_3_25 "syslog-ng 3.25"
123 #define VERSION_3_26 "syslog-ng 3.26"
124 #define VERSION_3_27 "syslog-ng 3.27"
125 #define VERSION_3_28 "syslog-ng 3.28"
126 #define VERSION_3_29 "syslog-ng 3.29"
127 #define VERSION_3_30 "syslog-ng 3.30"
128 #define VERSION_3_31 "syslog-ng 3.31"
129 #define VERSION_3_32 "syslog-ng 3.32"
130 #define VERSION_3_33 "syslog-ng 3.33"
131 #define VERSION_3_34 "syslog-ng 3.34"
132 #define VERSION_3_35 "syslog-ng 3.35"
133 
134 /* VERSION_VALUE_* references versions as integers to be compared against stuff like cfg->user_version */
135 /* VERSION_STR_* references versions as strings to be shown to the user */
136 
137 #define VERSION_VALUE_3_0  0x0300
138 #define VERSION_VALUE_3_1  0x0301
139 #define VERSION_VALUE_3_2  0x0302
140 #define VERSION_VALUE_3_3  0x0303
141 #define VERSION_VALUE_3_4  0x0304
142 #define VERSION_VALUE_3_5  0x0305
143 #define VERSION_VALUE_3_6  0x0306
144 #define VERSION_VALUE_3_7  0x0307
145 #define VERSION_VALUE_3_8  0x0308
146 #define VERSION_VALUE_3_9  0x0309
147 #define VERSION_VALUE_3_10 0x030a
148 #define VERSION_VALUE_3_11 0x030b
149 #define VERSION_VALUE_3_12 0x030c
150 #define VERSION_VALUE_3_13 0x030d
151 #define VERSION_VALUE_3_14 0x030e
152 #define VERSION_VALUE_3_15 0x030f
153 #define VERSION_VALUE_3_16 0x0310
154 #define VERSION_VALUE_3_17 0x0311
155 #define VERSION_VALUE_3_18 0x0312
156 #define VERSION_VALUE_3_19 0x0313
157 #define VERSION_VALUE_3_20 0x0314
158 #define VERSION_VALUE_3_21 0x0315
159 #define VERSION_VALUE_3_22 0x0316
160 #define VERSION_VALUE_3_23 0x0317
161 #define VERSION_VALUE_3_24 0x0318
162 #define VERSION_VALUE_3_25 0x0319
163 #define VERSION_VALUE_3_26 0x031a
164 #define VERSION_VALUE_3_27 0x031b
165 #define VERSION_VALUE_3_28 0x031c
166 #define VERSION_VALUE_3_29 0x031d
167 #define VERSION_VALUE_3_30 0x031e
168 #define VERSION_VALUE_3_31 0x031f
169 #define VERSION_VALUE_3_32 0x0320
170 #define VERSION_VALUE_3_33 0x0321
171 #define VERSION_VALUE_3_34 0x0322
172 #define VERSION_VALUE_3_35 0x0323
173 
174 /* config version code, in the same format as GlobalConfig->version */
175 #define VERSION_VALUE_CURRENT   VERSION_VALUE_3_35
176 #define VERSION_STR_CURRENT     "3.35"
177 #define VERSION_PRODUCT_CURRENT VERSION_3_35
178 
179 /* this value points to the last syslog-ng version where we changed the
180  * meaning of any setting in the configuration file.  Basically, it is the
181  * highest value passed to any cfg_is_config_version_older() call.
182  */
183 #define VERSION_VALUE_LAST_SEMANTIC_CHANGE  VERSION_VALUE_3_35
184 #define VERSION_STR_LAST_SEMANTIC_CHANGE    "3.35"
185 
186 #define version_convert_from_user(v)  (v)
187 
188 #include "pe-versioning.h"
189 #endif
190