updated build system
This commit is contained in:
@ -48,113 +48,7 @@
|
||||
|
||||
#if defined(__cplusplus)
|
||||
REPERTORY_IGNORE_WARNINGS_ENABLE()
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define WINVER 0x0602
|
||||
#define _WIN32_WINNT WINVER
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <windows.h>
|
||||
#include <shellapi.h>
|
||||
#include <shlwapi.h>
|
||||
#include <shlobj.h>
|
||||
#include <ciso646>
|
||||
#include <direct.h>
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
#include <time.h>
|
||||
#else
|
||||
#include <climits>
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <grp.h>
|
||||
#include <libgen.h>
|
||||
#include <pwd.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/stat.h>
|
||||
#if defined(__linux__)
|
||||
#include <sys/statfs.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#if defined(HAS_SETXATTR)
|
||||
#include <sys/types.h>
|
||||
#include <sys/xattr.h>
|
||||
#endif
|
||||
#if defined(__APPLE__)
|
||||
#include <libproc.h>
|
||||
#include <sys/attr.h>
|
||||
#include <sys/vnode.h>
|
||||
#endif
|
||||
#if defined(__APPLE__)
|
||||
#include <sys/mount.h>
|
||||
#include <sys/statvfs.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <codecvt>
|
||||
#include <condition_variable>
|
||||
#include <deque>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <future>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <mutex>
|
||||
#include <optional>
|
||||
#include <random>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <thread>
|
||||
#include <type_traits>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "sodium.h"
|
||||
template <typename data_type>
|
||||
[[nodiscard]] inline auto repertory_rand() -> data_type {
|
||||
data_type ret{};
|
||||
randombytes_buf(&ret, sizeof(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include "boost/archive/text_iarchive.hpp"
|
||||
#include "boost/archive/text_oarchive.hpp"
|
||||
#include "boost/asio.hpp"
|
||||
#include "boost/asio/io_context.hpp"
|
||||
#include "boost/bind/bind.hpp"
|
||||
#include "boost/dynamic_bitset.hpp"
|
||||
#include "boost/dynamic_bitset/serialization.hpp"
|
||||
#include "boost/endian/conversion.hpp"
|
||||
#include "boost/serialization/vector.hpp"
|
||||
#include "curl/curl.h"
|
||||
#include "curl/multi.h"
|
||||
#include "json.hpp"
|
||||
#include "sqlite3.h"
|
||||
#include "uuid.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <sddl.h>
|
||||
#include "winfsp/winfsp.hpp"
|
||||
#else
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
#include <fuse.h>
|
||||
#include <fuse_lowlevel.h>
|
||||
#else
|
||||
#include <fuse/fuse.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "pugixml.hpp"
|
||||
|
||||
#include "httplib.h"
|
||||
|
||||
#include "utils/config.hpp"
|
||||
REPERTORY_IGNORE_WARNINGS_DISABLE()
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
@ -279,26 +173,6 @@ inline constexpr const auto NANOS_PER_SECOND = 1000000000L;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef fstat64
|
||||
#define fstat64 fstat
|
||||
#endif
|
||||
|
||||
#ifndef pread64
|
||||
#define pread64 pread
|
||||
#endif
|
||||
|
||||
#ifndef pwrite64
|
||||
#define pwrite64 pwrite
|
||||
#endif
|
||||
|
||||
#ifndef stat64
|
||||
#define stat64 stat
|
||||
#endif
|
||||
|
||||
#ifndef statfs64
|
||||
#define statfs64 statfs
|
||||
#endif
|
||||
|
||||
#define WINFSP_ALLOCATION_UNIT UINT64(4096U)
|
||||
|
||||
#if defined(_WIN32)
|
||||
@ -409,13 +283,6 @@ using FileInfo = FSP_FSCTL_FILE_INFO;
|
||||
|
||||
using namespace Fsp;
|
||||
|
||||
namespace {
|
||||
template <class... Ts> struct overloaded : Ts... {
|
||||
using Ts::operator()...;
|
||||
};
|
||||
template <class... Ts> overloaded(Ts...) -> overloaded<Ts...>;
|
||||
} // namespace
|
||||
|
||||
#define INTERFACE_SETUP(name) \
|
||||
public: \
|
||||
name(const name &) noexcept = delete; \
|
||||
|
@ -24,7 +24,7 @@
|
||||
#if !defined(_WIN32)
|
||||
|
||||
#include "events/event_system.hpp"
|
||||
#include "utils/path_utils.hpp"
|
||||
#include "utils/path.hpp"
|
||||
|
||||
namespace repertory {
|
||||
class app_config;
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "types/remote.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "utils/base64.hpp"
|
||||
#include "utils/path_utils.hpp"
|
||||
#include "utils/path.hpp"
|
||||
|
||||
#define REPERTORY_DIRECTORY_PAGE_SIZE std::size_t(100U)
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include "events/event.hpp"
|
||||
#include "events/t_event_system.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
#include "utils/string.hpp"
|
||||
|
||||
namespace repertory {
|
||||
using event_system = t_event_system<event>;
|
||||
|
@ -23,6 +23,7 @@
|
||||
#define INCLUDE_EVENTS_T_EVENT_SYSTEM_HPP_
|
||||
|
||||
#include "events/event.hpp"
|
||||
#include "utils/collection.hpp"
|
||||
#include "utils/utils.hpp"
|
||||
|
||||
namespace repertory {
|
||||
@ -151,14 +152,14 @@ public:
|
||||
|
||||
void release(event_consumer *consumer) {
|
||||
recur_mutex_lock lock(consumer_mutex_);
|
||||
auto iter =
|
||||
std::find_if(event_consumers_.begin(), event_consumers_.end(),
|
||||
[&](const auto &item) -> bool {
|
||||
return utils::collection_includes(item.second, consumer);
|
||||
});
|
||||
auto iter = std::find_if(event_consumers_.begin(), event_consumers_.end(),
|
||||
[&](const auto &item) -> bool {
|
||||
return utils::collection::includes(item.second,
|
||||
consumer);
|
||||
});
|
||||
|
||||
if (iter != event_consumers_.end()) {
|
||||
utils::remove_element_from((*iter).second, consumer);
|
||||
utils::collection::remove_element((*iter).second, consumer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,6 +102,12 @@ enum class api_error {
|
||||
api_error_to_string(const api_error &error) -> const std::string &;
|
||||
|
||||
enum class download_type { direct, fallback, ring_buffer };
|
||||
[[nodiscard]] auto
|
||||
download_type_from_string(std::string type,
|
||||
const download_type &default_type) -> download_type;
|
||||
|
||||
[[nodiscard]] auto
|
||||
download_type_to_string(const download_type &type) -> std::string;
|
||||
|
||||
enum class exit_code : std::int32_t {
|
||||
success,
|
||||
|
@ -23,7 +23,7 @@
|
||||
#define INCLUDE_TYPES_S3_HPP_
|
||||
|
||||
#include "types/repertory.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
#include "utils/string.hpp"
|
||||
#include "utils/utils.hpp"
|
||||
|
||||
namespace repertory {
|
||||
|
@ -1,170 +0,0 @@
|
||||
// NOLINTBEGIN
|
||||
#ifndef _MACARON_BASE64_H_
|
||||
#define _MACARON_BASE64_H_
|
||||
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
* Copyright (c) 2016 tomykaira
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunknown-warning-option"
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wconversion"
|
||||
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||
#pragma GCC diagnostic ignored "-Wuseless-cast"
|
||||
#endif
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace macaron::Base64 {
|
||||
static std::string Encode(const unsigned char *data, std::size_t len) {
|
||||
static constexpr std::array<unsigned char, 64U> sEncodingTable{
|
||||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
|
||||
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
|
||||
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
|
||||
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/',
|
||||
};
|
||||
|
||||
auto in_len{len};
|
||||
std::string ret;
|
||||
if (in_len > 0) {
|
||||
std::size_t out_len{4U * ((in_len + 2U) / 3U)};
|
||||
ret = std::string(out_len, '\0');
|
||||
std::size_t i;
|
||||
auto *p = reinterpret_cast<unsigned char *>(ret.data());
|
||||
|
||||
for (i = 0U; i < in_len - 2U; i += 3U) {
|
||||
*p++ = sEncodingTable[(data[i] >> 2U) & 0x3F];
|
||||
*p++ = sEncodingTable[((data[i] & 0x3) << 4U) |
|
||||
((int)(data[i + 1U] & 0xF0) >> 4U)];
|
||||
*p++ = sEncodingTable[((data[i + 1] & 0xF) << 2) |
|
||||
((int)(data[i + 2U] & 0xC0) >> 6U)];
|
||||
*p++ = sEncodingTable[data[i + 2U] & 0x3F];
|
||||
}
|
||||
if (i < in_len) {
|
||||
*p++ = sEncodingTable[(data[i] >> 2U) & 0x3F];
|
||||
if (i == (in_len - 1U)) {
|
||||
*p++ = sEncodingTable[((data[i] & 0x3) << 4U)];
|
||||
*p++ = '=';
|
||||
} else {
|
||||
*p++ = sEncodingTable[((data[i] & 0x3) << 4U) |
|
||||
((int)(data[i + 1U] & 0xF0) >> 4U)];
|
||||
*p++ = sEncodingTable[((data[i + 1U] & 0xF) << 2U)];
|
||||
}
|
||||
*p++ = '=';
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
[[maybe_unused]] static std::string Encode(std::string_view data) {
|
||||
return Encode(reinterpret_cast<const unsigned char *>(data.data()),
|
||||
data.size());
|
||||
}
|
||||
|
||||
[[maybe_unused]] static std::vector<unsigned char>
|
||||
Decode(std::string_view input) {
|
||||
static constexpr std::array<unsigned char, 256> kDecodingTable{
|
||||
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
|
||||
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
|
||||
64, 64, 64, 64, 64, 64, 64, 62, 64, 64, 64, 63, 52, 53, 54, 55, 56, 57,
|
||||
58, 59, 60, 61, 64, 64, 64, 64, 64, 64, 64, 0, 1, 2, 3, 4, 5, 6,
|
||||
7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
|
||||
25, 64, 64, 64, 64, 64, 64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
|
||||
37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 64, 64,
|
||||
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
|
||||
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
|
||||
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
|
||||
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
|
||||
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
|
||||
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
|
||||
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
|
||||
64, 64, 64, 64,
|
||||
};
|
||||
|
||||
std::vector<unsigned char> out;
|
||||
if (not input.empty()) {
|
||||
auto in_len{input.size()};
|
||||
if (in_len % 4U != 0U) {
|
||||
throw std::runtime_error("Input data size is not a multiple of 4");
|
||||
}
|
||||
|
||||
std::size_t out_len{in_len / 4U * 3U};
|
||||
if (input[in_len - 1U] == '=') {
|
||||
out_len--;
|
||||
}
|
||||
if (input[in_len - 2U] == '=') {
|
||||
out_len--;
|
||||
}
|
||||
|
||||
out.resize(out_len);
|
||||
|
||||
for (std::size_t i = 0U, j = 0U; i < in_len;) {
|
||||
std::uint32_t a = input[i] == '='
|
||||
? 0U & i++
|
||||
: kDecodingTable[static_cast<int>(input[i++])];
|
||||
std::uint32_t b = input[i] == '='
|
||||
? 0U & i++
|
||||
: kDecodingTable[static_cast<int>(input[i++])];
|
||||
std::uint32_t c = input[i] == '='
|
||||
? 0U & i++
|
||||
: kDecodingTable[static_cast<int>(input[i++])];
|
||||
std::uint32_t d = input[i] == '='
|
||||
? 0U & i++
|
||||
: kDecodingTable[static_cast<int>(input[i++])];
|
||||
|
||||
std::uint32_t triple =
|
||||
(a << 3U * 6U) + (b << 2U * 6U) + (c << 1U * 6U) + (d << 0U * 6U);
|
||||
|
||||
if (j < out_len)
|
||||
out[j++] = (triple >> 2U * 8U) & 0xFF;
|
||||
if (j < out_len)
|
||||
out[j++] = (triple >> 1U * 8U) & 0xFF;
|
||||
if (j < out_len)
|
||||
out[j++] = (triple >> 0U * 8U) & 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
} // namespace macaron::Base64
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif /* _MACARON_BASE64_H_ */
|
||||
|
||||
// NOLINTEND
|
@ -1,45 +0,0 @@
|
||||
/*
|
||||
Copyright <2018-2024> <scott.e.graves@protonmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#ifndef INCLUDE_UTILS_COM_INIT_WRAPPER_HPP_
|
||||
#define INCLUDE_UTILS_COM_INIT_WRAPPER_HPP_
|
||||
#if defined(_WIN32)
|
||||
|
||||
namespace repertory {
|
||||
class com_init_wrapper {
|
||||
public:
|
||||
com_init_wrapper()
|
||||
: uninit_(
|
||||
SUCCEEDED(::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED))) {}
|
||||
|
||||
~com_init_wrapper() {
|
||||
if (uninit_) {
|
||||
::CoUninitialize();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
const BOOL uninit_;
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
#endif // _WIN32
|
||||
#endif // INCLUDE_UTILS_COM_INIT_WRAPPER_HPP_
|
@ -23,6 +23,7 @@
|
||||
#define INCLUDE_UTILS_ENCRYPT_HPP_
|
||||
|
||||
#include "types/repertory.hpp"
|
||||
#include "utils/encryption.hpp"
|
||||
#include "utils/encrypting_reader.hpp"
|
||||
|
||||
namespace repertory::utils::encryption {
|
||||
@ -40,122 +41,6 @@ using reader_func = std::function<api_error(data_buffer &cypher_text,
|
||||
const key_type &key, reader_func reader,
|
||||
std::uint64_t total_size,
|
||||
data_buffer &data) -> api_error;
|
||||
|
||||
[[nodiscard]] auto generate_key(std::string_view encryption_token) -> key_type;
|
||||
|
||||
// Implementations
|
||||
template <typename result>
|
||||
[[nodiscard]] inline auto
|
||||
decrypt_data(const key_type &key, const unsigned char *buffer,
|
||||
std::size_t buffer_size, result &res) -> bool {
|
||||
const auto header_size =
|
||||
static_cast<std::uint32_t>(encrypting_reader::get_header_size());
|
||||
if (buffer_size > header_size) {
|
||||
const std::uint32_t size =
|
||||
boost::endian::native_to_big(static_cast<std::uint32_t>(buffer_size));
|
||||
res.resize(buffer_size - header_size);
|
||||
return crypto_aead_xchacha20poly1305_ietf_decrypt_detached(
|
||||
reinterpret_cast<unsigned char *>(res.data()), nullptr,
|
||||
&buffer[header_size], res.size(),
|
||||
&buffer[crypto_aead_xchacha20poly1305_IETF_NPUBBYTES],
|
||||
reinterpret_cast<const unsigned char *>(&size), sizeof(size),
|
||||
buffer, key.data()) == 0;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename buffer, typename result>
|
||||
[[nodiscard]] inline auto decrypt_data(const key_type &key, const buffer &buf,
|
||||
result &res) -> bool {
|
||||
return decrypt_data<result>(
|
||||
key, reinterpret_cast<const unsigned char *>(buf.data()), buf.size(),
|
||||
res);
|
||||
}
|
||||
|
||||
template <typename buffer, typename result>
|
||||
[[nodiscard]] inline auto decrypt_data(std::string_view encryption_token,
|
||||
const buffer &buf, result &res) -> bool {
|
||||
return decrypt_data<buffer, result>(generate_key(encryption_token), buf, res);
|
||||
}
|
||||
|
||||
template <typename result>
|
||||
[[nodiscard]] inline auto
|
||||
decrypt_data(std::string_view encryption_token, const unsigned char *buffer,
|
||||
std::size_t buffer_size, result &res) -> bool {
|
||||
return decrypt_data<result>(generate_key(encryption_token), buffer,
|
||||
buffer_size, res);
|
||||
}
|
||||
|
||||
template <typename result>
|
||||
inline void
|
||||
encrypt_data(const std::array<unsigned char,
|
||||
crypto_aead_xchacha20poly1305_IETF_NPUBBYTES> &iv,
|
||||
const key_type &key, const unsigned char *buffer,
|
||||
std::size_t buffer_size, result &res) {
|
||||
std::array<unsigned char, crypto_aead_xchacha20poly1305_IETF_ABYTES> mac{};
|
||||
|
||||
const auto header_size =
|
||||
static_cast<std::uint32_t>(encrypting_reader::get_header_size());
|
||||
|
||||
const std::uint32_t size = boost::endian::native_to_big(
|
||||
static_cast<std::uint32_t>(buffer_size + header_size));
|
||||
|
||||
res.resize(buffer_size + header_size);
|
||||
|
||||
unsigned long long mac_length{};
|
||||
if (crypto_aead_xchacha20poly1305_ietf_encrypt_detached(
|
||||
reinterpret_cast<unsigned char *>(&res[header_size]), mac.data(),
|
||||
&mac_length, buffer, buffer_size,
|
||||
reinterpret_cast<const unsigned char *>(&size), sizeof(size), nullptr,
|
||||
iv.data(), key.data()) != 0) {
|
||||
throw std::runtime_error("encryption failed");
|
||||
}
|
||||
|
||||
std::memcpy(res.data(), iv.data(), iv.size());
|
||||
std::memcpy(&res[iv.size()], mac.data(), mac.size());
|
||||
}
|
||||
|
||||
template <typename result>
|
||||
inline void encrypt_data(const key_type &key, const unsigned char *buffer,
|
||||
std::size_t buffer_size, result &res) {
|
||||
std::array<unsigned char, crypto_aead_xchacha20poly1305_IETF_NPUBBYTES> iv{};
|
||||
randombytes_buf(iv.data(), iv.size());
|
||||
|
||||
encrypt_data<result>(iv, key, buffer, buffer_size, res);
|
||||
}
|
||||
|
||||
template <typename result>
|
||||
inline void encrypt_data(std::string_view encryption_token,
|
||||
const unsigned char *buffer, std::size_t buffer_size,
|
||||
result &res) {
|
||||
encrypt_data<result>(generate_key(encryption_token), buffer, buffer_size,
|
||||
res);
|
||||
}
|
||||
|
||||
template <typename buffer, typename result>
|
||||
inline void encrypt_data(std::string_view encryption_token, const buffer &buf,
|
||||
result &res) {
|
||||
encrypt_data<result>(generate_key(encryption_token),
|
||||
reinterpret_cast<const unsigned char *>(buf.data()),
|
||||
buf.size(), res);
|
||||
}
|
||||
|
||||
template <typename buffer, typename result>
|
||||
inline void encrypt_data(const key_type &key, const buffer &buf, result &res) {
|
||||
encrypt_data<result>(key, reinterpret_cast<const unsigned char *>(buf.data()),
|
||||
buf.size(), res);
|
||||
}
|
||||
|
||||
template <typename buffer, typename result>
|
||||
inline void
|
||||
encrypt_data(const std::array<unsigned char,
|
||||
crypto_aead_xchacha20poly1305_IETF_NPUBBYTES> &iv,
|
||||
const key_type &key, const buffer &buf, result &res) {
|
||||
encrypt_data<result>(iv, key,
|
||||
reinterpret_cast<const unsigned char *>(buf.data()),
|
||||
buf.size(), res);
|
||||
}
|
||||
} // namespace repertory::utils::encryption
|
||||
|
||||
#endif // INCLUDE_UTILS_ENCRYPT_HPP_
|
||||
|
@ -23,6 +23,7 @@
|
||||
#define INCLUDE_UTILS_FILE_UTILS_HPP_
|
||||
|
||||
#include "types/repertory.hpp"
|
||||
#include "utils/file.hpp"
|
||||
#include "utils/native_file.hpp"
|
||||
|
||||
namespace repertory::utils::file {
|
||||
@ -62,16 +63,9 @@ get_free_drive_space(const std::string &path) -> std::uint64_t;
|
||||
[[nodiscard]] auto
|
||||
get_total_drive_space(const std::string &path) -> std::uint64_t;
|
||||
|
||||
[[nodiscard]] auto get_file_size(std::string_view path,
|
||||
std::uint64_t &file_size) -> bool;
|
||||
|
||||
[[nodiscard]] auto get_modified_time(const std::string &path,
|
||||
std::uint64_t &modified) -> bool;
|
||||
|
||||
[[nodiscard]] auto is_directory(const std::string &path) -> bool;
|
||||
|
||||
[[nodiscard]] auto is_file(const std::string &path) -> bool;
|
||||
|
||||
[[nodiscard]] auto
|
||||
is_modified_date_older_than(const std::string &path,
|
||||
const std::chrono::hours &hours) -> bool;
|
||||
@ -81,16 +75,11 @@ is_modified_date_older_than(const std::string &path,
|
||||
[[nodiscard]] auto
|
||||
read_file_lines(const std::string &path) -> std::vector<std::string>;
|
||||
|
||||
[[nodiscard]] auto read_json_file(const std::string &path, json &data) -> bool;
|
||||
|
||||
[[nodiscard]] auto reset_modified_time(const std::string &path) -> bool;
|
||||
|
||||
[[nodiscard]] auto retry_delete_directory(const std::string &dir) -> bool;
|
||||
|
||||
[[nodiscard]] auto retry_delete_file(const std::string &file) -> bool;
|
||||
|
||||
[[nodiscard]] auto write_json_file(const std::string &path,
|
||||
const json &j) -> bool;
|
||||
} // namespace repertory::utils::file
|
||||
|
||||
#endif // INCLUDE_UTILS_FILE_UTILS_HPP_
|
||||
|
@ -1,66 +0,0 @@
|
||||
/*
|
||||
Copyright <2018-2024> <scott.e.graves@protonmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#ifndef INCLUDE_UTILS_PATH_UTILS_HPP_
|
||||
#define INCLUDE_UTILS_PATH_UTILS_HPP_
|
||||
|
||||
namespace repertory::utils::path {
|
||||
#if defined(_WIN32)
|
||||
static const std::string directory_seperator = "\\";
|
||||
static const std::string not_directory_seperator = "/";
|
||||
#else
|
||||
static const std::string directory_seperator = "/";
|
||||
static const std::string not_directory_seperator = "\\";
|
||||
#endif
|
||||
|
||||
// Prototypes
|
||||
[[nodiscard]] auto absolute(std::string path) -> std::string;
|
||||
|
||||
[[nodiscard]] auto
|
||||
combine(std::string path, const std::vector<std::string> &paths) -> std::string;
|
||||
|
||||
[[nodiscard]] auto create_api_path(std::string path) -> std::string;
|
||||
|
||||
[[nodiscard]] auto finalize(std::string path) -> std::string;
|
||||
|
||||
auto format_path(std::string &path, const std::string &sep,
|
||||
const std::string ¬_sep) -> std::string &;
|
||||
|
||||
[[nodiscard]] auto get_parent_api_path(const std::string &path) -> std::string;
|
||||
|
||||
#if !defined(_WIN32)
|
||||
[[nodiscard]] auto get_parent_directory(std::string path) -> std::string;
|
||||
#endif
|
||||
|
||||
[[nodiscard]] auto is_ads_file_path(const std::string &path) -> bool;
|
||||
|
||||
[[nodiscard]] auto is_trash_directory(std::string path) -> bool;
|
||||
|
||||
[[nodiscard]] auto remove_file_name(std::string path) -> std::string;
|
||||
|
||||
#if !defined(_WIN32)
|
||||
[[nodiscard]] auto resolve(std::string path) -> std::string;
|
||||
#endif
|
||||
|
||||
[[nodiscard]] auto strip_to_file_name(std::string path) -> std::string;
|
||||
} // namespace repertory::utils::path
|
||||
|
||||
#endif // INCLUDE_UTILS_PATH_UTILS_HPP_
|
@ -1,114 +0,0 @@
|
||||
/*
|
||||
Copyright <2018-2024> <scott.e.graves@protonmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#ifndef INCLUDE_UTILS_STRING_UTILS_HPP_
|
||||
#define INCLUDE_UTILS_STRING_UTILS_HPP_
|
||||
|
||||
namespace repertory::utils::string {
|
||||
// Prototypes
|
||||
constexpr auto begins_with(std::string_view str, std::string_view val) -> bool {
|
||||
return (str.find(val) == 0U);
|
||||
}
|
||||
|
||||
constexpr auto contains(std::string_view str, std::string_view search) -> bool {
|
||||
return (str.find(search) != std::string_view::npos);
|
||||
}
|
||||
|
||||
[[nodiscard]] /* constexpr c++20 */ auto
|
||||
ends_with(std::string_view str, std::string_view val) -> bool;
|
||||
|
||||
[[nodiscard]] auto from_bool(bool val) -> std::string;
|
||||
|
||||
[[nodiscard]] auto
|
||||
from_dynamic_bitset(const boost::dynamic_bitset<> &bitset) -> std::string;
|
||||
|
||||
[[nodiscard]] auto from_utf8(std::string_view str) -> std::wstring;
|
||||
|
||||
[[nodiscard]] /* constexpr c++20 */ auto
|
||||
is_numeric(std::string_view str) -> bool;
|
||||
|
||||
[[nodiscard]] auto join(const std::vector<std::string> &arr,
|
||||
const char &delim) -> std::string;
|
||||
|
||||
auto left_trim(std::string &str) -> std::string &;
|
||||
|
||||
auto left_trim(std::string &str, const char &trim_ch) -> std::string &;
|
||||
|
||||
auto replace(std::string &src, const char &character,
|
||||
const char &with) -> std::string &;
|
||||
|
||||
auto replace(std::string &src, const std::string &find, const std::string &with,
|
||||
size_t start_pos = 0) -> std::string &;
|
||||
|
||||
[[nodiscard]] auto replace_copy(std::string src, const char &character,
|
||||
const char &with) -> std::string;
|
||||
|
||||
[[nodiscard]] auto replace_copy(std::string src, const std::string &find,
|
||||
const std::string &with,
|
||||
size_t start_pos = 0) -> std::string;
|
||||
|
||||
auto right_trim(std::string &str) -> std::string &;
|
||||
|
||||
auto right_trim(std::string &str, const char &trim_ch) -> std::string &;
|
||||
|
||||
[[nodiscard]] auto split(const std::string &str, const char &delim,
|
||||
bool should_trim = true) -> std::vector<std::string>;
|
||||
|
||||
[[nodiscard]] auto to_bool(std::string val) -> bool;
|
||||
|
||||
[[nodiscard]] auto to_double(const std::string &str) -> double;
|
||||
|
||||
[[nodiscard]] auto
|
||||
to_dynamic_bitset(const std::string &val) -> boost::dynamic_bitset<>;
|
||||
|
||||
[[nodiscard]] auto to_lower(std::string str) -> std::string;
|
||||
|
||||
[[nodiscard]] auto to_int32(const std::string &val) -> std::int32_t;
|
||||
|
||||
[[nodiscard]] auto to_int64(const std::string &val) -> std::int64_t;
|
||||
|
||||
[[nodiscard]] auto to_size_t(const std::string &val) -> std::size_t;
|
||||
|
||||
[[nodiscard]] auto to_uint8(const std::string &val) -> std::uint8_t;
|
||||
|
||||
[[nodiscard]] auto to_uint16(const std::string &val) -> std::uint16_t;
|
||||
|
||||
[[nodiscard]] auto to_uint32(const std::string &val) -> std::uint32_t;
|
||||
|
||||
[[nodiscard]] auto to_uint64(const std::string &val) -> std::uint64_t;
|
||||
|
||||
[[nodiscard]] auto to_upper(std::string str) -> std::string;
|
||||
|
||||
[[nodiscard]] auto to_utf8(std::string_view str) -> std::string;
|
||||
|
||||
[[nodiscard]] auto to_utf8(std::wstring_view str) -> std::string;
|
||||
|
||||
auto trim(std::string &str) -> std::string &;
|
||||
|
||||
auto trim(std::string &str, const char &trim_ch) -> std::string &;
|
||||
|
||||
[[nodiscard]] auto trim_copy(std::string str) -> std::string;
|
||||
|
||||
[[nodiscard]] auto trim_copy(std::string str,
|
||||
const char &trim_ch) -> std::string;
|
||||
} // namespace repertory::utils::string
|
||||
|
||||
#endif // INCLUDE_UTILS_STRING_UTILS_HPP_
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include "types/remote.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "utils/unix.hpp"
|
||||
|
||||
namespace repertory::utils {
|
||||
#if defined(__linux__)
|
||||
@ -35,25 +36,8 @@ inline const std::array<std::string, 4U> attribute_namespaces = {
|
||||
"user",
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
template <typename t>
|
||||
[[nodiscard]] auto convert_to_uint64(const t *ptr) -> std::uint64_t;
|
||||
#else
|
||||
[[nodiscard]] auto convert_to_uint64(const pthread_t &thread) -> std::uint64_t;
|
||||
#endif
|
||||
|
||||
[[nodiscard]] auto from_api_error(const api_error &err) -> int;
|
||||
|
||||
[[nodiscard]] auto get_last_error_code() -> int;
|
||||
|
||||
[[nodiscard]] auto get_thread_id() -> std::uint64_t;
|
||||
|
||||
[[nodiscard]] auto is_uid_member_of_group(const uid_t &uid,
|
||||
const gid_t &gid) -> bool;
|
||||
|
||||
void set_last_error_code(int error_code);
|
||||
|
||||
[[nodiscard]] auto to_api_error(int err) -> api_error;
|
||||
|
||||
[[nodiscard]] auto unix_error_to_windows(int err) -> std::int32_t;
|
||||
@ -61,22 +45,12 @@ void set_last_error_code(int error_code);
|
||||
[[nodiscard]] auto
|
||||
unix_time_to_windows_time(const remote::file_time &file_time) -> UINT64;
|
||||
|
||||
void use_getpwuid(uid_t uid, std::function<void(struct passwd *pass)> callback);
|
||||
|
||||
void windows_create_to_unix(const UINT32 &create_options,
|
||||
const UINT32 &granted_access, std::uint32_t &flags,
|
||||
remote::file_mode &mode);
|
||||
|
||||
[[nodiscard]] auto
|
||||
windows_time_to_unix_time(std::uint64_t win_time) -> remote::file_time;
|
||||
|
||||
// template implementations
|
||||
#if defined(__APPLE__)
|
||||
template <typename t>
|
||||
[[nodiscard]] auto convert_to_uint64(const t *v) -> std::uint64_t {
|
||||
return static_cast<std::uint64_t>(reinterpret_cast<std::uintptr_t>(v));
|
||||
}
|
||||
#endif
|
||||
} // namespace repertory::utils
|
||||
|
||||
#endif // !_WIN32
|
||||
|
@ -32,73 +32,19 @@ void calculate_allocation_size(bool directory, std::uint64_t file_size,
|
||||
UINT64 allocation_size,
|
||||
std::string &allocation_meta_size);
|
||||
|
||||
[[nodiscard]] auto calculate_read_size(const uint64_t &total_size,
|
||||
std::size_t read_size,
|
||||
const uint64_t &offset) -> std::size_t;
|
||||
|
||||
template <typename t>
|
||||
[[nodiscard]] auto collection_excludes(t collection,
|
||||
const typename t::value_type &val)
|
||||
-> bool;
|
||||
|
||||
template <typename t>
|
||||
[[nodiscard]] auto collection_includes(t collection,
|
||||
const typename t::value_type &val)
|
||||
-> bool;
|
||||
|
||||
[[nodiscard]] auto compare_version_strings(std::string version1,
|
||||
std::string version2) -> int;
|
||||
|
||||
[[nodiscard]] auto convert_api_date(const std::string &date) -> std::uint64_t;
|
||||
|
||||
[[nodiscard]] auto create_curl() -> CURL *;
|
||||
|
||||
[[nodiscard]] auto create_uuid_string() -> std::string;
|
||||
|
||||
[[nodiscard]] auto create_volume_label(const provider_type &prov)
|
||||
-> std::string;
|
||||
|
||||
template <typename t>
|
||||
[[nodiscard]] auto divide_with_ceiling(const t &n, const t &d) -> t;
|
||||
|
||||
[[nodiscard]] auto download_type_from_string(std::string type,
|
||||
const download_type &default_type)
|
||||
-> download_type;
|
||||
|
||||
[[nodiscard]] auto download_type_to_string(const download_type &type)
|
||||
-> std::string;
|
||||
|
||||
template <typename t>
|
||||
[[nodiscard]] auto from_hex_string(const std::string &str, t &val) -> bool;
|
||||
|
||||
[[nodiscard]] auto generate_random_string(std::uint16_t length) -> std::string;
|
||||
[[nodiscard]] auto
|
||||
create_volume_label(const provider_type &prov) -> std::string;
|
||||
|
||||
[[nodiscard]] auto get_attributes_from_meta(const api_meta_map &meta) -> DWORD;
|
||||
|
||||
[[nodiscard]] auto get_environment_variable(const std::string &variable)
|
||||
-> std::string;
|
||||
|
||||
[[nodiscard]] auto get_file_time_now() -> std::uint64_t;
|
||||
|
||||
void get_local_time_now(struct tm &local_time);
|
||||
|
||||
[[nodiscard]] auto get_next_available_port(std::uint16_t first_port,
|
||||
std::uint16_t &available_port)
|
||||
-> bool;
|
||||
|
||||
[[nodiscard]] auto get_time_now() -> std::uint64_t;
|
||||
|
||||
template <typename data_type>
|
||||
[[nodiscard]] auto random_between(const data_type &begin, const data_type &end)
|
||||
-> data_type;
|
||||
|
||||
template <typename t>
|
||||
void remove_element_from(t &collection, const typename t::value_type &val);
|
||||
|
||||
[[nodiscard]] auto reset_curl(CURL *curl_handle) -> CURL *;
|
||||
|
||||
[[nodiscard]] auto retryable_action(const std::function<bool()> &action)
|
||||
-> bool;
|
||||
[[nodiscard]] auto
|
||||
retryable_action(const std::function<bool()> &action) -> bool;
|
||||
|
||||
void spin_wait_for_mutex(std::function<bool()> complete,
|
||||
std::condition_variable &cond, std::mutex &mtx,
|
||||
@ -107,75 +53,6 @@ void spin_wait_for_mutex(std::function<bool()> complete,
|
||||
void spin_wait_for_mutex(bool &complete, std::condition_variable &cond,
|
||||
std::mutex &mtx, const std::string &text = "");
|
||||
|
||||
template <typename collection_t>
|
||||
[[nodiscard]] auto to_hex_string(const collection_t &collection) -> std::string;
|
||||
|
||||
// template implementations
|
||||
template <typename t>
|
||||
[[nodiscard]] auto collection_excludes(t collection,
|
||||
const typename t::value_type &val)
|
||||
-> bool {
|
||||
return std::find(collection.begin(), collection.end(), val) ==
|
||||
collection.end();
|
||||
}
|
||||
|
||||
template <typename t>
|
||||
[[nodiscard]] auto collection_includes(t collection,
|
||||
const typename t::value_type &val)
|
||||
-> bool {
|
||||
return std::find(collection.begin(), collection.end(), val) !=
|
||||
collection.end();
|
||||
}
|
||||
|
||||
template <typename t>
|
||||
[[nodiscard]] auto divide_with_ceiling(const t &n, const t &d) -> t {
|
||||
return n ? (n / d) + (n % d != 0) : 0;
|
||||
}
|
||||
|
||||
template <typename t>
|
||||
[[nodiscard]] auto from_hex_string(const std::string &str, t &val) -> bool {
|
||||
static constexpr const auto base16 = 16;
|
||||
|
||||
val.clear();
|
||||
if (not(str.length() % 2U)) {
|
||||
for (std::size_t i = 0U; i < str.length(); i += 2U) {
|
||||
val.emplace_back(static_cast<typename t::value_type>(
|
||||
strtol(str.substr(i, 2U).c_str(), nullptr, base16)));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename data_type>
|
||||
[[nodiscard]] auto random_between(const data_type &begin, const data_type &end)
|
||||
-> data_type {
|
||||
return begin + repertory_rand<data_type>() % ((end + data_type{1}) - begin);
|
||||
}
|
||||
|
||||
template <typename collection_t>
|
||||
void remove_element_from(collection_t &collection,
|
||||
const typename collection_t::value_type &value) {
|
||||
collection.erase(std::remove(collection.begin(), collection.end(), value),
|
||||
collection.end());
|
||||
}
|
||||
|
||||
template <typename collection_t>
|
||||
[[nodiscard]] auto to_hex_string(const collection_t &collection)
|
||||
-> std::string {
|
||||
static_assert(sizeof(typename collection_t::value_type) == 1U,
|
||||
"value_type must be 1 byte in size");
|
||||
static constexpr const auto mask = 0xFF;
|
||||
|
||||
std::stringstream stream;
|
||||
for (const auto &val : collection) {
|
||||
stream << std::setfill('0') << std::setw(2) << std::hex
|
||||
<< (static_cast<std::uint32_t>(val) & mask);
|
||||
}
|
||||
|
||||
return stream.str();
|
||||
}
|
||||
} // namespace repertory::utils
|
||||
|
||||
#endif // INCLUDE_UTILS_UTILS_HPP_
|
||||
|
@ -25,15 +25,9 @@
|
||||
|
||||
#include "types/remote.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "utils/windows.hpp"
|
||||
|
||||
namespace repertory::utils {
|
||||
[[nodiscard]] auto
|
||||
filetime_to_unix_time(const FILETIME &ft) -> remote::file_time;
|
||||
|
||||
[[nodiscard]] auto get_last_error_code() -> DWORD;
|
||||
|
||||
[[nodiscard]] auto get_local_app_data_directory() -> const std::string &;
|
||||
|
||||
[[nodiscard]] auto
|
||||
get_accessed_time_from_meta(const api_meta_map &meta) -> std::uint64_t;
|
||||
|
||||
@ -46,29 +40,14 @@ get_creation_time_from_meta(const api_meta_map &meta) -> std::uint64_t;
|
||||
[[nodiscard]] auto
|
||||
get_written_time_from_meta(const api_meta_map &meta) -> std::uint64_t;
|
||||
|
||||
[[nodiscard]] auto get_thread_id() -> std::uint64_t;
|
||||
|
||||
[[nodiscard]] auto is_process_elevated() -> bool;
|
||||
|
||||
[[nodiscard]] auto run_process_elevated(std::vector<const char *> args) -> int;
|
||||
|
||||
void set_last_error_code(DWORD errorCode);
|
||||
|
||||
[[nodiscard]] auto from_api_error(const api_error &e) -> NTSTATUS;
|
||||
|
||||
auto strptime(const char *s, const char *f, struct tm *tm) -> const char *;
|
||||
|
||||
[[nodiscard]] auto unix_access_mask_to_windows(std::int32_t mask) -> int;
|
||||
|
||||
[[nodiscard]] auto
|
||||
unix_open_flags_to_flags_and_perms(const remote::file_mode &mode,
|
||||
const remote::open_flags &flags,
|
||||
std::int32_t &perms) -> int;
|
||||
|
||||
void unix_time_to_filetime(const remote::file_time &ts, FILETIME &ft);
|
||||
|
||||
[[nodiscard]] auto
|
||||
time64_to_unix_time(const __time64_t &t) -> remote::file_time;
|
||||
} // namespace repertory::utils
|
||||
|
||||
#endif // _WIN32
|
||||
|
Reference in New Issue
Block a user