aboutsummaryrefslogtreecommitdiff
path: root/src/common/util.h
diff options
context:
space:
mode:
authorLee Clagett <code@leeclagett.com>2016-12-16 18:08:24 -0500
committerLee Clagett <code@leeclagett.com>2016-12-16 23:59:46 -0500
commit427054c3d50198dff65b5e003165b1f564ebd26f (patch)
tree185a13198aa77320c1b5220497f27366ecbb3465 /src/common/util.h
parentMerge pull request #1459 (diff)
downloadmonero-427054c3d50198dff65b5e003165b1f564ebd26f.tar.xz
Enabled HTTP auth support for monero-wallet-rpc
Diffstat (limited to 'src/common/util.h')
-rw-r--r--src/common/util.h27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/common/util.h b/src/common/util.h
index 4fcf66b8f..3bb9a053e 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -30,13 +30,15 @@
#pragma once
-#include <mutex>
-#include <system_error>
-#include <boost/filesystem.hpp>
+#include <boost/thread/locks.hpp>
+#include <boost/thread/mutex.hpp>
+#include <csignal>
+#include <cstdio>
+#include <functional>
+#include <memory>
+#include <string>
-#include "crypto/crypto.h"
#include "crypto/hash.h"
-#include "misc_language.h"
#include "p2p/p2p_protocol_defs.h"
/*! \brief Various Tools
@@ -46,6 +48,21 @@
*/
namespace tools
{
+ //! Functional class for closing C file handles.
+ struct close_file
+ {
+ void operator()(std::FILE* handle) const noexcept
+ {
+ if (handle)
+ {
+ std::fclose(handle);
+ }
+ }
+ };
+
+ //! \return File only readable by owner. nullptr if `filename` exists.
+ std::unique_ptr<std::FILE, close_file> create_private_file(const std::string& filename);
+
/*! \brief Returns the default data directory.
*
* \details Windows < Vista: C:\\Documents and Settings\\Username\\Application Data\\CRYPTONOTE_NAME