]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/qt-console/tray-monitor/tray_conf.h
f2bc4d8d0fe9f1b47fb92475ae554b1a75c47e72
[bacula/bacula] / bacula / src / qt-console / tray-monitor / tray_conf.h
1 /*
2    Bacula(R) - The Network Backup Solution
3
4    Copyright (C) 2000-2017 Kern Sibbald
5
6    The original author of Bacula is Kern Sibbald, with contributions
7    from many others, a complete list can be found in the file AUTHORS.
8
9    You may use this file and others of this release according to the
10    license defined in the LICENSE file, which includes the Affero General
11    Public License, v3.0 ("AGPLv3") and some additional permissions and
12    terms pursuant to its AGPLv3 Section 7.
13
14    This notice must be preserved when any source code is
15    conveyed and/or propagated.
16
17    Bacula(R) is a registered trademark of Kern Sibbald.
18 */
19 /*
20  * Tray Monitor specific configuration and defines
21  *
22  *   Adapted from dird_conf.c
23  *
24  *     Nicolas Boichat, August MMIV
25  *
26  */
27
28 #ifndef TRAY_CONF
29 #define TRAY_CONF
30
31 #include "common.h"
32
33 /* NOTE:  #includes at the end of this file */
34
35 /*
36  * Resource codes -- they must be sequential for indexing
37  */
38 enum rescode {
39    R_MONITOR = 1001,
40    R_DIRECTOR,
41    R_CLIENT,
42    R_STORAGE,
43    R_CONSOLE_FONT,
44    R_FIRST = R_MONITOR,
45    R_LAST  = R_CONSOLE_FONT                /* keep this updated */
46 };
47
48
49 /*
50  * Some resource attributes
51  */
52 enum {
53    R_NAME = 1020,
54    R_ADDRESS,
55    R_PASSWORD,
56    R_TYPE,
57    R_BACKUP
58 };
59
60 struct s_running_job
61 {
62    int32_t Errors;                    /* FD/SD errors */
63    int32_t JobType;
64    int32_t JobStatus;
65    int32_t JobLevel;
66    uint32_t JobId;
67    uint32_t VolSessionId;
68    uint32_t VolSessionTime;
69    uint32_t JobFiles;
70    uint64_t JobBytes;
71    uint64_t ReadBytes;
72    utime_t start_time;
73    int64_t bytespersec;
74    int  SDtls;
75    char Client[MAX_NAME_LENGTH];
76    char FileSet[MAX_NAME_LENGTH];
77    char Storage[MAX_NAME_LENGTH];
78    char RStorage[MAX_NAME_LENGTH];
79    char sched_time;
80    char Job[MAX_NAME_LENGTH];
81    char CurrentFile[4096];
82 };
83
84 /* forward definition */
85 class worker;
86
87 /* Director/Client/Storage */
88 struct RESMON {
89    RES      hdr;                   /* Keep First */
90    uint32_t type;                  /* Keep 2nd R_CLIENT, R_DIRECTOR, R_STORAGE */
91
92    uint32_t port;                  /* UA server port */
93    char    *address;               /* UA server address */
94    utime_t  connect_timeout;       /* timeout for connect in seconds */
95    char    *password;
96    
97    bool  use_remote;                /* Use Client Initiated backup feature */
98    bool  use_monitor;               /* update the status icon with this resource */
99    bool  use_setip;                 /* Send setip command before a job */
100
101    bool  tls_enable;               /* Enable TLS on all connections */
102    char *tls_ca_certfile;          /* TLS CA Certificate File */
103    char *tls_ca_certdir;           /* TLS CA Certificate Directory */
104    char *tls_certfile;             /* TLS Client Certificate File */
105    char *tls_keyfile;              /* TLS Client Key File */
106
107    /* ------------------------------------------------------------ */
108    TLS_CONTEXT *tls_ctx;           /* Shared TLS Context */
109    worker *wrk;                    /* worker that will handle async op */
110
111    QMutex *mutex;
112    BSOCK *bs;
113    char name[MAX_NAME_LENGTH];
114    char version[MAX_NAME_LENGTH];
115    char plugins[MAX_NAME_LENGTH];
116    char started[32];            /* ISO date */
117    char reloaded[32];           /* ISO date */
118    int  bwlimit;
119    alist *running_jobs;
120    dlist *terminated_jobs;
121    btime_t last_update;
122    bool new_resource;
123    bool proxy_sent;
124
125    /* List of resources available */
126    alist *jobs;
127    alist *clients;
128    alist *filesets;
129    alist *pools;
130    alist *storages;
131    alist *catalogs;
132
133    /* Default value */
134    struct {
135       char *job;
136       char *client;
137       char *pool;
138       char *storage;
139       char *level;
140       char *type;
141       char *fileset;
142       char *catalog;
143       int   priority;
144    } defaults;
145
146    /* Information about the job */
147    struct {
148       uint64_t JobBytes;
149       uint32_t JobFiles;
150       int CorrJobBytes;
151       int CorrJobFiles;
152       int CorrNbJob;
153       char JobLevel;
154    } infos;
155 };
156
157 /*
158  *   Tray Monitor Resource
159  *
160  */
161 struct MONITOR {
162    RES   hdr;                         /* Keep first */
163    int32_t type;                      /* Keep second */
164
165    bool comm_compression;             /* Enable comm line compression */
166    bool require_ssl;                  /* Require SSL for all connections */
167    bool display_advanced_options;     /* Display advanced options (run options for example) */
168    MSGS *messages;                    /* Daemon message handler */
169    char *password;                    /* UA server password */
170    char *command_dir;                 /* Where to find Commands */
171    utime_t RefreshInterval;           /* Status refresh interval */
172 };
173
174
175 /* Define the Union of all the above
176  * resource structure definitions.
177  */
178 union URES {
179    MONITOR    res_monitor;
180    RESMON     res_main;
181    RES        hdr;
182 };
183
184 void error_handler(const char *file, int line, LEX *lc, const char *msg, ...);
185
186 #endif