Botan  2.1.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_DLL std::string version_string();
26 
27 BOTAN_DLL const char* version_cstr();
28 
29 /**
30 * Return the date this version of botan was released, in an integer of
31 * the form YYYYMMDD. For instance a version released on May 21, 2013
32 * would return the integer 20130521. If the currently running version
33 * is not an official release, this function will return 0 instead.
34 *
35 * @return release date, or zero if unreleased
36 */
37 BOTAN_DLL uint32_t version_datestamp();
38 
39 /**
40 * Get the major version number.
41 * @return major version number
42 */
43 BOTAN_DLL uint32_t version_major();
44 
45 /**
46 * Get the minor version number.
47 * @return minor version number
48 */
49 BOTAN_DLL uint32_t version_minor();
50 
51 /**
52 * Get the patch number.
53 * @return patch number
54 */
55 BOTAN_DLL uint32_t version_patch();
56 
57 /**
58 * Usable for checking that the DLL version loaded at runtime exactly
59 * matches the compile-time version. Call using BOTAN_VERSION_* macro
60 * values. Returns the empty string if an exact match, otherwise an
61 * appropriate message. Added with 1.11.26.
62 */
63 BOTAN_DLL std::string
64 runtime_version_check(uint32_t major,
65  uint32_t minor,
66  uint32_t patch);
67 
68 /*
69 * Macros for compile-time version checks
70 */
71 #define BOTAN_VERSION_CODE_FOR(a,b,c) ((a << 16) | (b << 8) | (c))
72 
73 /**
74 * Compare using BOTAN_VERSION_CODE_FOR, as in
75 * # if BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(1,8,0)
76 * # error "Botan version too old"
77 * # endif
78 */
79 #define BOTAN_VERSION_CODE BOTAN_VERSION_CODE_FOR(BOTAN_VERSION_MAJOR, \
80  BOTAN_VERSION_MINOR, \
81  BOTAN_VERSION_PATCH)
82 
83 }
84 
85 #endif
uint32_t version_minor()
Definition: version.cpp:61
std::string version_string()
Definition: version.cpp:23
const char * version_cstr()
Definition: version.cpp:28
uint32_t version_datestamp()
Definition: version.cpp:55
uint32_t version_major()
Definition: version.cpp:60
Definition: alg_id.cpp:13
std::string runtime_version_check(uint32_t major, uint32_t minor, uint32_t patch)
Definition: version.cpp:64
uint32_t version_patch()
Definition: version.cpp:62