]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/dird/ua.h
Tweak example SD plugin.
[bacula/bacula] / bacula / src / dird / ua.h
1 /*
2    Bacula® - The Network Backup Solution
3
4    Copyright (C) 2001-2011 Free Software Foundation Europe e.V.
5
6    The main author of Bacula is Kern Sibbald, with contributions from
7    many others, a complete list can be found in the file AUTHORS.
8    This program is Free Software; you can redistribute it and/or
9    modify it under the terms of version three of the GNU Affero General Public
10    License as published by the Free Software Foundation and included
11    in the file LICENSE.
12
13    This program is distributed in the hope that it will be useful, but
14    WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16    General Public License for more details.
17
18    You should have received a copy of the GNU Affero General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21    02110-1301, USA.
22
23    Bacula® is a registered trademark of Kern Sibbald.
24    The licensor of Bacula is the Free Software Foundation Europe
25    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
26    Switzerland, email:ftf@fsfeurope.org.
27 */
28 /*
29  * Includes specific to the Director User Agent Server
30  *
31  *     Kern Sibbald, August MMI
32  *
33  */
34
35 #ifndef __UA_H_
36 #define __UA_H_ 1
37
38 class UAContext {
39 public:
40    BSOCK *UA_sock;
41    BSOCK *sd;
42    JCR *jcr;
43    B_DB *db;
44    CAT *catalog;
45    CONRES *cons;                      /* console resource */
46    POOLMEM *cmd;                      /* return command/name buffer */
47    POOLMEM *args;                     /* command line arguments */
48    POOLMEM *errmsg;                   /* store error message */
49    char *argk[MAX_CMD_ARGS];          /* argument keywords */
50    char *argv[MAX_CMD_ARGS];          /* argument values */
51    int argc;                          /* number of arguments */
52    char **prompt;                     /* list of prompts */
53    int max_prompts;                   /* max size of list */
54    int num_prompts;                   /* current number in list */
55    int api;                           /* For programs want an API */
56    int cmd_index;                     /* Index in command table */
57    bool force_mult_db_connections;    /* overwrite cat.mult_db_connections */
58    bool auto_display_messages;        /* if set, display messages */
59    bool user_notified_msg_pending;    /* set when user notified */
60    bool automount;                    /* if set, mount after label */
61    bool quit;                         /* if set, quit */
62    bool verbose;                      /* set for normal UA verbosity */
63    bool batch;                        /* set for non-interactive mode */
64    bool gui;                          /* set if talking to GUI program */
65    bool runscript;                    /* set if we are in runscript */
66    uint32_t pint32_val;               /* positive integer */
67    int32_t  int32_val;                /* positive/negative */
68    int64_t  int64_val;                /* big int */
69
70    void signal(int sig) { UA_sock->signal(sig); };
71
72    /* The below are in ua_output.c */
73    void send_msg(const char *fmt, ...);
74    void error_msg(const char *fmt, ...);
75    void warning_msg(const char *fmt, ...);
76    void info_msg(const char *fmt, ...);
77 };
78
79 /* Context for insert_tree_handler() */
80 struct TREE_CTX {
81    TREE_ROOT *root;                   /* root */
82    TREE_NODE *node;                   /* current node */
83    TREE_NODE *avail_node;             /* unused node last insert */
84    int cnt;                           /* count for user feedback */
85    bool all;                          /* if set mark all as default */
86    UAContext *ua;
87    uint32_t FileEstimate;             /* estimate of number of files */
88    uint32_t FileCount;                /* current count of files */
89    uint32_t LastCount;                /* last count of files */
90    uint32_t DeltaCount;               /* trigger for printing */
91 };
92
93 struct NAME_LIST {
94    char **name;                       /* list of names */
95    int num_ids;                       /* ids stored */
96    int max_ids;                       /* size of array */
97    int num_del;                       /* number deleted */
98    int tot_ids;                       /* total to process */
99 };
100
101
102 /* Main structure for obtaining JobIds or Files to be restored */
103 struct RESTORE_CTX {
104    utime_t JobTDate;
105    uint32_t TotalFiles;
106    JobId_t JobId;
107    char ClientName[MAX_NAME_LENGTH];  /* backup client */
108    char RestoreClientName[MAX_NAME_LENGTH];  /* restore client */
109    char last_jobid[20];
110    POOLMEM *JobIds;                   /* User entered string of JobIds */
111    POOLMEM *BaseJobIds;               /* Base jobids */
112    STORE  *store;
113    JOB *restore_job;
114    POOL *pool;
115    int restore_jobs;
116    uint32_t selected_files;
117    char *comment;
118    char *where;
119    char *RegexWhere;
120    char *replace;
121    RBSR *bsr;
122    POOLMEM *fname;                    /* filename only */
123    POOLMEM *path;                     /* path only */
124    POOLMEM *query;
125    int fnl;                           /* filename length */
126    int pnl;                           /* path length */
127    bool found;
128    bool all;                          /* mark all as default */
129    NAME_LIST name_list;
130 };
131
132 #define MAX_ID_LIST_LEN 2000000
133
134 #endif