16#include <nlohmann/json.hpp>
19#include <dfx-utilities/StringMap.hpp>
20#include <dfx-utilities/JsonValidator.hpp>
149 std::vector<std::string> _possibleCommands;
std::move_only_function< bool(UnixSessionPtr, nlohmann::json, std::string)> Handler
Handler type for a routed command.
Definition UnixRouter.hpp:88
bool deregisterCommand(std::string_view command)
Deregister a command handler.
UnixRouter()
Construct the router and register the request envelope schema.
bool route(UnixSessionPtr session, nlohmann::json json)
Validate and route a JSON request to the appropriate command handler.
void registerCommand(std::string command, Handler handler, bool allowOverride=false)
Register a command handler.
bool isRegistered(std::string_view command) const
Check whether a command is registered.
One connected client session of a UnixServer control socket.
Definition UnixSession.hpp:76
Registry of JSON Schemas with validation helpers.
Definition JsonValidator.hpp:46
Definition BaseCommandHandler.hpp:16
std::shared_ptr< UnixSession > UnixSessionPtr
Shared ownership pointer type for sessions.
Definition BaseCommandHandler.hpp:20
std::unordered_map< std::string, T, TransparentHash, TransparentEqual, Allocator > UnorderedStringMap
Convenience alias for an unordered map keyed by std::string with transparent lookup.
Definition StringMap.hpp:76