2 Bacula(R) - The Network Backup Solution
4 Copyright (C) 2000-2016 Kern Sibbald
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.
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.
14 This notice must be preserved when any source code is
15 conveyed and/or propagated.
17 Bacula(R) is a registered trademark of Kern Sibbald.
20 * Includes specific to the tray monitor
22 * Nicolas Boichat, August MMIV
26 #ifndef TRAY_MONITOR_H
27 #define TRAY_MONITOR_H
30 # ifndef _STAT_DEFINED
31 # define _STAT_DEFINED 1 /* don't pull in MinGW struct stat from wchar.h */
36 #include <QStringList>
39 #include "tray_conf.h"
46 QString messages_name;
59 QStringList pool_list;
60 QStringList client_list;
61 QStringList storage_list;
63 QStringList fileset_list;
64 QStringList messages_list;
75 int doconnect(monitoritem* item);
76 void get_list(monitoritem* item, const char *cmd, QStringList &lst);
80 rescode type; /* R_DIRECTOR, R_CLIENT or R_STORAGE */
81 void* resource; /* DIRRES*, CLIENT* or STORE* */
87 return ((URES*)resource)->hdr.name;
90 void writecmd(const char* command) {
92 this->D_sock->msglen = pm_strcpy(&this->D_sock->msg, command);
97 bool get_job_defaults(struct job_defaults &job_defs)
103 QString scmd = QString(".defaults job=\"%1\"").arg(job_defs.job_name);
105 if (job_defs.job_name == "") {
109 if (!doconnect(this)) {
112 dircomm = this->D_sock;
113 dircomm->fsend("%s", scmd.toUtf8().data());
115 while ((stat = dircomm->recv()) > 0) {
116 def = strchr(dircomm->msg, '=');
120 /* Pointer to default value */
122 strip_trailing_junk(def);
124 if (strcmp(dircomm->msg, "job") == 0) {
125 if (strcmp(def, job_defs.job_name.toUtf8().data()) != 0) {
130 if (strcmp(dircomm->msg, "pool") == 0) {
131 job_defs.pool_name = def;
134 if (strcmp(dircomm->msg, "messages") == 0) {
135 job_defs.messages_name = def;
138 if (strcmp(dircomm->msg, "client") == 0) {
139 job_defs.client_name = def;
142 if (strcmp(dircomm->msg, "storage") == 0) {
143 job_defs.store_name = def;
146 if (strcmp(dircomm->msg, "where") == 0) {
147 job_defs.where = def;
150 if (strcmp(dircomm->msg, "level") == 0) {
151 job_defs.level = def;
154 if (strcmp(dircomm->msg, "type") == 0) {
158 if (strcmp(dircomm->msg, "fileset") == 0) {
159 job_defs.fileset_name = def;
162 if (strcmp(dircomm->msg, "catalog") == 0) {
163 job_defs.catalog_name = def;
166 if (strcmp(dircomm->msg, "enabled") == 0) {
167 job_defs.enabled = *def == '1' ? true : false;
172 /* Fall through wanted */
178 #endif /* TRAY_MONITOR_H */