Botan 3.4.0
Crypto and TLS for C&
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
14namespace 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*/
25BOTAN_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*/
32BOTAN_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*/
38BOTAN_PUBLIC_API(2, 4) std::string short_version_string();
39
40/**
41* Same as version_short_string except returning a pointer to the string.
42*/
43BOTAN_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*/
53BOTAN_PUBLIC_API(2, 0) uint32_t version_datestamp();
54
55/**
56* Get the major version number.
57* @return major version number
58*/
59BOTAN_PUBLIC_API(2, 0) uint32_t version_major();
60
61/**
62* Get the minor version number.
63* @return minor version number
64*/
65BOTAN_PUBLIC_API(2, 0) uint32_t version_minor();
66
67/**
68* Get the patch number.
69* @return patch number
70*/
71BOTAN_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*/
79BOTAN_PUBLIC_API(2, 0) std::string runtime_version_check(uint32_t major, uint32_t minor, uint32_t patch);
80
81/*
82* Macros for compile-time version checks
83*/
84#define BOTAN_VERSION_CODE_FOR(a, b, c) ((a << 16) | (b << 8) | (c))
85
86/**
87* Compare using BOTAN_VERSION_CODE_FOR, as in
88* # if BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(1,8,0)
89* # error "Botan version too old"
90* # endif
91*/
92#define BOTAN_VERSION_CODE BOTAN_VERSION_CODE_FOR(BOTAN_VERSION_MAJOR, BOTAN_VERSION_MINOR, BOTAN_VERSION_PATCH)
93
94} // namespace Botan
95
96#endif
#define BOTAN_PUBLIC_API(maj, min)
Definition compiler.h:31
uint32_t version_minor()
Definition version.cpp:86
std::string version_string()
Definition version.cpp:67
const char * short_version_cstr()
Definition version.cpp:25
uint32_t version_major()
Definition version.cpp:82
const char * version_cstr()
Definition version.cpp:33
uint32_t version_datestamp()
Definition version.cpp:75
uint32_t version_patch()
Definition version.cpp:90
std::string short_version_string()
Definition version.cpp:71
std::string runtime_version_check(uint32_t major, uint32_t minor, uint32_t patch)
Definition version.cpp:94