Botan  2.8.0
Crypto and TLS for C++11
version.h
Go to the documentation of this file.
1 /*
2 * Version Information
3 * (C) 1999-2011,2015 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #ifndef BOTAN_VERSION_H_
9 #define BOTAN_VERSION_H_
10 
11 #include <botan/types.h>
12 #include <string>
13 
14 namespace Botan {
15 
16 /*
17 * Get information describing the version
18 */
19 
20 /**
21 * Get a human-readable string identifying the version of Botan.
22 * No particular format should be assumed.
23 * @return version string
24 */
25 BOTAN_PUBLIC_API(2,0) std::string version_string();
26 
27 /**
28 * Same as version_string() except returning a pointer to a statically
29 * allocated string.
30 * @return version string
31 */
32 BOTAN_PUBLIC_API(2,0) const char* version_cstr();
33 
34 /**
35 * Return a version string of the form "MAJOR.MINOR.PATCH" where
36 * each of the values is an integer.
37 */
39 
40 /**
41 * Same as version_short_string except returning a pointer to the string.
42 */
43 BOTAN_PUBLIC_API(2,4) const char* short_version_cstr();
44 
45 /**
46 * Return the date this version of botan was released, in an integer of
47 * the form YYYYMMDD. For instance a version released on May 21, 2013
48 * would return the integer 20130521. If the currently running version
49 * is not an official release, this function will return 0 instead.
50 *
51 * @return release date, or zero if unreleased
52 */
53 BOTAN_PUBLIC_API(2,0) uint32_t version_datestamp();
54 
55 /**
56 * Get the major version number.
57 * @return major version number
58 */
59 BOTAN_PUBLIC_API(2,0) uint32_t version_major();
60 
61 /**
62 * Get the minor version number.
63 * @return minor version number
64 */
65 BOTAN_PUBLIC_API(2,0) uint32_t version_minor();
66 
67 /**
68 * Get the patch number.
69 * @return patch number
70 */
71 BOTAN_PUBLIC_API(2,0) uint32_t version_patch();
72 
73 /**
74 * Usable for checking that the DLL version loaded at runtime exactly
75 * matches the compile-time version. Call using BOTAN_VERSION_* macro
76 * values. Returns the empty string if an exact match, otherwise an
77 * appropriate message. Added with 1.11.26.
78 */
79 BOTAN_PUBLIC_API(2,0) std::string
80 runtime_version_check(uint32_t major,
81  uint32_t minor,
82  uint32_t patch);
83 
84 /*
85 * Macros for compile-time version checks
86 */
87 #define BOTAN_VERSION_CODE_FOR(a,b,c) ((a << 16) | (b << 8) | (c))
88 
89 /**
90 * Compare using BOTAN_VERSION_CODE_FOR, as in
91 * # if BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(1,8,0)
92 * # error "Botan version too old"
93 * # endif
94 */
95 #define BOTAN_VERSION_CODE BOTAN_VERSION_CODE_FOR(BOTAN_VERSION_MAJOR, \
96  BOTAN_VERSION_MINOR, \
97  BOTAN_VERSION_PATCH)
98 
99 }
100 
101 #endif
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:27
Definition: bigint.h:891
uint32_t version_major()
Definition: version.cpp:72
uint32_t version_patch()
Definition: version.cpp:74
const char * short_version_cstr()
Definition: version.cpp:22
Definition: alg_id.cpp:13
uint32_t version_minor()
Definition: version.cpp:73
std::string short_version_string()
Definition: version.cpp:62
uint32_t version_datestamp()
Definition: version.cpp:67
std::string runtime_version_check(uint32_t major, uint32_t minor, uint32_t patch)
Definition: version.cpp:76
std::string version_string()
Definition: version.cpp:57
const char * version_cstr()
Definition: version.cpp:29