/* Imported functions */
int authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons);
+extern bool parse_cons_config(CONFIG *config, const char *configfile, int exit_code);
/* Forward referenced functions */
static void terminate_console(int sig);
static POOLMEM *args;
static char *argk[MAX_CMD_ARGS];
static char *argv[MAX_CMD_ARGS];
+static CONFIG *config;
/* Command prototypes */
configfile = bstrdup(CONFIG_FILE);
}
- parse_config(configfile);
+ config = new_config_parser();
+ parse_cons_config(config, configfile, M_ERROR_TERM);
if (init_crypto() != 0) {
Emsg0(M_ERROR_TERM, 0, _("Cryptography library initialization failed.\n"));
exit(1);
}
already_here = true;
+ config->free_resources();
+ free(config);
+ config = NULL;
cleanup_crypto();
free_pool_memory(args);
if (!no_conio) {
* types. Note, these should be unique for each
* daemon though not a requirement.
*/
-int r_first = R_FIRST;
-int r_last = R_LAST;
+int32_t r_first = R_FIRST;
+int32_t r_last = R_LAST;
static RES *sres_head[R_LAST - R_FIRST + 1];
RES **res_head = sres_head;
#else
URES res_all;
#endif
-int res_all_size = sizeof(res_all);
+int32_t res_all_size = sizeof(res_all);
/* Definition of records permitted within each
* resource with the routine to process the record
}
}
}
+
+bool parse_cons_config(CONFIG *config, const char *configfile, int exit_code)
+{
+ config->init(configfile, NULL, exit_code, (void *)&res_all, res_all_size,
+ r_first, r_last, resources, res_head);
+ return config->parse_config();
+}
/* Exported subroutines */
extern "C" void reload_config(int sig);
extern void invalidate_schedules();
-
+extern bool parse_dir_config(CONFIG *config, const char *configfile, int exit_code);
/* Imported subroutines */
JCR *wait_for_next_job(char *runjob);
void *start_heap;
/* Globals Imported */
-extern int r_first, r_last; /* first and last resources */
-extern RES_TABLE resources[];
-extern RES **res_head;
extern RES_ITEM job_items[];
-extern int res_all_size;
-
#if defined(_MSC_VER)
extern "C" { // work around visual compiler mangling variables
- extern URES res_all;
+ extern URES res_all;
}
#else
extern URES res_all;
}
config = new_config_parser();
- config->init(configfile, NULL, M_ERROR_TERM, (void *)&res_all, res_all_size,
- r_first, r_last, resources, res_head);
- config->parse_config();
+ parse_dir_config(config, configfile, M_ERROR_TERM);
if (init_crypto() != 0) {
Jmsg((JCR *)NULL, M_ERROR_TERM, 0, _("Cryptography library initialization failed.\n"));
if (debug_level > 5) {
print_memory_pool_stats();
}
- config->free_resources();
- free(config);
- config = NULL;
+ if (config) {
+ config->free_resources();
+ free(config);
+ config = NULL;
+ }
term_ua_server();
term_msg(); /* terminate message handler */
cleanup_crypto();
reload_table[table].res_table = config->save_resources();
Dmsg1(100, "Saved old config in table %d\n", table);
- ok = parse_config(configfile, 0, M_ERROR); /* no exit on error */
+ ok = parse_dir_config(config, configfile, M_ERROR);
Dmsg0(100, "Reloaded config file\n");
if (!ok || !check_resources() || !check_catalog()) {
* types. Note, these should be unique for each
* daemon though not a requirement.
*/
-int r_first = R_FIRST;
-int r_last = R_LAST;
+int32_t r_first = R_FIRST;
+int32_t r_last = R_LAST;
static RES *sres_head[R_LAST - R_FIRST + 1];
RES **res_head = sres_head;
*/
#if defined(_MSC_VER)
extern "C" { // work around visual compiler mangling variables
- URES res_all;
+ URES res_all;
}
#else
URES res_all;
#endif
-int res_all_size = sizeof(res_all);
+int32_t res_all_size = sizeof(res_all);
/* Definition of records permitted within each
return NULL;
}
}
+
+bool parse_dir_config(CONFIG *config, const char *configfile, int exit_code)
+{
+ config->init(configfile, NULL, exit_code, (void *)&res_all, res_all_size,
+ r_first, r_last, resources, res_head);
+ return config->parse_config();
+}
/* Job Level keyword structure */
struct s_jl {
const char *level_name; /* level keyword */
- uint32_t level; /* level */
- uint32_t job_type; /* JobType permitting this level */
+ int32_t level; /* level */
+ int32_t job_type; /* JobType permitting this level */
};
/* Job Type keyword structure */
struct s_jt {
const char *type_name;
- uint32_t job_type;
+ int32_t job_type;
};
/* Definition of the contents of each Resource */
/* Imported subroutines */
/* Imported variables */
-extern int r_first;
-extern int r_last;
-extern struct s_res resources[];
extern jobq_t job_queue; /* job queue */
#include "dird.h"
/* Imported variables */
-extern int r_first;
-extern int r_last;
-extern struct s_res resources[];
/* Imported functions */
extern void do_messages(UAContext *ua, const char *cmd);
/* Imported subroutines */
/* Imported variables */
-extern int r_first;
-extern int r_last;
-extern RES_TABLE resources[];
-extern RES **res_head;
/* Imported functions */
#include "dird.h"
/* Imported variables */
-extern int r_first;
-extern int r_last;
-extern struct s_res resources[];
/* Forward referenced functions */
/* Imported Functions */
extern void *handle_client_request(void *dir_sock);
+extern bool parse_fd_config(CONFIG *config, const char *configfile, int exit_code);
/* Forward referenced functions */
void terminate_filed(int sig);
static bool foreground = false;
static workq_t dir_workq; /* queue of work from Director */
static pthread_t server_tid;
-
+static CONFIG *config;
static void usage()
{
configfile = bstrdup(CONFIG_FILE);
}
- parse_config(configfile);
+ config = new_config_parser();
+ parse_fd_config(config, configfile, M_ERROR_TERM);
if (init_crypto() != 0) {
Emsg0(M_ERROR, 0, _("Cryptography library initialization failed.\n"));
if (debug_level > 0) {
print_memory_pool_stats();
}
+ if (config) {
+ config->free_resources();
+ free(config);
+ config = NULL;
+ }
term_msg();
- free_config_resources();
cleanup_crypto();
close_memory_pool(); /* release free memory in pool */
sm_dump(false); /* dump orphaned buffers */
* types. Note, these should be unique for each
* daemon though not a requirement.
*/
-int r_first = R_FIRST;
-int r_last = R_LAST;
+int32_t r_first = R_FIRST;
+int32_t r_last = R_LAST;
static RES *sres_head[R_LAST - R_FIRST + 1];
RES **res_head = sres_head;
*/
#if defined(_MSC_VER)
extern "C" { // work around visual compiler mangling variables
- URES res_all;
+ URES res_all;
}
#else
URES res_all;
#endif
-int res_all_size = sizeof(res_all);
+int32_t res_all_size = sizeof(res_all);
/* Definition of records permitted within each
* resource with the routine to process the record
}
}
}
+
+bool parse_fd_config(CONFIG *config, const char *configfile, int exit_code)
+{
+ config->init(configfile, NULL, exit_code, (void *)&res_all, res_all_size,
+ r_first, r_last, resources, res_head);
+ return config->parse_config();
+}
/* Imported functions */
int authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons);
void select_restore_setup();
+extern bool parse_gcons_config(CONFIG *config, const char *configfile, int exit_code);
+
/* Dummy functions */
int generate_daemon_event(JCR *jcr, const char *event) { return 1; }
static bool quit = false;
static guint initial;
static int numdir = 0;
+static CONFIG *config;
#define CONFIG_FILE "./bgnome-console.conf" /* default configuration file */
configfile = bstrdup(CONFIG_FILE);
}
- parse_config(configfile);
+ config = new_config_parser();
+ parse_gcons_config(config, configfile, M_ERROR_TERM);
if (init_crypto() != 0) {
Emsg0(M_ERROR_TERM, 0, _("Cryptography library initialization failed.\n"));
if (already_here) /* avoid recursive temination problems */
exit(1);
already_here = true;
+ config->free_resources();
+ free(config);
+ config = NULL;
cleanup_crypto();
disconnect_from_director((gpointer)NULL);
gtk_main_quit();
* types. Note, these should be unique for each
* daemon though not a requirement.
*/
-int r_first = R_FIRST;
-int r_last = R_LAST;
+int32_t r_first = R_FIRST;
+int32_t r_last = R_LAST;
static RES *sres_head[R_LAST - R_FIRST + 1];
RES **res_head = sres_head;
* scan is complete.
*/
URES res_all;
-int res_all_size = sizeof(res_all);
+int32_t res_all_size = sizeof(res_all);
/* Definition of records permitted within each
* resource with the routine to process the record
}
}
}
+
+bool parse_gcons_config(CONFIG *config, const char *configfile, int exit_code)
+{
+ config->init(configfile, NULL, exit_code, (void *)&res_all, res_all_size,
+ r_first, r_last, resources, res_head);
+ return config->parse_config();
+}
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
#define MAX_PATH 1024
#endif
-/* Each daemon has a slightly different set of
- * resources, so it will define the following
- * global values.
- */
-extern int r_first;
-extern int r_last;
-extern RES_TABLE resources[];
-extern RES **res_head;
-
/*
* Define the Union of all the common resource structure definitions.
*/
#else
extern URES res_all;
#endif
-extern int res_all_size;
extern brwlock_t res_lock; /* resource lock */
* Note, the default behavior unless you have set an alternate
* scan_error handler is to die on an error.
*/
+#ifdef xxx
int
parse_config(const char *cf, LEX_ERROR_HANDLER *scan_error, int err_type)
{
free(config);
return ok;
}
+#endif
bool CONFIG::parse_config()
}
if (debug_level >= 900 && pass == 2) {
int i;
- for (i=r_first; i<=r_last; i++) {
- dump_resource(i, res_head[i-r_first], prtmsg, NULL);
+ for (i=m_r_first; i<=m_r_last; i++) {
+ dump_resource(i, m_res_head[i-m_r_first], prtmsg, NULL);
}
}
lc = lex_close_file(lc);
return res;
}
+
+#ifdef xxx
void free_config_resources()
{
for (int i=r_first; i<=r_last; i++) {
}
}
-#ifdef xxx
RES **save_config_resources()
{
int num = r_last - r_first + 1;
typedef void (MSG_RES_HANDLER)(LEX *lc, RES_ITEM *item, int index, int pass);
+
/* This is the structure that defines
* the record types (items) permitted within each
* resource. It is used to define the configuration
/*
* Old C style configuration routines -- deprecated do not use.
*/
-int parse_config(const char *cf, LEX_ERROR_HANDLER *scan_error = NULL, int err_type=M_ERROR_TERM);
+//int parse_config(const char *cf, LEX_ERROR_HANDLER *scan_error = NULL, int err_type=M_ERROR_TERM);
void free_config_resources(void);
RES **save_config_resources(void);
RES **new_res_head();
int32_t m_err_type; /* the way to terminate on failure */
void *m_res_all; /* pointer to res_all buffer */
int32_t m_res_all_size; /* length of buffer */
+
/* The below are not yet implemented */
int32_t m_r_first; /* first daemon resource type */
int32_t m_r_last; /* last daemon resource type */
void store_size(LEX *lc, RES_ITEM *item, int index, int pass);
void store_defs(LEX *lc, RES_ITEM *item, int index, int pass);
void store_label(LEX *lc, RES_ITEM *item, int index, int pass);
+
+/* ***FIXME*** eliminate these globals */
+extern int32_t r_first;
+extern int32_t r_last;
+extern RES_TABLE resources[];
+extern RES **res_head;
+extern int32_t res_all_size;
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
* resources, so it will define the following
* global values.
*/
-extern int r_first;
-extern int r_last;
+extern int32_t r_first;
+extern int32_t r_last;
extern RES_TABLE resources[];
extern RES **res_head;
brwlock_t res_lock; /* resource lock */
-static int res_locked = 0; /* set when resource chains locked -- for debug */
+static int res_locked = 0; /* resource chain lock count -- for debug */
/* #define TRACE_RES */
* types. Note, these should be unique for each
* daemon though not a requirement.
*/
-int r_first = R_FIRST;
-int r_last = R_LAST;
+int32_t r_first = R_FIRST;
+int32_t r_last = R_LAST;
static RES *sres_head[R_LAST - R_FIRST + 1];
RES **res_head = sres_head;
* scan is complete.
*/
URES res_all;
-int res_all_size = sizeof(res_all);
+int32_t res_all_size = sizeof(res_all);
/* Definition of records permitted within each
* resource with the routine to process the record
}
}
}
+
+bool parse_bat_config(CONFIG *config, const char *configfile, int exit_code)
+{
+ config->init(configfile, NULL, exit_code, (void *)&res_all, res_all_size,
+ r_first, r_last, resources, res_head);
+ return config->parse_config();
+}
static void usage();
static int check_resources();
+extern bool parse_bat_config(CONFIG *config, const char *configfile, int exit_code);
+
#define CONFIG_FILE "./bat.conf" /* default configuration file */
/* Static variables */
+static CONFIG *config;
static char *configfile = NULL;
int main(int argc, char *argv[])
configfile = bstrdup(CONFIG_FILE);
}
- parse_config(configfile);
+ config = new_config_parser();
+ parse_bat_config(config, configfile, M_ERROR_TERM);
if (init_crypto() != 0) {
Emsg0(M_ERROR_TERM, 0, _("Cryptography library initialization failed.\n"));
/* Dummy functions */
int generate_daemon_event(JCR *jcr, const char *event) { return 1; }
+extern bool parse_sd_config(CONFIG *config, const char *configfile, int exit_code);
/* Forward referenced functions */
static void get_session_record(DEVICE *dev, DEV_RECORD *rec, SESSION_LABEL *sessrec);
static DEV_BLOCK *out_block;
static SESSION_LABEL sessrec;
+static CONFIG *config;
#define CONFIG_FILE "bacula-sd.conf"
char *configfile = NULL;
STORES *me = NULL; /* our Global resource */
"\nVersion: %s (%s)\n\n"
"Usage: bcopy [-d debug_level] <input-archive> <output-archive>\n"
" -b bootstrap specify a bootstrap file\n"
-" -c <file> specify configuration file\n"
+" -c <file> specify a Storage configuration file\n"
" -d <nn> set debug level to <nn>\n"
" -dt print timestamp in debug output\n"
" -i specify input Volume names (separated by |)\n"
configfile = bstrdup(CONFIG_FILE);
}
- parse_config(configfile);
+ config = new_config_parser();
+ parse_sd_config(config, configfile, M_ERROR_TERM);
/* Setup and acquire input device for reading */
Dmsg0(100, "About to setup input jcr\n");
#include "stored.h"
#include "findlib/find.h"
+extern bool parse_sd_config(CONFIG *config, const char *configfile, int exit_code);
+
static void do_extract(char *fname);
static bool record_cb(DCR *dcr, DEV_RECORD *rec);
static uint32_t wsize; /* write size */
static uint64_t fileAddr = 0; /* file write address */
+static CONFIG *config;
#define CONFIG_FILE "bacula-sd.conf"
char *configfile = NULL;
STORES *me = NULL; /* our Global resource */
"\nVersion: %s (%s)\n\n"
"Usage: bextract <options> <bacula-archive-device-name> <directory-to-store-files>\n"
" -b <file> specify a bootstrap file\n"
-" -c <file> specify a configuration file\n"
+" -c <file> specify a Storage configuration file\n"
" -d <nn> set debug level to <nn>\n"
" -dt print timestamp in debug output\n"
" -e <file> exclude list\n"
configfile = bstrdup(CONFIG_FILE);
}
- parse_config(configfile);
+ config = new_config_parser();
+ parse_sd_config(config, configfile, M_ERROR_TERM);
if (!got_inc) { /* If no include file, */
add_fname_to_include_list(ff, 0, "/"); /* include everything */
build_attr_output_fnames(jcr, attr);
- if (attr->type == FT_DELETED) { /* TODO: choose the right fname/ofname */
- Jmsg(jcr, M_INFO, 0, _("%s was deleted.\n"), attr->fname);
- extract = false;
- return true;
- }
+ if (attr->type == FT_DELETED) { /* TODO: choose the right fname/ofname */
+ Jmsg(jcr, M_INFO, 0, _("%s was deleted.\n"), attr->fname);
+ extract = false;
+ return true;
+ }
extract = false;
stat = create_file(jcr, attr, &bfd, REPLACE_ALWAYS);
Dmsg2(500, "Vol=%s num_parts=%d\n", dcr->VolCatInfo.VolCatName, dcr->VolCatInfo.VolCatParts);
return 1;
}
-
/* Dummy functions */
int generate_daemon_event(JCR *jcr, const char *event) { return 1; }
+extern bool parse_sd_config(CONFIG *config, const char *configfile, int exit_code);
static void do_blocks(char *infname);
static void do_jobs(char *infname);
static SESSION_LABEL sessrec;
static uint32_t num_files = 0;
static ATTR *attr;
+static CONFIG *config;
#define CONFIG_FILE "bacula-sd.conf"
char *configfile = NULL;
"\nVersion: %s (%s)\n\n"
"Usage: bls [options] <device-name>\n"
" -b <file> specify a bootstrap file\n"
-" -c <file> specify a config file\n"
+" -c <file> specify a Storage configuration file\n"
" -d <nn> set debug level to <nn>\n"
" -dt print timestamp in debug output\n"
" -e <file> exclude list\n"
configfile = bstrdup(CONFIG_FILE);
}
- parse_config(configfile);
+ config = new_config_parser();
+ parse_sd_config(config, configfile, M_ERROR_TERM);
if (ff->included_files_list == NULL) {
add_fname_to_include_list(ff, 0, "/");
Dmsg2(500, "Vol=%s num_parts=%d\n", dcr->VolCatInfo.VolCatName, dcr->VolCatInfo.VolCatParts);
return 1;
}
-
/* Dummy functions */
int generate_daemon_event(JCR *jcr, const char *event) { return 1; }
+extern bool parse_sd_config(CONFIG *config, const char *configfile, int exit_code);
/* Forward referenced functions */
static void do_scan(void);
static int num_media = 0;
static int num_files = 0;
+static CONFIG *config;
#define CONFIG_FILE "bacula-sd.conf"
char *configfile = NULL;
STORES *me = NULL; /* our Global resource */
configfile = bstrdup(CONFIG_FILE);
}
- parse_config(configfile);
+ config = new_config_parser();
+ parse_sd_config(config, configfile, M_ERROR_TERM);
LockRes();
me = (STORES *)GetNextRes(R_STORAGE, NULL);
if (!me) {
/* Dummy functions */
int generate_daemon_event(JCR *jcr, const char *event) { return 1; }
+extern bool parse_sd_config(CONFIG *config, const char *configfile, int exit_code);
/* External subroutines */
extern void free_config_resources();
/* Static variables */
+static CONFIG *config;
#define CONFIG_FILE "bacula-sd.conf"
char *configfile = NULL;
daemon_start_time = time(NULL);
- parse_config(configfile);
-
+ config = new_config_parser();
+ parse_sd_config(config, configfile, M_ERROR_TERM);
/* See if we can open a device */
if (margc == 0) {
if (configfile) {
free(configfile);
}
- free_config_resources();
+ if (config) {
+ config->free_resources();
+ free(config);
+ config = NULL;
+ }
if (args) {
free_pool_memory(args);
args = NULL;
/* Imported variables */
extern BSOCK *filed_chan;
-extern int r_first, r_last;
-extern struct s_res resources[];
extern struct s_last_job last_job;
extern bool init_done;
/* Imported variables */
extern BSOCK *filed_chan;
-extern int r_first, r_last;
-extern struct s_res resources[];
extern void *start_heap;
/* Static variables */
#include "stored.h"
/* Imported functions */
-
+extern bool parse_sd_config(CONFIG *config, const char *configfile, int exit_code);
/* Forward referenced functions */
void terminate_stored(int sig);
static bool foreground = 0;
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
static workq_t dird_workq; /* queue for processing connections */
+static CONFIG *config;
static void usage()
configfile = bstrdup(CONFIG_FILE);
}
- parse_config(configfile);
+ config = new_config_parser();
+ parse_sd_config(config, configfile, M_ERROR_TERM);
if (init_crypto() != 0) {
Jmsg((JCR *)NULL, M_ERROR_TERM, 0, _("Cryptography library initialization failed.\n"));
free(configfile);
configfile = NULL;
}
- free_config_resources();
+ if (config) {
+ config->free_resources();
+ free(config);
+ config = NULL;
+ }
if (debug_level > 10) {
print_memory_pool_stats();
#include "stored.h"
/* First and last resource ids */
-int r_first = R_FIRST;
-int r_last = R_LAST;
+int32_t r_first = R_FIRST;
+int32_t r_last = R_LAST;
static RES *sres_head[R_LAST - R_FIRST + 1];
RES **res_head = sres_head;
#else
URES res_all;
#endif
-int res_all_size = sizeof(res_all);
+int32_t res_all_size = sizeof(res_all);
/* Definition of records permitted within each
* resource with the routine to process the record
}
}
}
+
+bool parse_sd_config(CONFIG *config, const char *configfile, int exit_code)
+{
+ config->init(configfile, NULL, exit_code, (void *)&res_all, res_all_size,
+ r_first, r_last, resources, res_head);
+ return config->parse_config();
+}
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2002-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2002-2008 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
#include "lib/runscript.h"
#include "dird/dird_conf.h"
+extern bool parse_dir_config(CONFIG *config, const char *configfile, int exit_code);
+
/* Dummy functions */
int generate_daemon_event(JCR *jcr, const char *event)
{ return 1; }
static NAME_LIST name_list;
static char buf[20000];
static bool quit = false;
+static CONFIG *config;
#define MAX_ID_LIST_LEN 10000000
"Usage: dbcheck [-c config] [-C catalog name] [-d debug_level] <working-directory> <bacula-database> <user> <password> [<dbhost>]\n"
" -b batch mode\n"
" -C catalog name in the director conf file\n"
-" -c director conf filename\n"
+" -c Director conf filename\n"
" -d <nn> set debug level to <nn>\n"
" -dt print timestamp in debug output\n"
" -f fix inconsistencies\n"
if (argc > 0) {
Pmsg0(0, _("Warning skipping the additional parameters for working directory/dbname/user/password/host.\n"));
}
- parse_config(configfile);
+ config = new_config_parser();
+ parse_dir_config(config, configfile, M_ERROR_TERM);
LockRes();
foreach_res(catalog, R_CATALOG) {
if (catalogname && !strcmp(catalog->hdr.name, catalogname)) {
int generate_daemon_event(JCR *jcr, const char *event) { return 1; }
int generate_job_event(JCR *jcr, const char *event) { return 1; }
void generate_plugin_event(JCR *jcr, bEventType eventType, void *value) { }
+extern bool parse_dir_config(CONFIG *config, const char *configfile, int exit_code);
/* Global variables */
static int num_files = 0;
static int trunc_fname = 0;
static int trunc_path = 0;
static int attrs = 0;
+static CONFIG *config;
static JCR *jcr;
argc -= optind;
argv += optind;
- parse_config(configfile);
+ config = new_config_parser();
+ parse_dir_config(config, configfile, M_ERROR_TERM);
MSGS *msg;
find_files(jcr, ff, print_file, NULL);
free_jcr(jcr);
- free_config_resources();
+ if (config) {
+ config->free_resources();
+ free(config);
+ config = NULL;
+ }
+
term_last_jobs_list();
/* Clean up fileset */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2004-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2004-2008 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
int authenticate_director(JCR *jcr, MONITOR *monitor, DIRRES *director);
int authenticate_file_daemon(JCR *jcr, MONITOR *monitor, CLIENT* client);
int authenticate_storage_daemon(JCR *jcr, MONITOR *monitor, STORE* store);
+extern bool parse_tmon_config(CONFIG *config, const char *configfile, int exit_code);
/* Dummy functions */
int generate_daemon_event(JCR *jcr, const char *event) { return 1; }
static int fullitem = 0; //Item to be display in detailled status window
static int lastupdated = -1; //Last item updated
static monitoritem items[32];
+static CONFIG *config;
/* Data received from DIR/FD/SD */
static char OKqstatus[] = "%c000 OK .status\n";
configfile = bstrdup(CONFIG_FILE);
}
- parse_config(configfile);
+ config = new_config_parser();
+ parse_tmon_config(config, configfile, M_ERROR_TERM);
LockRes();
nitems = 0;
gtk_object_destroy(GTK_OBJECT(window));
gtk_object_destroy(GTK_OBJECT(mTrayMenu));
+ config->free_resources();
+ free(config);
+ config = NULL;
term_msg();
#if TRAY_DEBUG_MEMORY
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2004-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2004-2008 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
* types. Note, these should be unique for each
* daemon though not a requirement.
*/
-int r_first = R_FIRST;
-int r_last = R_LAST;
+int32_t r_first = R_FIRST;
+int32_t r_last = R_LAST;
static RES *sres_head[R_LAST - R_FIRST + 1];
RES **res_head = sres_head;
* scan is complete.
*/
URES res_all;
-int res_all_size = sizeof(res_all);
+int32_t res_all_size = sizeof(res_all);
/* Definition of records permitted within each
}
}
}
+
+bool parse_tmon_config(CONFIG *config, const char *configfile, int exit_code)
+{
+ config->init(configfile, NULL, exit_code, (void *)&res_all, res_all_size,
+ r_first, r_last, resources, res_head);
+ return config->parse_config();
+}
#undef VERSION
#define VERSION "2.5.1"
-#define BDATE "20 June 2008"
-#define LSMDATE "20Jun08"
+#define BDATE "22 June 2008"
+#define LSMDATE "22Jun08"
#define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n"
#define BYEAR "2008" /* year for copyright messages in progs */
-/*
- * Main configuration file parser for Bacula User Agent
- * some parts may be split into separate files such as
- * the schedule configuration (sch_config.c).
- *
- * Note, the configuration file parser consists of three parts
- *
- * 1. The generic lexical scanner in lib/lex.c and lib/lex.h
- *
- * 2. The generic config scanner in lib/parse_config.c and
- * lib/parse_config.h.
- * These files contain the parser code, some utility
- * routines, and the common store routines (name, int,
- * string).
- *
- * 3. The daemon specific file, which contains the Resource
- * definitions as well as any specific store routines
- * for the resource records.
- *
- * Kern Sibbald, January MM, September MM
- */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/*
+ * Main configuration file parser for Bacula User Agent
+ * some parts may be split into separate files such as
+ * the schedule configuration (sch_config.c).
+ *
+ * Note, the configuration file parser consists of three parts
+ *
+ * 1. The generic lexical scanner in lib/lex.c and lib/lex.h
+ *
+ * 2. The generic config scanner in lib/parse_config.c and
+ * lib/parse_config.h.
+ * These files contain the parser code, some utility
+ * routines, and the common store routines (name, int,
+ * string).
+ *
+ * 3. The daemon specific file, which contains the Resource
+ * definitions as well as any specific store routines
+ * for the resource records.
+ *
+ * Kern Sibbald, January MM, September MM
+ */
/* _("...") macro returns a wxChar*, so if we need a char*, we need to convert it with:
* wxString(_("...")).mb_str(*wxConvCurrent) */
* types. Note, these should be unique for each
* daemon though not a requirement.
*/
-int r_first = R_FIRST;
-int r_last = R_LAST;
+int32_t r_first = R_FIRST;
+int32_t r_last = R_LAST;
static RES *sres_head[R_LAST - R_FIRST + 1];
RES **res_head = sres_head;
#else
URES res_all;
#endif
-int res_all_size = sizeof(res_all);
+int32_t res_all_size = sizeof(res_all);
/* Definition of records permitted within each
* resource with the routine to process the record
}
}
}
+
+bool parse_wxcons_config(CONFIG *config, const char *configfile, LEX_ERROR_HANDLER *scan_error)
+{
+ config->init(configfile, scan_error, M_ERROR_TERM, (void *)&res_all, res_all_size,
+ r_first, r_last, resources, res_head);
+ return config->parse_config();
+}
-/*
- *
- * Interaction thread between director and the GUI
- *
- * Nicolas Boichat, April 2004
- *
- * Version $Id$
- */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2004-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2004-2008 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/*
+ *
+ * Interaction thread between director and the GUI
+ *
+ * Nicolas Boichat, April 2004
+ *
+ * Version $Id$
+ */
// http://66.102.9.104/search?q=cache:Djc1mPF3hRoJ:cvs.sourceforge.net/viewcvs.py/audacity/audacity-src/src/AudioIO.cpp%3Frev%3D1.102+macos+x+wxthread&hl=fr
/* Imported functions */
int authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons);
+bool parse_wxcons_config(CONFIG *config, const char *cfgfile, LEX_ERROR_HANDLER *scan_error);
bool console_thread::inited = false;
bool console_thread::configloaded = false;
wxString console_thread::working_dir = wxT(".");
int numdir = 0;
+static CONFIG *config = NULL;
+static void scan_err(const char *file, int line, LEX *lc, const char *msg, ...);
+
/*
* Call-back for reading a passphrase for an encrypted PEM file
return _("Error while initializing library.");
}
- free_config_resources();
+ if (config) {
+ config->free_resources();
+ free(config);
+ }
MSGS* msgs = (MSGS *)bmalloc(sizeof(MSGS));
memset(msgs, 0, sizeof(MSGS));
//init_console_msg(console_thread::working_dir.mb_str(*wxConvCurrent));
errmsg = wxT("");
- if (!parse_config(configfile.mb_str(*wxConvCurrent), &scan_err)) {
+ config = new_config_parser();
+ if (!parse_wxcons_config(config, configfile.mb_str(*wxConvCurrent), &scan_err)) {
configloaded = false;
term_msg();
return errmsg;
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2004-20076 Free Software Foundation Europe e.V.
+ Copyright (C) 2004-2008 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
General:
+kes Make first step toward eliminating globals from config
+ scanning. Also should be a workaround for FORTIFY_SOURCE
+ GNU C bug -- fixes bug #1042.
21Jun08
kes Apply duplicate job tests to restarted jobs.
kes Copy more data when restarting a job so that run