#include "main.hpp" #include "comm_module.hpp" #include "command/guid.hpp" #include "command_table.hpp" #include "message.hpp" #include "message_handler.hpp" #include "socket_channel.hpp" #include "sol_module.hpp" #include #include #include #include #include #include #include #include #include #include using namespace phosphor::logging; // Tuple of Global Singletons static auto io = std::make_shared(); session::Manager manager; command::Table table; eventloop::EventLoop loop(io); sol::Manager solManager(io); std::tuple singletonPool(manager, table, loop, solManager); sd_bus* bus = nullptr; std::shared_ptr sdbusp; /* * @brief Required by apphandler IPMI Provider Library */ sd_bus* ipmid_get_sd_bus_connection() { return bus; } /* * @brief mechanism to get at sdbusplus object */ std::shared_ptr getSdBus() { return sdbusp; } EInterfaceIndex getInterfaceIndex(void) { return interfaceLAN1; } int main() { // Connect to system bus auto rc = sd_bus_default_system(&bus); if (rc < 0) { log("Failed to connect to system bus", entry("ERROR=%s", strerror(-rc))); return rc; } sdbusp = std::make_shared(*io, bus); // Register callback to update cache for a GUID change and cache the GUID command::registerGUIDChangeCallback(); cache::guid = command::getSystemGUID(); // Register the phosphor-net-ipmid session setup commands command::sessionSetupCommands(); // Register the phosphor-net-ipmid SOL commands sol::command::registerCommands(); // Start Event Loop return std::get(singletonPool).startEventLoop(); }