Botan 2.19.5 Crypto and TLS for C&

locking_allocator.h
Go to the documentation of this file.
1/*
2* Mlock Allocator
3* (C) 2012 Jack Lloyd
4*
5* Botan is released under the Simplified BSD License (see license.txt)
6*/
7
8#ifndef BOTAN_MLOCK_ALLOCATOR_H_
9#define BOTAN_MLOCK_ALLOCATOR_H_
10
11#include <botan/types.h>
12#include <vector>
13#include <memory>
14
15 BOTAN_FUTURE_INTERNAL_HEADER(locking_allocator.h)
16
17namespace Botan {
18
19 class Memory_Pool;
20
21 class BOTAN_PUBLIC_API(2,0) mlock_allocator final
22 {
23 public:
24 static mlock_allocator& instance();
25
26 void* allocate(size_t num_elems, size_t elem_size);
27
28 bool deallocate(void* p, size_t num_elems, size_t elem_size) noexcept;
29
30 mlock_allocator(const mlock_allocator&) = delete;
31
32 mlock_allocator& operator=(const mlock_allocator&) = delete;
33
34 private:
35 mlock_allocator();
36
37 ~mlock_allocator();
38
39 std::unique_ptr<Memory_Pool> m_pool;
40 std::vector<void*> m_locked_pages;
41 };
42
43}
44
45#endif
Botan::mlock_allocator
Definition: locking_allocator.h:22
Botan::mlock_allocator::operator=
mlock_allocator & operator=(const mlock_allocator &)=delete
Botan::mlock_allocator::mlock_allocator
mlock_allocator(const mlock_allocator &)=delete
final
int(* final)(unsigned char *, CTX *)
Definition: commoncrypto_hash.cpp:29
BOTAN_PUBLIC_API
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:31
BOTAN_FUTURE_INTERNAL_HEADER
#define BOTAN_FUTURE_INTERNAL_HEADER(hdr)
Definition: compiler.h:136
Botan
Definition: alg_id.cpp:13