]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/dird/ua.h
3fa6f25a3bbadb421d4d49fb2f58dd8d87e2d350
[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    int quit;                          /* if set, quit */
46    int verbose;                       /* set for normal UA verbosity */
47 } UAContext;
48
49 /* ua_cmds.c */
50 int do_a_command(UAContext *ua, char *cmd);
51 int do_a_dot_command(UAContext *ua, char *cmd);
52 int qmessagescmd(UAContext *ua, char *cmd);
53 int open_db(UAContext *ua);
54 void close_db(UAContext *ua);
55
56 /* ua_input.c */
57 char *next_arg(char **s);
58 int get_cmd(UAContext *ua, char *prompt);
59 void parse_command_args(UAContext *ua);
60
61 /* ua_output.c */
62 void prtit(void *ctx, char *msg);
63
64 /* ua_server.c */
65 void bsendmsg(void *sock, char *fmt, ...);
66
67 /* ua_select.c */
68 STORE *select_storage_resource(UAContext *ua);
69 JOB   *select_job_resource(UAContext *ua);
70 int    select_pool_dbr(UAContext *ua, POOL_DBR *pr);
71 CLIENT *select_client_resource(UAContext *ua);
72 FILESET *select_fs_resource(UAContext *ua);
73 int select_pool_and_media_dbr(UAContext *ua, POOL_DBR *pr, MEDIA_DBR *mr);
74
75 void   start_prompt(UAContext *ua, char *msg);
76 void   add_prompt(UAContext *ua, char *prompt);
77 int    do_prompt(UAContext *ua, char *msg, char *prompt);
78 CAT   *get_catalog_resource(UAContext *ua);           
79 STORE *get_storage_resource(UAContext *ua, char *cmd);
80 int    get_media_type(UAContext *ua, char *MediaType);
81 int    get_pool_dbr(UAContext *ua, POOL_DBR *pr);
82 POOL  *get_pool_resource(UAContext *ua);
83 CLIENT *get_client_resource(UAContext *ua);
84 int get_job_dbr(UAContext *ua, JOB_DBR *jr);
85
86 int find_arg_keyword(UAContext *ua, char **list);
87 int do_keyword_prompt(UAContext *ua, char *msg, char **list);