]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/dird/ua.h
aed04ce475b2e7724eac769af088fd628223fecb
[bacula/bacula] / bacula / src / dird / ua.h
1 /*
2    Bacula(R) - The Network Backup Solution
3
4    Copyright (C) 2000-2015 Kern Sibbald
5    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
6
7    The original author of Bacula is Kern Sibbald, with contributions
8    from many others, a complete list can be found in the file AUTHORS.
9
10    You may use this file and others of this release according to the
11    license defined in the LICENSE file, which includes the Affero General
12    Public License, v3.0 ("AGPLv3") and some additional permissions and
13    terms pursuant to its AGPLv3 Section 7.
14
15    This notice must be preserved when any source code is 
16    conveyed and/or propagated.
17
18    Bacula(R) is a registered trademark of Kern Sibbald.
19 */
20 /*
21  * Includes specific to the Director User Agent Server
22  *
23  *     Kern Sibbald, August MMI
24  *
25  */
26
27 #ifndef __UA_H_
28 #define __UA_H_ 1
29
30 class UAContext {
31 public:
32    BSOCK *UA_sock;
33    BSOCK *sd;
34    JCR *jcr;
35    BDB *db;                          /* Pointing to shared or private db */
36    BDB *shared_db;                   /* Main Bacula DB access */
37    BDB *private_db;                  /* Private DB access */
38    CAT *catalog;
39    CONRES *cons;                      /* console resource */
40    POOLMEM *cmd;                      /* return command/name buffer */
41    POOLMEM *args;                     /* command line arguments */
42    POOLMEM *errmsg;                   /* store error message */
43    char *argk[MAX_CMD_ARGS];          /* argument keywords */
44    char *argv[MAX_CMD_ARGS];          /* argument values */
45    int argc;                          /* number of arguments */
46    char **prompt;                     /* list of prompts */
47    char **unique;                     /* extra unique field */
48    int max_prompts;                   /* max size of list */
49    int num_prompts;                   /* current number in list */
50    char api_opts[MAX_NAME_LENGTH];    /* Api options */
51    int api;                           /* For programs want an API */
52    int cmd_index;                     /* Index in command table */
53    bool force_mult_db_connections;    /* overwrite cat.mult_db_connections */
54    bool auto_display_messages;        /* if set, display messages */
55    bool user_notified_msg_pending;    /* set when user notified */
56    bool automount;                    /* if set, mount after label */
57    bool quit;                         /* if set, quit */
58    bool verbose;                      /* set for normal UA verbosity */
59    bool batch;                        /* set for non-interactive mode */
60    bool gui;                          /* set if talking to GUI program */
61    bool runscript;                    /* set if we are in runscript */
62    uint32_t pint32_val;               /* positive integer */
63    int32_t  int32_val;                /* positive/negative */
64    int64_t  int64_val;                /* big int */
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    UAContext *ua;
84    uint32_t FileEstimate;             /* estimate of number of files */
85    uint32_t FileCount;                /* current count of files */
86    uint32_t LastCount;                /* last count of files */
87    uint32_t DeltaCount;               /* trigger for printing */
88 };
89
90 struct NAME_LIST {
91    char **name;                       /* list of names */
92    int num_ids;                       /* ids stored */
93    int max_ids;                       /* size of array */
94    int num_del;                       /* number deleted */
95    int tot_ids;                       /* total to process */
96 };
97
98
99 /* Main structure for obtaining JobIds or Files to be restored */
100 struct RESTORE_CTX {
101    utime_t JobTDate;
102    uint32_t TotalFiles;
103    JobId_t JobId;
104    char ClientName[MAX_NAME_LENGTH];  /* backup client */
105    char RestoreClientName[MAX_NAME_LENGTH];  /* restore client */
106    char RestoreMediaType[MAX_NAME_LENGTH];   /* restore Media type when storage override */
107    char last_jobid[20];
108    POOLMEM *JobIds;                   /* User entered string of JobIds */
109    POOLMEM *BaseJobIds;               /* Base jobids */
110    STORE  *store;
111    JOB *restore_job;
112    POOL *pool;
113    int restore_jobs;
114    uint32_t selected_files;
115    char *comment;
116    char *where;
117    char *RegexWhere;
118    char *replace;
119    RBSR *bsr;
120    POOLMEM *fname;                    /* filename only */
121    POOLMEM *path;                     /* path only */
122    POOLMEM *query;
123    int fnl;                           /* filename length */
124    int pnl;                           /* path length */
125    bool found;
126    bool all;                          /* mark all as default */
127    bool hardlinks_in_mem;             /* keep hard links in memory */
128    NAME_LIST name_list;
129    POOLMEM *component_fname;
130    FILE *component_fd;
131 };
132
133 #define MAX_ID_LIST_LEN 2000000
134
135 #endif