]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/bget_msg.c
kes Add dynamic dll entry point for SHGetFolderPath to Win32 code.
[bacula/bacula] / bacula / src / lib / bget_msg.c
index 18e8fc26df7cf1469b2a511a667554e651f345fe..b33808f9dd38fe7de4b8c458ea43cddcc738d5d9 100644 (file)
@@ -8,29 +8,37 @@
  *
  */
 /*
-   Copyright (C) 2001-2004 Kern Sibbald and John Walker
+   Bacula® - The Network Backup Solution
 
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of
-   the License, or (at your option) any later version.
+   Copyright (C) 2001-2006 Free Software Foundation Europe e.V.
 
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   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
+   License as published by the Free Software Foundation plus additions
+   that are listed in the file LICENSE.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
    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 along with this program; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-   MA 02111-1307, USA.
+   You should have received a copy of the GNU 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.
+   The licensor of Bacula is the Free Software Foundation Europe
+   (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+   Switzerland, email:ftf@fsfeurope.org.
+*/
 
 #include "bacula.h"                   /* pull in global headers */
 
-extern char OK_msg[];
-extern char TERM_msg[];
+static char OK_msg[]   = "2000 OK\n";
+static char TERM_msg[] = "2999 Terminate\n";
 
 #define msglvl 500
 
@@ -43,57 +51,57 @@ extern char TERM_msg[];
  * Returns number of bytes read (may return zero)
  * Returns -1 on signal (BNET_SIGNAL)
  * Returns -2 on hard end of file (BNET_HARDEOF)
- * Returns -3 on error (BNET_ERROR)
+ * Returns -3 on error  (BNET_ERROR)
  */
 int bget_msg(BSOCK *sock)
 {
    int n;
    for ( ;; ) {
       n = bnet_recv(sock);
-      if (n >= 0) {                 /* normal return */
-        return n;
+      if (n >= 0) {                  /* normal return */
+         return n;
       }
       if (is_bnet_stop(sock)) {      /* error return */
-        return n;
+         return n;
       }
 
       /* BNET_SIGNAL (-1) return from bnet_recv() => network signal */
       switch (sock->msglen) {
-      case BNET_EOD:              /* end of data */
-        Dmsg0(msglvl, "Got BNET_EOD\n");
-        return n;
+      case BNET_EOD:               /* end of data */
+         Dmsg0(msglvl, "Got BNET_EOD\n");
+         return n;
       case BNET_EOD_POLL:
-        Dmsg0(msglvl, "Got BNET_EOD_POLL\n");
-        if (sock->terminated) {
-           bnet_fsend(sock, TERM_msg);
-        } else {
-           bnet_fsend(sock, OK_msg); /* send response */
-        }
-        return n;                 /* end of data */
+         Dmsg0(msglvl, "Got BNET_EOD_POLL\n");
+         if (sock->terminated) {
+            bnet_fsend(sock, TERM_msg);
+         } else {
+            bnet_fsend(sock, OK_msg); /* send response */
+         }
+         return n;                 /* end of data */
       case BNET_TERMINATE:
-        Dmsg0(msglvl, "Got BNET_TERMINATE\n");
-        sock->terminated = 1;
-        return n;
+         Dmsg0(msglvl, "Got BNET_TERMINATE\n");
+         sock->terminated = 1;
+         return n;
       case BNET_POLL:
-        Dmsg0(msglvl, "Got BNET_POLL\n");
-        if (sock->terminated) {
-           bnet_fsend(sock, TERM_msg);
-        } else {
-           bnet_fsend(sock, OK_msg); /* send response */
-        }
-        break;
+         Dmsg0(msglvl, "Got BNET_POLL\n");
+         if (sock->terminated) {
+            bnet_fsend(sock, TERM_msg);
+         } else {
+            bnet_fsend(sock, OK_msg); /* send response */
+         }
+         break;
       case BNET_HEARTBEAT:
       case BNET_HB_RESPONSE:
-        break;
+         break;
       case BNET_STATUS:
-        /* *****FIXME***** Implement BNET_STATUS */
-        Dmsg0(msglvl, "Got BNET_STATUS\n");
-        bnet_fsend(sock, "Status OK\n");
-        bnet_sig(sock, BNET_EOD);
-        break;
+         /* *****FIXME***** Implement BNET_STATUS */
+         Dmsg0(msglvl, "Got BNET_STATUS\n");
+         bnet_fsend(sock, _("Status OK\n"));
+         bnet_sig(sock, BNET_EOD);
+         break;
       default:
-        Emsg1(M_ERROR, 0, "bget_msg: unknown signal %d\n", sock->msglen);
-        break;
+         Emsg1(M_ERROR, 0, _("bget_msg: unknown signal %d\n"), sock->msglen);
+         break;
       }
    }
 }