2 Bacula® - The Network Backup Solution
4 Copyright (C) 2004-2014 Free Software Foundation Europe e.V.
6 The main author of Bacula is Kern Sibbald, with contributions from many
7 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 Bacula® is a registered trademark of Kern Sibbald.
17 * Includes specific to the tray monitor
19 * Nicolas Boichat, August MMIV
23 #ifndef TRAY_MONITOR_H
24 #define TRAY_MONITOR_H
27 # ifndef _STAT_DEFINED
28 # define _STAT_DEFINED 1 /* don't pull in MinGW struct stat from wchar.h */
33 #include <QStringList>
36 #include "tray_conf.h"
43 QString messages_name;
56 QStringList pool_list;
57 QStringList client_list;
58 QStringList storage_list;
60 QStringList fileset_list;
61 QStringList messages_list;
72 int doconnect(monitoritem* item);
73 void get_list(monitoritem* item, const char *cmd, QStringList &lst);
77 rescode type; /* R_DIRECTOR, R_CLIENT or R_STORAGE */
78 void* resource; /* DIRRES*, CLIENT* or STORE* */
84 return ((URES*)resource)->hdr.name;
87 void writecmd(const char* command) {
89 this->D_sock->msglen = pm_strcpy(&this->D_sock->msg, command);
90 bnet_send(this->D_sock);
94 bool get_job_defaults(struct job_defaults &job_defs)
100 QString scmd = QString(".defaults job=\"%1\"").arg(job_defs.job_name);
102 if (job_defs.job_name == "") {
106 if (!doconnect(this)) {
109 dircomm = this->D_sock;
110 dircomm->fsend("%s", scmd.toUtf8().data());
112 while ((stat = dircomm->recv()) > 0) {
113 def = strchr(dircomm->msg, '=');
117 /* Pointer to default value */
119 strip_trailing_junk(def);
121 if (strcmp(dircomm->msg, "job") == 0) {
122 if (strcmp(def, job_defs.job_name.toUtf8().data()) != 0) {
127 if (strcmp(dircomm->msg, "pool") == 0) {
128 job_defs.pool_name = def;
131 if (strcmp(dircomm->msg, "messages") == 0) {
132 job_defs.messages_name = def;
135 if (strcmp(dircomm->msg, "client") == 0) {
136 job_defs.client_name = def;
139 if (strcmp(dircomm->msg, "storage") == 0) {
140 job_defs.store_name = def;
143 if (strcmp(dircomm->msg, "where") == 0) {
144 job_defs.where = def;
147 if (strcmp(dircomm->msg, "level") == 0) {
148 job_defs.level = def;
151 if (strcmp(dircomm->msg, "type") == 0) {
155 if (strcmp(dircomm->msg, "fileset") == 0) {
156 job_defs.fileset_name = def;
159 if (strcmp(dircomm->msg, "catalog") == 0) {
160 job_defs.catalog_name = def;
163 if (strcmp(dircomm->msg, "enabled") == 0) {
164 job_defs.enabled = *def == '1' ? true : false;
169 /* Fall through wanted */
175 #endif /* TRAY_MONITOR_H */