dodo  0.0.1
A C++ library to create containerized Linux services
common.hpp
Go to the documentation of this file.
1 /*
2  * This file is part of the dodo library (https://github.com/jmspit/dodo).
3  * Copyright (c) 2019 Jan-Marten Spit.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, version 3.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 /**
19  * @file common.hpp
20  * Includes network headers and implements network::initLibrary() and network::closeLibrary().
21  */
22 
23 #ifndef dodo_common_common_hpp
24 #define dodo_common_common_hpp
25 
26 #include <common/application.hpp>
27 #include <common/cache.hpp>
28 #include <common/config.hpp>
29 #include <common/datacrypt.hpp>
30 #include <common/exception.hpp>
31 #include <common/bytes.hpp>
32 #include <common/puts.hpp>
33 #include <common/systemerror.hpp>
34 #include <common/util.hpp>
35 
36 #include <openssl/rand.h>
37 
38 namespace dodo {
39 
40  /**
41  * Common and utility interfaces.
42  */
43  namespace common {
44 
45  /**
46  * Initialize the common library.
47  */
48  void initLibrary() {
49  // Tell OpenSSL where to get entropy
50  if ( RAND_load_file( "/dev/urandom", 32 ) != 32 ) {
51  throw_Exception( "unable to seed from /dev/urandom" );
52  }
53  }
54 
55  /**
56  * Close the common library.
57  */
58  void closeLibrary() {
59  }
60 
61  }
62 
63 }
64 
65 #endif
config.hpp
puts.hpp
dodo::common::closeLibrary
void closeLibrary()
Close the common library.
Definition: common.hpp:58
dodo
A C++ platform interface to lean Linux services tailored for containerized deployment.
Definition: application.hpp:29
dodo::common::initLibrary
void initLibrary()
Initialize the common library.
Definition: common.hpp:48
throw_Exception
#define throw_Exception(what)
Throws an Exception, passes FILE and LINE to constructor.
Definition: exception.hpp:174
datacrypt.hpp
application.hpp
exception.hpp
systemerror.hpp
cache.hpp
bytes.hpp
util.hpp