]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/parse_conf.h
kes Correctly detect Ubuntu systems, and add ubuntu platform directory.
[bacula/bacula] / bacula / src / lib / parse_conf.h
index aa101153bde98cf6e8a69b6157a9be43b3c3418c..6ce558666998154cbf9e49286e19b774449d3882 100644 (file)
@@ -1,14 +1,14 @@
 /*
    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.
    This program is Free Software; you can redistribute it and/or
    modify it under the terms of version two of the GNU General Public
-   License as published by the Free Software Foundation plus additions
-   that are listed in the file LICENSE.
+   License as published by the Free Software Foundation and included
+   in the file LICENSE.
 
    This program is distributed in the hope that it will be useful, but
    WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -37,6 +37,7 @@ struct RES_ITEM;                    /* Declare forward referenced structure */
 class RES;                         /* Declare forware referenced structure */
 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
@@ -65,7 +66,7 @@ struct RES_ITEM {
 /* For storing name_addr items in res_items table */
 #define ITEM(x) {(char **)&res_all.x}
 
-#define MAX_RES_ITEMS 70              /* maximum resource items per RES */
+#define MAX_RES_ITEMS 80              /* maximum resource items per RES */
 
 /* This is the universal header that is
  * at the beginning of every resource
@@ -93,6 +94,8 @@ struct RES_TABLE {
    int rcode;                         /* code if needed */
 };
 
+
+
 /* Common Resource definitions */
 
 #define MAX_RES_NAME_LENGTH MAX_NAME_LENGTH-1       /* maximum resource name length */
@@ -116,25 +119,55 @@ public:
 
 inline char *MSGS::name() const { return hdr.name; }
 
-
-/* Define the Union of all the above common
- * resource structure definitions.
+/* 
+ * Old C style configuration routines -- deprecated do not use.
  */
-union CURES {
-   MSGS  res_msgs;
-   RES hdr;
-};
-
-
-/* Configuration routines */
 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();
 
+/*
+ * New C++ configuration routines
+ */
+
+class CONFIG {
+public:
+   const char *m_cf;                   /* config file */
+   LEX_ERROR_HANDLER *m_scan_error;    /* error handler if non-null */
+   int m_err_type;                     /* the way to terminate on failure */
+   void *m_res_all;                    /* pointer to res_all buffer */
+   int m_res_all_size;                 /* length of buffer */
+   /* The below are not yet implemented */
+   int m_r_first;                      /* first daemon resource type */
+   int m_r_last;                       /* last daemon resource type */
+   RES_TABLE *m_resources;             /* pointer to table of permitted resources */      
+   RES **m_res_head;                   /* pointer to defined resources */
+   brwlock_t m_res_lock;               /* resource lock */
+
+   /* functions */
+   void init(
+      const char *cf,
+      LEX_ERROR_HANDLER *scan_error,
+      int err_type,
+      void *vres_all,
+      int res_all_size,
+      int r_first,
+      int r_last,
+      RES_TABLE *resources,
+      RES **res_head);
+
+   bool parse_config();
+   void free_resources();
+   RES **save_resources();
+   RES **new_res_head();
+};
+CONFIG *new_config_parser();
+
 
 /* Resource routines */
-RES *GetResWithName(int rcode, char *name);
+RES *GetResWithName(int rcode, const char *name);
 RES *GetNextRes(int rcode, RES *res);
 void b_LockRes(const char *file, int line);
 void b_UnlockRes(const char *file, int line);
@@ -154,7 +187,9 @@ const char *res_to_str(int rcode);
 #endif
 
 
-
+/*
+ * Standard global parsers defined in parse_config.c
+ */
 void store_str(LEX *lc, RES_ITEM *item, int index, int pass);
 void store_dir(LEX *lc, RES_ITEM *item, int index, int pass);
 void store_password(LEX *lc, RES_ITEM *item, int index, int pass);