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