]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/dird/ua.h
Make restore Job work -- kes11Aug02
[bacula/bacula] / bacula / src / dird / ua.h
1 /*
2  * Includes specific to the Director User Agent Server
3  *
4  *     Kern Sibbald, August MMI
5  *
6  *     Version $Id$
7  */
8 /*
9    Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker
10
11    This program is free software; you can redistribute it and/or
12    modify it under the terms of the GNU General Public License as
13    published by the Free Software Foundation; either version 2 of
14    the License, or (at your option) any later version.
15
16    This program is distributed in the hope that it will be useful,
17    but WITHOUT ANY WARRANTY; without even the implied warranty of
18    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19    General Public License for more details.
20
21    You should have received a copy of the GNU General Public
22    License along with this program; if not, write to the Free
23    Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
24    MA 02111-1307, USA.
25
26  */
27
28 #define MAX_ARGS 30
29
30 typedef struct s_ua_context {
31    BSOCK *UA_sock;
32    BSOCK *sd;
33    JCR *jcr;
34    B_DB *db;
35    CAT *catalog;
36    POOLMEM *cmd;                      /* return command/name buffer */
37    POOLMEM *args;                     /* command line arguments */
38    char *argk[MAX_ARGS];              /* argument keywords */
39    char *argv[MAX_ARGS];              /* argument values */
40    int argc;                          /* number of arguments */
41    char **prompt;                     /* list of prompts */
42    int max_prompts;                   /* max size of list */
43    int num_prompts;                   /* current number in list */
44    int auto_display_messages;         /* if set, display messages */
45    int user_notified_msg_pending;     /* set when user notified */
46    int automount;                     /* if set, mount after label */
47    int quit;                          /* if set, quit */
48    int verbose;                       /* set for normal UA verbosity */
49 } UAContext;
50
51 /* ua_cmds.c */
52 int do_a_command(UAContext *ua, char *cmd);
53 int do_a_dot_command(UAContext *ua, char *cmd);
54 int qmessagescmd(UAContext *ua, char *cmd);
55 int open_db(UAContext *ua);
56 void close_db(UAContext *ua);
57
58 /* ua_input.c */
59 char *next_arg(char **s);
60 int get_cmd(UAContext *ua, char *prompt);
61 void parse_command_args(UAContext *ua);
62
63 /* ua_output.c */
64 void prtit(void *ctx, char *msg);
65
66 /* ua_server.c */
67 void bsendmsg(void *sock, char *fmt, ...);
68
69 /* ua_select.c */
70 STORE   *select_storage_resource(UAContext *ua);
71 JOB     *select_job_resource(UAContext *ua);
72 JOB     *select_restore_job_resource(UAContext *ua);
73 CLIENT  *select_client_resource(UAContext *ua);
74 FILESET *select_fileset_resource(UAContext *ua);
75 int     select_pool_and_media_dbr(UAContext *ua, POOL_DBR *pr, MEDIA_DBR *mr);
76 int     select_pool_dbr(UAContext *ua, POOL_DBR *pr);
77
78 void    start_prompt(UAContext *ua, char *msg);
79 void    add_prompt(UAContext *ua, char *prompt);
80 int     do_prompt(UAContext *ua, char *msg, char *prompt);
81 CAT    *get_catalog_resource(UAContext *ua);           
82 STORE  *get_storage_resource(UAContext *ua, char *cmd);
83 int     get_media_type(UAContext *ua, char *MediaType);
84 int     get_pool_dbr(UAContext *ua, POOL_DBR *pr);
85 POOL   *get_pool_resource(UAContext *ua);
86 CLIENT *get_client_resource(UAContext *ua);
87 int     get_job_dbr(UAContext *ua, JOB_DBR *jr);
88
89 int find_arg_keyword(UAContext *ua, char **list);
90 int do_keyword_prompt(UAContext *ua, char *msg, char **list);
91 int confirm_retention(UAContext *ua, btime_t *ret, char *msg);
92
93 /* ua_prune.c */
94 int prune_files(UAContext *ua, CLIENT *client);
95 int prune_jobs(UAContext *ua, CLIENT *client, int JobType);
96 int prune_volume(UAContext *ua, POOL_DBR *pr, MEDIA_DBR *mr);