]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/dird/ua.h
Backout vol size tests in previous attempt to fix bug #2349
[bacula/bacula] / bacula / src / dird / ua.h
1 /*
2    Bacula(R) - The Network Backup Solution
3
4    Copyright (C) 2000-2017 Kern Sibbald
5
6    The original author of Bacula is Kern Sibbald, with contributions
7    from many others, a complete list can be found in the file AUTHORS.
8
9    You may use this file and others of this release according to the
10    license defined in the LICENSE file, which includes the Affero General
11    Public License, v3.0 ("AGPLv3") and some additional permissions and
12    terms pursuant to its AGPLv3 Section 7.
13
14    This notice must be preserved when any source code is
15    conveyed and/or propagated.
16
17    Bacula(R) is a registered trademark of Kern Sibbald.
18 */
19 /*
20  * Includes specific to the Director User Agent Server
21  *
22  *     Kern Sibbald, August MMI
23  */
24
25 #ifndef __UA_H_
26 #define __UA_H_ 1
27
28 class UAContext {
29 public:
30    BSOCK *UA_sock;
31    BSOCK *sd;
32    JCR *jcr;
33    BDB *db;                          /* Pointing to shared or private db */
34    BDB *shared_db;                   /* Main Bacula DB access */
35    BDB *private_db;                  /* Private DB access */
36    CAT *catalog;
37    CONRES *cons;                      /* console resource */
38    POOLMEM *cmd;                      /* return command/name buffer */
39    POOLMEM *args;                     /* command line arguments */
40    POOLMEM *errmsg;                   /* store error message */
41    char *argk[MAX_CMD_ARGS];          /* argument keywords */
42    char *argv[MAX_CMD_ARGS];          /* argument values */
43    int argc;                          /* number of arguments */
44    char **prompt;                     /* list of prompts */
45    char **unique;                     /* extra unique field */
46    int max_prompts;                   /* max size of list */
47    int num_prompts;                   /* current number in list */
48    char api_opts[MAX_NAME_LENGTH];    /* Api options */
49    int api;                           /* For programs want an API */
50    int cmd_index;                     /* Index in command table */
51    bool force_mult_db_connections;    /* overwrite cat.mult_db_connections */
52    bool auto_display_messages;        /* if set, display messages */
53    bool user_notified_msg_pending;    /* set when user notified */
54    bool automount;                    /* if set, mount after label */
55    bool quit;                         /* if set, quit */
56    bool verbose;                      /* set for normal UA verbosity */
57    bool batch;                        /* set for non-interactive mode */
58    bool gui;                          /* set if talking to GUI program */
59    bool runscript;                    /* set if we are in runscript */
60    uint32_t pint32_val;               /* positive integer */
61    int32_t  int32_val;                /* positive/negative */
62    int64_t  int64_val;                /* big int */
63
64    void *bvfs;                        /* used in some bvfs queries */
65
66    void signal(int sig) { UA_sock->signal(sig); };
67
68    /* The below are in ua_output.c */
69    void send_msg(const char *fmt, ...);
70    void error_msg(const char *fmt, ...);
71    void warning_msg(const char *fmt, ...);
72    void info_msg(const char *fmt, ...);
73 };
74
75 /* Context for insert_tree_handler() */
76 struct TREE_CTX {
77    TREE_ROOT *root;                   /* root */
78    TREE_NODE *node;                   /* current node */
79    TREE_NODE *avail_node;             /* unused node last insert */
80    int cnt;                           /* count for user feedback */
81    bool all;                          /* if set mark all as default */
82    bool hardlinks_in_mem;             /* Set to optimize for speed */
83    bool no_auto_parent;               /* Set to not select parent directories */
84    UAContext *ua;
85    uint32_t FileEstimate;             /* estimate of number of files */
86    uint32_t FileCount;                /* current count of files */
87    uint32_t LastCount;                /* last count of files */
88    uint32_t DeltaCount;               /* trigger for printing */
89    alist *uid_acl;                    /* UID allowed in the tree */
90    alist *gid_acl;                    /* GID allowed in the tree */
91    alist *dir_acl;                    /* Directories that can be displayed */
92    char  *last_dir_acl;               /* Last directory from the DirectoryACL list */
93 };
94
95 struct NAME_LIST {
96    char **name;                       /* list of names */
97    int num_ids;                       /* ids stored */
98    int max_ids;                       /* size of array */
99    int num_del;                       /* number deleted */
100    int tot_ids;                       /* total to process */
101 };
102
103
104 /* Main structure for obtaining JobIds or Files to be restored */
105 struct RESTORE_CTX {
106    utime_t JobTDate;
107    uint32_t TotalFiles;
108    JobId_t JobId;
109    char ClientName[MAX_NAME_LENGTH];  /* backup client */
110    char RestoreClientName[MAX_NAME_LENGTH];  /* restore client */
111    char RestoreMediaType[MAX_NAME_LENGTH];   /* restore Media type when storage override */
112    char last_jobid[20];
113    POOLMEM *JobIds;                   /* User entered string of JobIds */
114    POOLMEM *BaseJobIds;               /* Base jobids */
115    STORE  *store;
116    JOB *restore_job;
117    POOL *pool;
118    int restore_jobs;
119    uint32_t selected_files;
120    char *comment;
121    char *where;
122    char *RegexWhere;
123    char *replace;
124    char *fileregex;
125
126    char *when;
127    rblist *bsr_list;
128    POOLMEM *fname;                    /* filename only */
129    POOLMEM *path;                     /* path only */
130    POOLMEM *query;
131    int fnl;                           /* filename length */
132    int pnl;                           /* path length */
133    bool found;
134    bool all;                          /* mark all as default */
135    bool hardlinks_in_mem;             /* keep hard links in memory */
136    bool fdcalled;                     /* True if we should reuse the FD socket */
137    bool no_auto_parent;               /* Select or not parent directories */
138    NAME_LIST name_list;
139    POOLMEM *component_fname;
140    FILE *component_fd;
141 };
142
143 #define MAX_ID_LIST_LEN 2000000
144
145 #endif