Make sure the event handlers initialize and register themselves.

This commit is contained in:
Wilco Baan Hofman 2012-08-06 01:11:03 +02:00
parent fb4832fb88
commit 3fb1474113
11 changed files with 221 additions and 154 deletions

View file

@ -18,30 +18,49 @@
#define CONFIGFILE "/etc/siahsd.conf"
typedef STATUS (*event_function)(TALLOC_CTX *mem_ctx, const char *prom, const char *code, const char *description);
typedef struct {
/* Global configuration */
char *log_file;
gint log_level;
gboolean foreground;
char *pid_file; /* FIXME Apparently the same for siahs and secip.. for now */
/* Alphatronics SIA-HS configuration */
gint siahs_port;
/* Vebon SecIP configuration */
gint secip_port;
char *rsa_key_file;
/* Database client configuration */
char *database_host;
char *database_username;
char *database_password;
char *database_name;
char *database_driver;
gint siahs_port;
char *log_file;
gint log_level;
gboolean foreground;
char *pid_file;
gint secip_port;
char *rsa_key_file;
/* JSONbot client configuration */
char *jsonbot_address;
gint jsonbot_port;
char *jsonbot_aeskey;
char *jsonbot_password;
char *jsonbot_privmsg_to;
/* Global configuration based state */
GKeyFile *keyfile;
uint8_t event_handler_cnt;
event_function *event_handlers;
struct rsa_public_key *public_key;
struct rsa_private_key *private_key;
} configuration;
const configuration *get_conf(void);
STATUS get_rsa_keys(struct rsa_public_key **pub, struct rsa_private_key **priv);
STATUS set_rsa_keys(struct rsa_public_key *pub, struct rsa_private_key *priv);
configuration *get_modifiable_conf(void);
STATUS read_rsa_keys(void);
const char *get_process_name(void);
STATUS set_process_name(const char *name);