2 Bacula® - The Network Backup Solution
4 Copyright (C) 2004-2011 Free Software Foundation Europe e.V.
6 The main author of Bacula is Kern Sibbald, with contributions from
7 many others, a complete list can be found in the file AUTHORS.
8 This program is Free Software; you can redistribute it and/or
9 modify it under the terms of version three of the GNU Affero General Public
10 License as published by the Free Software Foundation and included
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU Affero General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 Bacula® is a registered trademark of Kern Sibbald.
24 The licensor of Bacula is the Free Software Foundation Europe
25 (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
26 Switzerland, email:ftf@fsfeurope.org.
29 * Includes specific to the tray monitor
31 * Nicolas Boichat, August MMIV
35 #ifndef TRAY_MONITOR_H
36 #define TRAY_MONITOR_H
39 #include <QStringList>
41 #include "tray_conf.h"
47 QString messages_name;
60 QStringList pool_list;
61 QStringList client_list;
62 QStringList storage_list;
64 QStringList fileset_list;
65 QStringList messages_list;
76 int doconnect(monitoritem* item);
77 void get_list(monitoritem* item, const char *cmd, QStringList &lst);
81 rescode type; /* R_DIRECTOR, R_CLIENT or R_STORAGE */
82 void* resource; /* DIRRES*, CLIENT* or STORE* */
88 return ((URES*)resource)->hdr.name;
91 void writecmd(const char* command) {
93 this->D_sock->msglen = pm_strcpy(&this->D_sock->msg, command);
94 bnet_send(this->D_sock);
98 bool get_job_defaults(struct job_defaults &job_defs)
104 QString scmd = QString(".defaults job=\"%1\"").arg(job_defs.job_name);
106 if (job_defs.job_name == "") {
110 if (!doconnect(this)) {
113 dircomm = this->D_sock;
114 dircomm->fsend("%s", scmd.toUtf8().data());
116 while ((stat = dircomm->recv()) > 0) {
117 def = strchr(dircomm->msg, '=');
121 /* Pointer to default value */
123 strip_trailing_junk(def);
125 if (strcmp(dircomm->msg, "job") == 0) {
126 if (strcmp(def, job_defs.job_name.toUtf8().data()) != 0) {
131 if (strcmp(dircomm->msg, "pool") == 0) {
132 job_defs.pool_name = def;
135 if (strcmp(dircomm->msg, "messages") == 0) {
136 job_defs.messages_name = def;
139 if (strcmp(dircomm->msg, "client") == 0) {
140 job_defs.client_name = def;
143 if (strcmp(dircomm->msg, "storage") == 0) {
144 job_defs.store_name = def;
147 if (strcmp(dircomm->msg, "where") == 0) {
148 job_defs.where = def;
151 if (strcmp(dircomm->msg, "level") == 0) {
152 job_defs.level = def;
155 if (strcmp(dircomm->msg, "type") == 0) {
159 if (strcmp(dircomm->msg, "fileset") == 0) {
160 job_defs.fileset_name = def;
163 if (strcmp(dircomm->msg, "catalog") == 0) {
164 job_defs.catalog_name = def;
167 if (strcmp(dircomm->msg, "enabled") == 0) {
168 job_defs.enabled = *def == '1' ? true : false;
173 /* Fall through wanted */
179 #endif /* TRAY_MONITOR_H */