EM-ODP  3.7.0
Event Machine on ODP
event_machine_version.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021, Nokia Solutions and Networks
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  * * Neither the name of the copyright holder nor the names of its
15  * contributors may be used to endorse or promote products derived
16  * from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #ifndef EVENT_MACHINE_VERSION_H
32 #define EVENT_MACHINE_VERSION_H
33 
34 #pragma GCC visibility push(default)
35 
36 /**
37  * @file
38  * Event Machine version information
39  */
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 /**
46  * @defgroup em_version Version
47  * EM version information for the API and implementation
48  *
49  * The EM version numbering scheme reflects the used EM API version:
50  * @verbatim
51  * maj.min.impl(-fix)
52  * maj.min = EM API version supported
53  * maj = major API version number, reserved for big changes
54  * .min = minor API version, incremented when the API changes
55  * .impl = Implementation number supporting EM API version maj.min
56  * Updated for implementations with no API changes, starts at .0
57  * -fix = Fix number, added for bugfixes on a certain implementation
58  * version maj.min.impl (-0 is not added, first fix is -1)
59  * Examples:
60  * 1) EM version 2.7.0
61  * maj.min = 2.7: supports EM API v2.7
62  * .impl = .0: first implementation supporting API 2.7 (starts at .0)
63  * -fix = n/a, no fix
64  * 2) EM version 2.7.1-3
65  * maj.min = 2.7: supports EM API v2.7
66  * .impl = .1: second implementation supporting API 2.7 (starts at .0)
67  * -fix = -3: third bugfix for 2.7.1
68  * @endverbatim
69  *
70  * Compile time version information can be obtained via the EM_VERSION_...
71  * macros and defines.
72  * The EM API version is identified by EM_VERSION_API_... preprocessor defines
73  * while the EM implementation version is identified by using EM_VERSION_...
74  *
75  * In addition to these compile time defines, EM API calls can be used to
76  * identify the implementation and API version at run time.
77  * @{
78  */
79 
80 /**
81  * Event Machine for Open Data Plane
82  */
83 #define EM_ODP 1
84 
85 /**
86  * EM target string: EM-on-ODP
87  */
88 #define EM_TARGET_STR "em-odp"
89 
90 /**
91  * EM build string (obtained from git)
92  */
93 #define EM_BUILD_INFO_STR "d31ee7c 2024-08-22 11:50"
94 
95 /**
96  * Major EM API version number.
97  *
98  * @verbatim MAJ.min.impl-fix @endverbatim
99  * (e.g. 2.7.1-3, major API version is 2)
100  */
101 #define EM_VERSION_API_MAJOR 3
102 /* Backwards compatible naming */
103 #define EM_API_VERSION_MAJOR EM_VERSION_API_MAJOR
104 
105 /**
106  * Minor EM API version number.
107  *
108  * @verbatim maj.MIN.impl-fix @endverbatim
109  * maj.MIN.impl-fix (e.g. 2.7.1-3: minor API version is 7)
110  */
111 #define EM_VERSION_API_MINOR 7
112 /* Backwards compatible naming */
113 #define EM_API_VERSION_MINOR EM_VERSION_API_MINOR
114 
115 /**
116  * Implementation version of the API
117  *
118  * @verbatim maj.min.IMPL-fix @endverbatim
119  * (e.g. 2.7.1-3: implementation version of API 2.7 is 1)
120  */
121 #define EM_VERSION_IMPLEMENTATION 0
122 
123 /**
124  * Fix version of the implementation
125  *
126  * @verbatim maj.min.impl-FIX @endverbatim
127  * (e.g. 2.7.1-3: fix version of implementation 2.7.1 is 3)
128  */
129 #define EM_VERSION_FIX 0
130 
131 /**
132  * EM API version string "maj.min"
133  */
134 #define EM_VERSION_API_STR "3.7"
135 
136 /**
137  * EM version string "maj.min.impl(-fix)"
138  */
139 #define EM_VERSION_STR "3.7.0"
140 
141 /**
142  * EM API version number macro
143  *
144  * Macro to build a version number for API version number comparisons
145  *
146  * @code {.c}
147  * #if EM_VERSION_API > EM_VERSION_API_NUM(2, 7)
148  * ...code...
149  * #endif
150  * @endcode
151  *
152  * @see EM_VERSION_NUM() for full version number macro
153  */
154 #define EM_VERSION_API_NUM(api_maj, api_min) (((api_maj) & 0xffU) << 24 | \
155  ((api_min) & 0xffU) << 16)
156 /**
157  * EM full version number macro
158  *
159  * Macro to build a version number for version number comparisons
160  *
161  * @code {.c}
162  * #if EM_VERSION > EM_VERSION_NUM(2, 7, 1, 3)
163  * ...code...
164  * #endif
165  * @endcode
166  *
167  * @see EM_VERSION_API_NUM() for API version number macro
168  */
169 #define EM_VERSION_NUM(api_maj, api_min, impl, fix) (((api_maj) & 0xffU) << 24 | \
170  ((api_min) & 0xffU) << 16 | \
171  ((impl) & 0xffU) << 8 | \
172  ((fix) & 0xffU))
173 /**
174  * EM API version number
175  *
176  * EM API version number for comparisons against the EM_VERSION_API_NUM()
177  * macro output.
178  *
179  * @code {.c}
180  * #if EM_VERSION_API > EM_VERSION_API_NUM(2, 7)
181  * ...code...
182  * #endif
183  * @endcode
184  */
185 #define EM_VERSION_API EM_VERSION_API_NUM(EM_VERSION_API_MAJOR, \
186  EM_VERSION_API_MINOR)
187 /**
188  * EM full version number
189  *
190  * EM version number for comparisons against the EM_VERSION_NUM()
191  * macro output.
192  *
193  * @code {.c}
194  * #if EM_VERSION > EM_VERSION_NUM(2, 7, 1, 3)
195  * ...code...
196  * #endif
197  * @endcode
198  */
199 #define EM_VERSION EM_VERSION_NUM(EM_VERSION_API_MAJOR, EM_VERSION_API_MINOR, \
200  EM_VERSION_IMPLEMENTATION, EM_VERSION_FIX)
201 
202 /**
203  * EM API version string
204  *
205  * Runtime EM API version string.
206  * Runtime and build-time versions might differ if the EM library has been
207  * updated after the application build.
208  *
209  * The API version string defines the EM API version in this format:
210  * @verbatim maj.min @endverbatim
211  *
212  * The string is null terminated.
213  *
214  * @return Pointer to the API version string
215  */
216 const char *em_version_api_str(void);
217 
218 /**
219  * EM API version number
220  *
221  * Runtime EM API version number.
222  * Runtime and build-time versions might differ if the EM library has been
223  * updated after the application build.
224  *
225  * @return EM API version packed into an unsigned int
226  */
227 unsigned int em_version_api_num(void);
228 
229 /**
230  * EM full version string
231  *
232  * Runtime EM version string.
233  * Runtime and build-time versions might differ if the EM library has been
234  * updated after the application build.
235  *
236  * The version string defines the EM full version in this format:
237  * @verbatim maj.min.impl(-fix) @endverbatim
238  * where -fix is only added for bugfix versions (i.e. -fix > 0)
239  *
240  * The string is null terminated.
241  *
242  * @return Pointer to the version string
243  */
244 const char *em_version_str(void);
245 
246 /**
247  * EM full version number
248  *
249  * Runtime EM version number.
250  * Runtime and build-time versions might differ if the EM library has been
251  * updated after the application build.
252  *
253  * @return EM full version packed into an unsigned int
254  */
255 unsigned int em_version_num(void);
256 
257 /**
258  * @}
259  */
260 #ifdef __cplusplus
261 }
262 #endif
263 
264 #pragma GCC visibility pop
265 #endif /* EVENT_MACHINE_VERSION_H */
em_version_api_str
const char * em_version_api_str(void)
Definition: em_version.c:33
em_version_num
unsigned int em_version_num(void)
Definition: em_version.c:48
em_version_api_num
unsigned int em_version_api_num(void)
Definition: em_version.c:38
em_version_str
const char * em_version_str(void)
Definition: em_version.c:43