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