]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/parse_conf.h
Strip pathname portion off all message routines that print filename:line.
[bacula/bacula] / bacula / src / lib / parse_conf.h
index d216e49e2f6d7e9de82a214bf67d6e5732ec5fb1..181d55343d0a0adc51cb65fdc252c15338507aaf 100644 (file)
@@ -2,46 +2,53 @@
  *   Version $Id$
  */
 /*
-   Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker
+   Copyright (C) 2000-2006 Kern Sibbald
 
    This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of
-   the License, or (at your option) any later version.
+   modify it under the terms of the GNU General Public License
+   version 2 as amended with additional clauses defined in the
+   file LICENSE in the main source directory.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public
-   License along with this program; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-   MA 02111-1307, USA.
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
+   the file LICENSE for additional details.
 
  */
 
-struct res_items;                   /* Declare forward referenced structure */ 
-typedef void (MSG_RES_HANDLER)(LEX *lc, struct res_items *item, int index, int pass);
+struct RES_ITEM;                    /* Declare forward referenced structure */
+struct 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
  * tables.
  */
-struct res_items {
+struct RES_ITEM {
    const char *name;                  /* Resource name i.e. Director, ... */
    MSG_RES_HANDLER *handler;          /* Routine storing the resource item */
-   void **value;                      /* Where to store the item */
+   union {
+      char **value;                   /* Where to store the item */
+      char **charvalue;
+      uint32_t ui32value;
+      int32_t i32value;
+      uint64_t ui64value;
+      int64_t i64value;
+      bool boolvalue;
+      utime_t utimevalue;
+      RES *resvalue;
+      RES **presvalue;
+   };
    int  code;                         /* item code/additional info */
    int  flags;                        /* flags: default, required, ... */
    int  default_value;                /* default value */
 };
 
 /* For storing name_addr items in res_items table */
-#define ITEM(x) ((void **)&res_all.x)
+#define ITEM(x) {(char **)&res_all.x}
 
-#define MAX_RES_ITEMS 50              /* maximum resource items per RES */
+#define MAX_RES_ITEMS 70              /* maximum resource items per RES */
 
 /* This is the universal header that is
  * at the beginning of every resource
@@ -57,16 +64,15 @@ struct RES {
 };
 
 
-/* 
+/*
  * Master Resource configuration structure definition
  * This is the structure that defines the
  * resources that are available to this daemon.
  */
-struct s_res {       
+struct RES_TABLE {
    const char *name;                  /* resource name */
-   struct res_items *items;           /* list of resource keywords */
+   RES_ITEM *items;                   /* list of resource keywords */
    int rcode;                         /* code if needed */
-   RES *res_head;                     /* where to store it */
 };
 
 /* Common Resource definitions */
@@ -97,41 +103,49 @@ union CURES {
 
 
 /* Configuration routines */
-void  parse_config(char *cf);
-void  free_config_resources(void);
+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();
+
 
 /* Resource routines */
 RES *GetResWithName(int rcode, char *name);
 RES *GetNextRes(int rcode, RES *res);
 void b_LockRes(const char *file, int line);
 void b_UnlockRes(const char *file, int line);
-void dump_resource(int type, RES *res, void sendmsg(void *sock, char *fmt, ...), void *sock);
-void free_resource(int type);
-void init_resource(int type, struct res_items *item);
-void save_resource(int type, struct res_items *item, int pass);
+void dump_resource(int type, RES *res, void sendmsg(void *sock, const char *fmt, ...), void *sock);
+void free_resource(RES *res, int type);
+void init_resource(int type, RES_ITEM *item);
+void save_resource(int type, RES_ITEM *item, int pass);
 const char *res_to_str(int rcode);
 
 /* Loop through each resource of type, returning in var */
+#ifdef HAVE_TYPEOF
 #define foreach_res(var, type) \
-    for(var=NULL; (*((void **)&(var))=(void *)GetNextRes((type), (RES *)var));) 
-
-#ifdef the_old_way
+        for((var)=NULL; ((var)=(typeof(var))GetNextRes((type), (RES *)var));)
+#else 
 #define foreach_res(var, type) \
-        for((var)=NULL; (((void *)(var))=GetNextRes((type), (RES *)var));) 
+    for(var=NULL; (*((void **)&(var))=(void *)GetNextRes((type), (RES *)var));)
 #endif
 
 
-void store_str(LEX *lc, struct res_items *item, int index, int pass);
-void store_dir(LEX *lc, struct res_items *item, int index, int pass);
-void store_password(LEX *lc, struct res_items *item, int index, int pass);
-void store_name(LEX *lc, struct res_items *item, int index, int pass);
-void store_strname(LEX *lc, struct res_items *item, int index, int pass);
-void store_res(LEX *lc, struct res_items *item, int index, int pass);
-void store_int(LEX *lc, struct res_items *item, int index, int pass);
-void store_pint(LEX *lc, struct res_items *item, int index, int pass);
-void store_msgs(LEX *lc, struct res_items *item, int index, int pass);
-void store_int64(LEX *lc, struct res_items *item, int index, int pass);
-void store_yesno(LEX *lc, struct res_items *item, int index, int pass);
-void store_time(LEX *lc, struct res_items *item, int index, int pass);
-void store_size(LEX *lc, struct res_items *item, int index, int pass);
-void store_defs(LEX *lc, struct res_items *item, int index, int pass);
+
+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);
+void store_name(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_strname(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_res(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_alist_res(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_alist_str(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_int(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_pint(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_msgs(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_int64(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_bit(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_bool(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_time(LEX *lc, RES_ITEM *item, int index, int pass);
+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);