+}
+
+void conf_cb(char *word, char *val, FILE *f) {
+ debug(DBG_DBG, "conf_cb called");
+}
+
+void getmainconfig(const char *configfile) {
+ FILE *f;
+ char *statusserver = NULL, *loglevel = NULL;
+
+ f = openconfigfile(configfile);
+ memset(&options, 0, sizeof(options));
+
+ getgeneralconfig(f,
+ "TLSCACertificateFile", CONF_STR, &options.tlscacertificatefile,
+ "TLSCACertificatePath", CONF_STR, &options.tlscacertificatepath,
+ "TLSCertificateFile", CONF_STR, &options.tlscertificatefile,
+ "TLSCertificateKeyFile", CONF_STR, &options.tlscertificatekeyfile,
+ "TLSCertificateKeyPassword", CONF_STR, &options.tlscertificatekeypassword,
+ "ListenUDP", CONF_STR, &options.listenudp,
+ "ListenTCP", CONF_STR, &options.listentcp,
+ "StatusServer", CONF_STR, &statusserver,
+ "LogLevel", CONF_STR, &loglevel,
+ "LogDestination", CONF_STR, &options.logdestination,
+ "Client", CONF_CBK, conf_cb,
+ NULL
+ );
+
+ if (statusserver) {
+ if (!strcasecmp(statusserver, "on"))
+ options.statusserver = 1;
+ else if (strcasecmp(statusserver, "off"))
+ debugx(1, DBG_ERR, "error in %s, value of option StatusServer is %s, must be on or off", configfile, statusserver);
+ free(statusserver);
+ }
+ if (loglevel) {
+ if (strlen(loglevel) != 1 || *loglevel < '1' || *loglevel > '4')
+ debugx(1, DBG_ERR, "error in %s, value of option LogLevel is %s, must be 1, 2, 3 or 4", configfile, loglevel);
+ options.loglevel = *loglevel - '0';
+ free(loglevel);
+ }
+