2 Bacula® - The Network Backup Solution
4 Copyright (C) 2000-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 * Define Message Types for Bacula
52 * Most of these message levels are more or less obvious.
53 * They have evolved somewhat during the development of Bacula,
54 * and here are some of the details of where I am trying to
55 * head (in the process of changing the code) as of 15 June 2002.
57 * M_ABORT Bacula immediately aborts and tries to produce a traceback
58 * This is for really serious errors like segmentation fault.
59 * M_ERROR_TERM Bacula immediately terminates but no dump. This is for
60 * "obvious" serious errors like daemon already running or
61 * cannot open critical file, ... where a dump is not wanted.
62 * M_TERM Bacula daemon shutting down because of request (SIGTERM).
64 * The remaining apply to Jobs rather than the daemon.
66 * M_FATAL Bacula detected a fatal Job error. The Job will be killed,
67 * but Bacula continues running.
68 * M_ERROR Bacula detected a Job error. The Job will continue running
69 * but the termination status will be error.
70 * M_WARNING Job warning message.
71 * M_INFO Job information message.
73 * M_RESTORED An ls -l of each restored file.
75 * M_SECURITY For security viloations. This is equivalent to FATAL.
76 * (note, this is currently being implemented in 1.33).
78 * M_ALERT For Tape Alert messages.
80 * M_VOLMGMT Volume Management message
84 /* Keep M_ABORT=1 for dlist.h */
85 M_ABORT = 1, /* MUST abort immediately */
86 M_DEBUG, /* debug message */
87 M_FATAL, /* Fatal error, stopping job */
88 M_ERROR, /* Error, but recoverable */
89 M_WARNING, /* Warning message */
90 M_INFO, /* Informational message */
91 M_SAVED, /* Info on saved file */
92 M_NOTSAVED, /* Info on notsaved file */
93 M_SKIPPED, /* File skipped during backup by option setting */
94 M_MOUNT, /* Mount requests */
95 M_ERROR_TERM, /* Error termination request (no dump) */
96 M_TERM, /* Terminating daemon normally */
97 M_RESTORED, /* ls -l of restored files */
98 M_SECURITY, /* security violation */
99 M_ALERT, /* tape alert messages */
100 M_VOLMGMT /* Volume management messages */
103 #define M_MAX M_VOLMGMT /* keep this updated ! */
105 /* Define message destination structure */
106 /* *** FIXME **** where should be extended to handle multiple values */
107 typedef struct s_dest {
109 int dest_code; /* destination (one of the MD_ codes) */
110 int max_len; /* max mail line length */
111 FILE *fd; /* file descriptor */
112 char msg_types[nbytes_for_bits(M_MAX+1)]; /* message type mask */
113 char *where; /* filename/program name */
114 char *mail_cmd; /* mail command */
115 POOLMEM *mail_filename; /* unique mail filename */
118 /* Message Destination values for dest field of DEST */
120 MD_SYSLOG = 1, /* send msg to syslog */
121 MD_MAIL, /* email group of messages */
122 MD_FILE, /* write messages to a file */
123 MD_APPEND, /* append messages to a file */
124 MD_STDOUT, /* print messages */
125 MD_STDERR, /* print messages to stderr */
126 MD_DIRECTOR, /* send message to the Director */
127 MD_OPERATOR, /* email a single message to the operator */
128 MD_CONSOLE, /* send msg to UserAgent or console */
129 MD_MAIL_ON_ERROR, /* email messages if job errors */
130 MD_MAIL_ON_SUCCESS, /* email messages if job succeeds */
131 MD_CATALOG /* sent to catalog Log table */
134 /* Queued message item */
143 void d_msg(const char *file, int line, int level, const char *fmt,...);
144 void e_msg(const char *file, int line, int type, int level, const char *fmt,...);
145 void Jmsg(JCR *jcr, int type, utime_t mtime, const char *fmt,...);
146 void Qmsg(JCR *jcr, int type, utime_t mtime, const char *fmt,...);
147 bool get_trace(void);
148 const char *get_basename(const char *pathname);
151 typedef void (*sql_query_func)(JCR *jcr, const char *cmd);
152 typedef void (*sql_escape_func)(JCR *jcr, B_DB* db, char *snew, char *old, int len);
154 extern DLL_IMP_EXP sql_query_func p_sql_query;
155 extern DLL_IMP_EXP sql_escape_func p_sql_escape;
157 extern DLL_IMP_EXP int debug_level;
158 extern DLL_IMP_EXP bool dbg_timestamp; /* print timestamp in debug output */
159 extern DLL_IMP_EXP bool prt_kaboom; /* Print kaboom output */
160 extern DLL_IMP_EXP int verbose;
161 extern DLL_IMP_EXP char my_name[];
162 extern DLL_IMP_EXP const char * working_directory;
163 extern DLL_IMP_EXP utime_t daemon_start_time;
165 extern DLL_IMP_EXP int console_msg_pending;
166 extern DLL_IMP_EXP FILE * con_fd; /* Console file descriptor */
167 extern DLL_IMP_EXP brwlock_t con_lock; /* Console lock structure */