terom@53: #ifndef NEXUS_H terom@53: #define NEXUS_H terom@53: terom@53: /** terom@87: * @file terom@87: * terom@53: * A nexus is the central brain of the application; the place where the main() method is implemented terom@53: */ terom@57: struct nexus; terom@57: terom@53: #include terom@70: #include "signals.h" terom@55: #include "module.h" terom@53: #include "irc_client.h" terom@105: #include "nexus_lua.h" terom@105: #include "lua_console.h" terom@53: terom@53: /** terom@87: * The central brain, as created in the main() function. terom@53: */ terom@55: struct nexus { terom@53: /** The libevent base */ terom@53: struct event_base *ev_base; terom@53: terom@70: /** Our signal handlers */ terom@70: struct signals *signals; terom@70: terom@55: /** Our loaded modules */ terom@55: struct modules *modules; terom@55: terom@53: /** The IRC client state */ terom@53: struct irc_client *client; terom@103: terom@105: /** Our lua state */ terom@105: struct nexus_lua *lua; terom@105: terom@105: /** Our lua console */ terom@105: struct lua_console *lua_console; terom@105: terom@103: /** Shutting down? */ terom@103: bool shutdown; terom@53: }; terom@53: terom@53: /** terom@109: * Load a config file into the nexus from the given path terom@109: */ terom@109: err_t nexus_load_config (struct nexus *nexus, const char *path, struct error_info *err); terom@109: terom@109: /** terom@103: * Shut down the nexus cleanly. It /should/ be safe to call this several times, but it won't do anything. terom@103: * terom@103: * Once everything has shut down nicely (which it should, unless there's something buggy), the event loop should exit, terom@103: * and the main() function return. terom@103: */ terom@103: void nexus_shutdown (struct nexus *nexus); terom@103: terom@103: /** terom@109: * Shut down the nexus fast. This will stop the event loop right away, which should lead to nexus_destroy being called. terom@109: */ terom@109: void nexus_crash (struct nexus *nexus); terom@109: terom@109: /** terom@109: * Destroy the nexus directly. This is intended to be used once the event loop as exited. terom@103: */ terom@103: void nexus_destroy (struct nexus *nexus); terom@103: terom@103: /** terom@53: * The nexus main function, application entry point, etc. terom@53: */ terom@53: int main (int argc, char **argv); terom@53: terom@53: #endif /* NEXUS_H */