1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2011, 2015 Red Hat, Inc.
4 */
5
6#ifndef __NM_VERSION_MACROS_H__
7#define __NM_VERSION_MACROS_H__
8
9/* This header must not include glib or libnm. */
10
11/**
12 * NM_MAJOR_VERSION:
13 *
14 * Evaluates to the major version number of NetworkManager which this source
15 * is compiled against.
16 */
17#define NM_MAJOR_VERSION (1)
18
19/**
20 * NM_MINOR_VERSION:
21 *
22 * Evaluates to the minor version number of NetworkManager which this source
23 * is compiled against.
24 */
25#define NM_MINOR_VERSION (36)
26
27/**
28 * NM_MICRO_VERSION:
29 *
30 * Evaluates to the micro version number of NetworkManager which this source
31 * compiled against.
32 */
33#define NM_MICRO_VERSION (6)
34
35/**
36 * NM_CHECK_VERSION:
37 * @major: major version (e.g. 1 for version 1.2.5)
38 * @minor: minor version (e.g. 2 for version 1.2.5)
39 * @micro: micro version (e.g. 5 for version 1.2.5)
40 *
41 * Returns: %TRUE if the version of the NetworkManager header files
42 * is the same as or newer than the passed-in version.
43 */
44#define NM_CHECK_VERSION(major,minor,micro) \
45 (NM_MAJOR_VERSION > (major) || \
46 (NM_MAJOR_VERSION == (major) && NM_MINOR_VERSION > (minor)) || \
47 (NM_MAJOR_VERSION == (major) && NM_MINOR_VERSION == (minor) && NM_MICRO_VERSION >= (micro)))
48
49
50#define NM_ENCODE_VERSION(major,minor,micro) ((major) << 16 | (minor) << 8 | (micro))
51
52#define NM_VERSION_0_9_8 (NM_ENCODE_VERSION (0, 9, 8))
53#define NM_VERSION_0_9_10 (NM_ENCODE_VERSION (0, 9, 10))
54#define NM_VERSION_1_0 (NM_ENCODE_VERSION (1, 0, 0))
55#define NM_VERSION_1_2 (NM_ENCODE_VERSION (1, 2, 0))
56#define NM_VERSION_1_4 (NM_ENCODE_VERSION (1, 4, 0))
57#define NM_VERSION_1_6 (NM_ENCODE_VERSION (1, 6, 0))
58#define NM_VERSION_1_8 (NM_ENCODE_VERSION (1, 8, 0))
59#define NM_VERSION_1_10 (NM_ENCODE_VERSION (1, 10, 0))
60#define NM_VERSION_1_12 (NM_ENCODE_VERSION (1, 12, 0))
61#define NM_VERSION_1_14 (NM_ENCODE_VERSION (1, 14, 0))
62#define NM_VERSION_1_16 (NM_ENCODE_VERSION (1, 16, 0))
63#define NM_VERSION_1_18 (NM_ENCODE_VERSION (1, 18, 0))
64#define NM_VERSION_1_20 (NM_ENCODE_VERSION (1, 20, 0))
65#define NM_VERSION_1_22 (NM_ENCODE_VERSION (1, 22, 0))
66#define NM_VERSION_1_24 (NM_ENCODE_VERSION (1, 24, 0))
67#define NM_VERSION_1_26 (NM_ENCODE_VERSION (1, 26, 0))
68#define NM_VERSION_1_28 (NM_ENCODE_VERSION (1, 28, 0))
69#define NM_VERSION_1_30 (NM_ENCODE_VERSION (1, 30, 0))
70#define NM_VERSION_1_32 (NM_ENCODE_VERSION (1, 32, 0))
71#define NM_VERSION_1_34 (NM_ENCODE_VERSION (1, 34, 0))
72#define NM_VERSION_1_36 (NM_ENCODE_VERSION (1, 36, 0))
73
74/* For releases, NM_API_VERSION is equal to NM_VERSION.
75 *
76 * For development builds, NM_API_VERSION is the next
77 * stable API after NM_VERSION. When you run a development
78 * version, you are already using the future API, even if
79 * it is not yet released. Hence, the currently used API
80 * version is the future one. */
81#define NM_API_VERSION \
82 (((NM_MINOR_VERSION % 2) == 1) \
83 ? NM_ENCODE_VERSION (NM_MAJOR_VERSION, NM_MINOR_VERSION + 1, 0 ) \
84 : NM_ENCODE_VERSION (NM_MAJOR_VERSION, NM_MINOR_VERSION , ((NM_MICRO_VERSION + 1) / 2) * 2))
85
86/* deprecated. */
87#define NM_VERSION_CUR_STABLE NM_API_VERSION
88
89/* deprecated. */
90#define NM_VERSION_NEXT_STABLE NM_API_VERSION
91
92#define NM_VERSION NM_ENCODE_VERSION (NM_MAJOR_VERSION, NM_MINOR_VERSION, NM_MICRO_VERSION)
93
94#endif /* __NM_VERSION_MACROS_H__ */
95

source code of include/libnm/nm-version-macros.h