]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/parse_conf.h
const char * additions
[bacula/bacula] / bacula / src / lib / parse_conf.h
index a666970af828b405cd737062266336bc8849608c..78c1beba24ddc6db1f105606a98a94394ae3e021 100644 (file)
@@ -41,14 +41,14 @@ struct res_items {
 /* For storing name_addr items in res_items table */
 #define ITEM(x) ((void **)&res_all.x)
 
-#define MAX_RES_ITEMS 32              /* maximum resource items per RES */
+#define MAX_RES_ITEMS 50              /* maximum resource items per RES */
 
 /* This is the universal header that is
  * at the beginning of every resource
  * record.
  */
-struct s_reshdr {
-   struct s_reshdr *next;             /* pointer to next resource of this type */
+struct RES {
+   RES *next;                         /* pointer to next resource of this type */
    char *name;                        /* resource name */
    char *desc;                        /* resource description */
    int   rcode;                       /* resource id or type */
@@ -56,7 +56,6 @@ struct s_reshdr {
    char  item_present[MAX_RES_ITEMS]; /* set if item is present in conf file */
 };
 
-typedef struct s_reshdr RES;
 
 /* 
  * Master Resource configuration structure definition
@@ -74,30 +73,28 @@ struct s_res {
 
 #define MAX_RES_NAME_LENGTH MAX_NAME_LENGTH-1       /* maximum resource name length */
 
-#define ITEM_REQUIRED 0x1             /* item required */
-#define ITEM_DEFAULT  0x2             /* default supplied */
+#define ITEM_REQUIRED    0x1          /* item required */
+#define ITEM_DEFAULT     0x2          /* default supplied */
+#define ITEM_NO_EQUALS   0x4          /* Don't scan = after name */
 
 /* Message Resource */
-struct s_res_msgs {
+struct MSGS {
    RES   hdr;
    char *mail_cmd;                    /* mail command */
    char *operator_cmd;                /* Operator command */
    DEST *dest_chain;                  /* chain of destinations */
    char send_msg[nbytes_for_bits(M_MAX+1)];  /* bit array of types */
 };
-typedef struct s_res_msgs MSGS;
 
 
 /* Define the Union of all the above common
  * resource structure definitions.
  */
-union cu_res {
-   struct s_res_msgs    res_msgs;
+union CURES {
+   MSGS  res_msgs;
    RES hdr;
 };
 
-typedef union cu_res CURES;
-
 
 /* Configuration routines */
 void  parse_config(char *cf);
@@ -114,6 +111,16 @@ void init_resource(int type, struct res_items *item);
 void save_resource(int type, struct res_items *item, int pass);
 char *res_to_str(int rcode);
 
+/* Loop through each resource of type, returning in var */
+#define foreach_res(var, type) \
+    for(var=NULL; (*((void **)&(var))=(void *)GetNextRes((type), (RES *)var));) 
+
+#ifdef the_old_way
+#define foreach_res(var, type) \
+        for((var)=NULL; (((void *)(var))=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);
@@ -127,3 +134,4 @@ 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);