feat: Added basic network interface support

This commit is contained in:
WerWolv
2023-05-15 11:30:24 +02:00
parent e685d65be8
commit c006062540
12 changed files with 194 additions and 2 deletions

View File

@@ -12,6 +12,7 @@
#include <span>
#include <string>
#include <string_view>
#include <thread>
#include <unordered_map>
#include <vector>
@@ -813,6 +814,35 @@ namespace hex {
}
}
namespace BackgroundServices {
namespace impl {
using Callback = std::function<void()>;
struct Service {
std::string name;
std::jthread thread;
};
std::vector<Service> &getServices();
void stopServices();
}
void registerService(const std::string &unlocalizedName, const impl::Callback &callback);
}
namespace CommunicationInterface {
namespace impl {
using NetworkCallback = std::function<nlohmann::json(const nlohmann::json &)>;
std::map<std::string, NetworkCallback> &getNetworkEndpoints();
}
void registerNetworkEndpoint(const std::string &endpoint, const impl::NetworkCallback &callback);
}
}
}