/*
Bacula® - The Network Backup Solution
- Copyright (C) 2004-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2004-2009 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
This program is Free Software; you can redistribute it and/or
- modify it under the terms of version two of the GNU General Public
+ modify it under the terms of version three of the GNU Affero General Public
License as published by the Free Software Foundation and included
in the file LICENSE.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License
+ You should have received a copy of the GNU Affero General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- Bacula® is a registered trademark of John Walker.
+ Bacula® is a registered trademark of Kern Sibbald.
The licensor of Bacula is the Free Software Foundation Europe
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
int authenticate_director(JCR *jcr, MONITOR *monitor, DIRRES *director);
int authenticate_file_daemon(JCR *jcr, MONITOR *monitor, CLIENT* client);
int authenticate_storage_daemon(JCR *jcr, MONITOR *monitor, STORE* store);
+extern bool parse_tmon_config(CONFIG *config, const char *configfile, int exit_code);
/* Dummy functions */
int generate_daemon_event(JCR *jcr, const char *event) { return 1; }
static int fullitem = 0; //Item to be display in detailled status window
static int lastupdated = -1; //Last item updated
static monitoritem items[32];
+static CONFIG *config;
/* Data received from DIR/FD/SD */
static char OKqstatus[] = "%c000 OK .status\n";
static GtkWidget *textview;
static GtkTextBuffer *buffer;
static GtkWidget *timeoutspinner;
+static GtkWidget *scrolledWindow;
char** xpm_generic_var;
static gboolean blinkstate = TRUE;
"\nVersion: %s (%s) %s %s %s\n\n"
"Usage: tray-monitor [-c config_file] [-d debug_level]\n"
" -c <file> set configuration file to file\n"
-" -dnn set debug level to nn\n"
+" -d <nn> set debug level to <nn>\n"
+" -dt print timestamp in debug output\n"
" -t test - read configuration and exit\n"
" -? print this message.\n"
"\n"), 2004, VERSION, BDATE, HOST_OS, DISTNAME, DISTVER);
break;
case 'd':
- debug_level = atoi(optarg);
- if (debug_level <= 0) {
- debug_level = 1;
+ if (*optarg == 't') {
+ dbg_timestamp = true;
+ } else {
+ debug_level = atoi(optarg);
+ if (debug_level <= 0) {
+ debug_level = 1;
+ }
}
break;
configfile = bstrdup(CONFIG_FILE);
}
- parse_config(configfile);
+ config = new_config_parser();
+ parse_tmon_config(config, configfile, M_ERROR_TERM);
LockRes();
nitems = 0;
}
gtk_box_pack_start(GTK_BOX(vbox), daemon_table, FALSE, FALSE, 0);
-
+
textview = gtk_text_view_new();
+ scrolledWindow = gtk_scrolled_window_new(NULL, NULL);
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledWindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_container_add(GTK_CONTAINER (scrolledWindow), textview);
+
buffer = gtk_text_buffer_new(NULL);
gtk_text_buffer_set_text(buffer, "", -1);
gtk_text_view_set_buffer(GTK_TEXT_VIEW(textview), buffer);
- gtk_box_pack_start(GTK_BOX(vbox), textview, TRUE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), scrolledWindow, TRUE, TRUE, 0);
GtkWidget* hbox = gtk_hbox_new(FALSE, 10);
gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, FALSE, 0);
button = new_image_button("gtk-close", _("Close"));
-// g_signal_connect_swapped(G_OBJECT(button), "clicked", G_CALLBACK(gtk_widget_hide), G_OBJECT(window));
+ g_signal_connect_swapped(G_OBJECT(button), "clicked", G_CALLBACK(gtk_widget_hide), G_OBJECT(window));
gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
break;
}
//writecmd(&items[i], "quit");
- bnet_sig(items[i].D_sock, BNET_TERMINATE); /* send EOF */
- bnet_close(items[i].D_sock);
+ items[i].D_sock->signal(BNET_TERMINATE); /* send EOF */
+ items[i].D_sock->close();
}
}
gtk_object_destroy(GTK_OBJECT(window));
gtk_object_destroy(GTK_OBJECT(mTrayMenu));
+ config->free_resources();
+ free(config);
+ config = NULL;
term_msg();
#if TRAY_DEBUG_MEMORY
writecmd(item, command);
while(1) {
- if ((stat = bnet_recv(item->D_sock)) >= 0) {
+ if ((stat = item->D_sock->recv()) >= 0) {
*list = g_slist_append(*list, g_string_new(item->D_sock->msg));
}
else if (stat == BNET_SIGNAL) {
//fprintf(stderr, "<< EOD >>\n");
return 1;
}
- else if (item->D_sock->msglen == BNET_PROMPT) {
+ else if (item->D_sock->msglen == BNET_SUB_PROMPT) {
//fprintf(stderr, "<< PROMPT >>\n");
- *list = g_slist_append(*list, g_string_new(_("<< Error: BNET_PROMPT signal received. >>\n")));
+ *list = g_slist_append(*list, g_string_new(_("<< Error: BNET_SUB_PROMPT signal received. >>\n")));
return 0;
}
else if (item->D_sock->msglen == BNET_HEARTBEAT) {
- bnet_sig(item->D_sock, BNET_HB_RESPONSE);
+ item->D_sock->signal(BNET_HB_RESPONSE);
*list = g_slist_append(*list, g_string_new(_("<< Heartbeat signal received, answered. >>\n")));
}
else {
return 0;
}
- if (is_bnet_stop(item->D_sock)) {
+ if (item->D_sock->is_stop()) {
g_string_append_printf(str, _("<STOP>\n"));
item->D_sock = NULL;
item->state = error;
if (item->D_sock) {
item->D_sock->msglen = strlen(command);
pm_strcpy(&item->D_sock->msg, command);
- bnet_send(item->D_sock);
+ item->D_sock->send();
}
}
bvsnprintf(buf, sizeof(buf), (char *)fmt, arg_ptr);
va_end(arg_ptr);
- fprintf(stderr, buf);
+ fprintf(stderr, "%s", buf);
// gtk_tray_icon_send_message(gtk_status_icon_get_tray_icon(mTrayIcon), 5000, (const char*)&buf, -1);
}