/*
Bacula(R) - The Network Backup Solution
- Copyright © 2000-2020 Bacula Systems SA
- All rights reserved.
+ Copyright (C) 2000-2020 Kern Sibbald
The original author of Bacula is Kern Sibbald, with contributions
from many others, a complete list can be found in the file AUTHORS.
conveyed and/or propagated.
Bacula(R) is a registered trademark of Kern Sibbald.
-*/
-/*
- * This is a Bacula plugin for backup/restore Docker using native tools.
+ */
+/**
+ * @file dkcommctx.c
+ * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
+ * @brief This is a Bacula plugin for backup/restore Docker using native tools.
+ * @version 1.2.1
+ * @date 2020-01-05
*
- * Author: Radosław Korzeniewski, MMXIX
- * radoslaw@korzeniewski.net, radekk@inteos.pl
- * Inteos Sp. z o.o. http://www.inteos.pl/
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
*/
#include "dkcommctx.h"
/*
Bacula(R) - The Network Backup Solution
- Copyright © 2000-2020 Bacula Systems SA
- All rights reserved.
+ Copyright (C) 2000-2020 Kern Sibbald
The original author of Bacula is Kern Sibbald, with contributions
from many others, a complete list can be found in the file AUTHORS.
conveyed and/or propagated.
Bacula(R) is a registered trademark of Kern Sibbald.
-*/
-/*
- * This is a Bacula plugin for backup/restore Docker using native tools.
+ */
+/**
+ * @file dkcommctx.h
+ * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
+ * @brief This is a Bacula plugin for backup/restore Docker using native tools.
+ * @version 1.2.1
+ * @date 2020-01-05
*
- * Author: Radosław Korzeniewski, MMXIX
- * radoslaw@korzeniewski.net, radekk@inteos.pl
- * Inteos Sp. z o.o. http://www.inteos.pl/
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
*/
#ifndef _DKCOMMCTX_H_
/*
Bacula(R) - The Network Backup Solution
- Copyright (C) 2000-2019 Kern Sibbald
+ Copyright (C) 2000-2020 Kern Sibbald
The original author of Bacula is Kern Sibbald, with contributions
from many others, a complete list can be found in the file AUTHORS.
conveyed and/or propagated.
Bacula(R) is a registered trademark of Kern Sibbald.
-*/
-/*
- * This is a Bacula plugin for backup/restore Docker using native tools.
+ */
+/**
+ * @file dkid.c
+ * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
+ * @brief This is a Bacula plugin for backup/restore Docker using native tools.
+ * @version 1.2.1
+ * @date 2020-01-05
*
- * Author: Radosław Korzeniewski, MMXIX
- * radoslaw@korzeniewski.net, radekk@inteos.pl
- * Inteos Sp. z o.o. http://www.inteos.pl/
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
*/
#include "dkid.h"
/*
Bacula(R) - The Network Backup Solution
- Copyright (C) 2000-2019 Kern Sibbald
+ Copyright (C) 2000-2020 Kern Sibbald
The original author of Bacula is Kern Sibbald, with contributions
from many others, a complete list can be found in the file AUTHORS.
conveyed and/or propagated.
Bacula(R) is a registered trademark of Kern Sibbald.
-*/
-/*
- * This is a Bacula plugin for backup/restore Docker using native tools.
+ */
+/**
+ * @file dkid.h
+ * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
+ * @brief This is a Bacula plugin for backup/restore Docker using native tools.
+ * @version 1.2.1
+ * @date 2020-01-05
*
- * Author: Radosław Korzeniewski, MMXIX
- * radoslaw@korzeniewski.net, radekk@inteos.pl
- * Inteos Sp. z o.o. http://www.inteos.pl/
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
*/
#ifndef _DKID_H_
*/
/*
* This is a Bacula plugin for backup/restore Docker using native tools.
+ */
+/**
+ * @file dkid_test.c
+ * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
+ * @brief This is a Bacula plugin for backup/restore Docker using native tools - unittest.
+ * @version 1.2.1
+ * @date 2020-01-05
*
- * Author: Radosław Korzeniewski, MMXIX
- * radoslaw@korzeniewski.net, radekk@inteos.pl
- * Inteos Sp. z o.o. http://www.inteos.pl/
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
*/
#include "bacula.h"
/*
Bacula(R) - The Network Backup Solution
- Copyright (C) 2000-2019 Kern Sibbald
+ Copyright (C) 2000-2020 Kern Sibbald
The original author of Bacula is Kern Sibbald, with contributions
from many others, a complete list can be found in the file AUTHORS.
conveyed and/or propagated.
Bacula(R) is a registered trademark of Kern Sibbald.
-*/
-/*
- * This is a Bacula plugin for backup/restore Docker using native tools.
- *
- * Author: Radosław Korzeniewski, MMXIX
- * radoslaw@korzeniewski.net, radekk@inteos.pl
- * Inteos Sp. z o.o. http://www.inteos.pl/
+ */
+/**
+ * @file dkinfo.c
+ * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
+ * @brief This is a Bacula plugin for backup/restore Docker using native tools.
+ * @version 1.2.1
+ * @date 2020-01-05
*
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
* TODO: add unittests
*/
/*
Bacula(R) - The Network Backup Solution
- Copyright (C) 2000-2019 Kern Sibbald
+ Copyright (C) 2000-2020 Kern Sibbald
The original author of Bacula is Kern Sibbald, with contributions
from many others, a complete list can be found in the file AUTHORS.
conveyed and/or propagated.
Bacula(R) is a registered trademark of Kern Sibbald.
-*/
-/*
- * This is a Bacula plugin for backup/restore Docker using native tools.
+ */
+/**
+ * @file dkinfo.h
+ * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
+ * @brief This is a Bacula plugin for backup/restore Docker using native tools.
+ * @version 1.2.1
+ * @date 2020-01-05
*
- * Author: Radosław Korzeniewski, MMXIX
- * radoslaw@korzeniewski.net, radekk@inteos.pl
- * Inteos Sp. z o.o. http://www.inteos.pl/
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
*/
#ifndef _DKINFO_H_
/*
Bacula(R) - The Network Backup Solution
- Copyright (C) 2000-2019 Kern Sibbald
+ Copyright (C) 2000-2020 Kern Sibbald
The original author of Bacula is Kern Sibbald, with contributions
from many others, a complete list can be found in the file AUTHORS.
conveyed and/or propagated.
Bacula(R) is a registered trademark of Kern Sibbald.
-*/
-/*
- * This is a Bacula plugin for backup/restore Docker using native tools.
+ */
+/**
+ * @file docker-fd.c
+ * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
+ * @brief This is a Bacula plugin for backup/restore Docker using native tools.
+ * @version 1.2.1
+ * @date 2020-01-05
*
- * Author: Radosław Korzeniewski, MMXIX
- * radoslaw@korzeniewski.net, radekk@inteos.pl
- * Inteos Sp. z o.o. http://www.inteos.pl/
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
*/
#include "docker-fd.h"
/*
Bacula(R) - The Network Backup Solution
- Copyright (C) 2000-2019 Kern Sibbald
+ Copyright (C) 2000-2020 Kern Sibbald
The original author of Bacula is Kern Sibbald, with contributions
from many others, a complete list can be found in the file AUTHORS.
conveyed and/or propagated.
Bacula(R) is a registered trademark of Kern Sibbald.
-*/
-/*
- * This is a Bacula plugin for backup/restore Docker using native tools.
+ */
+/**
+ * @file docker-fd.h
+ * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
+ * @brief This is a Bacula plugin for backup/restore Docker using native tools.
+ * @version 1.2.1
+ * @date 2020-01-05
*
- * Author: Radosław Korzeniewski, MMXIX
- * radoslaw@korzeniewski.net, radekk@inteos.pl
- * Inteos Sp. z o.o. http://www.inteos.pl/
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
*/
#ifndef _DOCKER_FD_H_
* @version 1.2.0
* @date 2020-01-05
*
- * @copyright Copyright (c) 2021 All rights reserved.
- * IP transferred to Bacula Systems according to agreement.
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
*/
#ifndef PLUGINLIB_COMMCTX_H
/*
- Bacula® - The Network Backup Solution
+ Bacula(R) - The Network Backup Solution
- Copyright (C) 2007-2017 Bacula Systems SA
- All rights reserved.
+ Copyright (C) 2000-2020 Kern Sibbald
- The main author of Bacula is Kern Sibbald, with contributions from many
- others, a complete list can be found in the file AUTHORS.
+ The original author of Bacula is Kern Sibbald, with contributions
+ from many others, a complete list can be found in the file AUTHORS.
- Licensees holding a valid Bacula Systems SA license may use this file
- and others of this release in accordance with the proprietary license
- agreement provided in the LICENSE file. Redistribution of any part of
- this release is not permitted.
+ You may use this file and others of this release according to the
+ license defined in the LICENSE file, which includes the Affero General
+ Public License, v3.0 ("AGPLv3") and some additional permissions and
+ terms pursuant to its AGPLv3 Section 7.
- Bacula® is a registered trademark of Kern Sibbald.
-*/
+ This notice must be preserved when any source code is
+ conveyed and/or propagated.
+
+ Bacula(R) is a registered trademark of Kern Sibbald.
+ */
/**
* @file metaplugin.h
* @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
* @version 2.1.0
* @date 2020-12-23
*
- * @copyright Copyright (c) 2021 All rights reserved.
- * IP transferred to Bacula Systems according to agreement.
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
*/
#include "metaplugin.h"
ctx(NULL),
backend_available(false),
backend_error(PM_MESSAGE),
- mode(MODE::NONE),
+ mode(NONE),
JobId(0),
JobName(NULL),
since(0),
if (strcasecmp(parser.argk[i], "listing") == 0){
/* found, so check the value if provided */
if (parser.argv[i]){
- listing = Listing;
+ listing = ListingMode;
DMSG0(ctx, DINFO, "listing procedure param found\n");
}
}
if (strcasecmp(parser.argk[i], "query") == 0){
/* found, so check the value if provided */
if (parser.argv[i]){
- listing = QueryParams;
+ listing = ListingQueryParams;
DMSG0(ctx, DINFO, "query procedure param found\n");
}
}
bRC METAPLUGIN::send_jobinfo(bpContext *ctx, char type)
{
int32_t rc;
- int len;
- bRC status = bRC_OK;
- POOLMEM *cmd;
+ POOL_MEM cmd;
char lvl;
- cmd = get_pool_memory(PM_FNAME);
- len = sizeof_pool_memory(cmd);
/* we will be sending Job Info data */
- bsnprintf(cmd, len, "Job\n");
+ pm_strcpy(cmd, "Job\n");
rc = backend.ctx->write_command(ctx, cmd);
if (rc < 0){
/* error */
- status = bRC_Error;
- goto bailout;
+ return bRC_Error;
}
/* required parameters */
- bsnprintf(cmd, len, "Name=%s\n", JobName);
+ Mmsg(cmd, "Name=%s\n", JobName);
rc = backend.ctx->write_command(ctx, cmd);
if (rc < 0){
/* error */
- status = bRC_Error;
- goto bailout;
+ return bRC_Error;
}
- bsnprintf(cmd, len, "JobID=%i\n", JobId);
+ Mmsg(cmd, "JobID=%i\n", JobId);
rc = backend.ctx->write_command(ctx, cmd);
if (rc < 0){
/* error */
- status = bRC_Error;
- goto bailout;
+ return bRC_Error;
}
- bsnprintf(cmd, len, "Type=%c\n", type);
+ Mmsg(cmd, "Type=%c\n", type);
rc = backend.ctx->write_command(ctx, cmd);
if (rc < 0){
/* error */
- status = bRC_Error;
- goto bailout;
+ return bRC_Error;
}
/* optional parameters */
- if (mode != MODE::RESTORE){
+ if (mode != RESTORE){
switch (mode){
- case MODE::BACKUP_FULL:
+ case BACKUP_FULL:
lvl = 'F';
break;
- case MODE::BACKUP_DIFF:
+ case BACKUP_DIFF:
lvl = 'D';
break;
- case MODE::BACKUP_INCR:
+ case BACKUP_INCR:
lvl = 'I';
break;
default:
lvl = 0;
}
if (lvl){
- bsnprintf(cmd, len, "Level=%c\n", lvl);
+ Mmsg(cmd, "Level=%c\n", lvl);
rc = backend.ctx->write_command(ctx, cmd);
if (rc < 0){
/* error */
- status = bRC_Error;
- goto bailout;
+ return bRC_Error;
}
}
}
if (since){
- bsnprintf(cmd, len, "Since=%ld\n", since);
+ Mmsg(cmd, "Since=%ld\n", since);
rc = backend.ctx->write_command(ctx, cmd);
if (rc < 0){
/* error */
- status = bRC_Error;
- goto bailout;
+ return bRC_Error;
}
}
if (where){
- bsnprintf(cmd, len, "Where=%s\n", where);
+ Mmsg(cmd, "Where=%s\n", where);
rc = backend.ctx->write_command(ctx, cmd);
if (rc < 0){
/* error */
- status = bRC_Error;
- goto bailout;
+ return bRC_Error;
}
}
if (regexwhere){
- bsnprintf(cmd, len, "RegexWhere=%s\n", regexwhere);
+ Mmsg(cmd, "RegexWhere=%s\n", regexwhere);
rc = backend.ctx->write_command(ctx, cmd);
if (rc < 0){
/* error */
- status = bRC_Error;
- goto bailout;
+ return bRC_Error;
}
}
if (replace){
- bsnprintf(cmd, len, "Replace=%c\n", replace);
+ Mmsg(cmd, "Replace=%c\n", replace);
rc = backend.ctx->write_command(ctx, cmd);
if (rc < 0){
/* error */
- status = bRC_Error;
- goto bailout;
+ return bRC_Error;
+ }
+ }
+
+ if (CUSTOMNAMESPACE){
+ Mmsg(cmd, "Namespace=%s\n", PLUGINNAMESPACE);
+ rc = backend.ctx->write_command(ctx, cmd);
+ if (rc < 0){
+ /* error */
+ return bRC_Error;
}
}
backend.ctx->signal_eod(ctx);
if (!backend.ctx->read_ack(ctx)){
DMSG0(ctx, DERROR, "Wrong backend response to Job command.\n");
JMSG0(ctx, backend.ctx->jmsg_err_level(), "Wrong backend response to Job command.\n");
- status = bRC_Error;
+ return bRC_Error;
}
-bailout:
- free_pool_memory(cmd);
- return status;
+ return bRC_OK;
}
/*
/* here we expect a PIPE: command only */
if (scan_parameter_str(cmd, "PIPE:", extpipename)){
/* got PIPE: */
- DMSG(ctx, DINFO, "PIPE:%s\n", extpipename);
+ DMSG(ctx, DINFO, "PIPE:%s\n", extpipename.c_str());
backend.ctx->set_extpipename(extpipename.c_str());
/* TODO: decide if plugin should verify if extpipe is available */
pm_strcpy(cmd, "OK\n");
break;
case BACKEND_JOB_INFO_ESTIMATE:
/* Start Estimate or Listing (4) */
- if (listing){
+ if (listing != ListingNone){
DMSG0(ctx, DINFO, "Start Listing (4) ...\n");
if (send_startlisting(ctx) != bRC_OK){
backend.ctx->terminate(ctx);
switch (lvl) {
case 'F':
DMSG0(ctx, D2, "backup level = Full\n");
- mode = MODE::BACKUP_FULL;
+ mode = BACKUP_FULL;
break;
case 'I':
DMSG0(ctx, D2, "backup level = Incr\n");
- mode = MODE::BACKUP_INCR;
+ mode = BACKUP_INCR;
break;
case 'D':
DMSG0(ctx, D2, "backup level = Diff\n");
- mode = MODE::BACKUP_DIFF;
+ mode = BACKUP_DIFF;
break;
default:
DMSG0(ctx, D2, "unsupported backup level!\n");
DMSG(ctx, DINFO, "RegexWhere=%s\n", NPRT(regexwhere));
getBaculaVar(bVarReplace, &replace);
DMSG(ctx, DINFO, "Replace=%c\n", replace);
- mode = MODE::RESTORE;
+ mode = RESTORE;
break;
case bEventEndRestoreJob:
case IO_OPEN:
DMSG(ctx, D2, "IO_OPEN: (%s)\n", io->fname);
switch (mode){
- case MODE::BACKUP_FULL:
- case MODE::BACKUP_INCR:
- case MODE::BACKUP_DIFF:
+ case BACKUP_FULL:
+ case BACKUP_INCR:
+ case BACKUP_DIFF:
return perform_backup_open(ctx, io);
- case MODE::RESTORE:
+ case RESTORE:
nodata = true;
break;
default:
DMSG2(ctx, D2, "IO_READ buf=%p len=%d\n", io->buf, io->count);
}
switch (mode){
- case MODE::BACKUP_FULL:
- case MODE::BACKUP_INCR:
- case MODE::BACKUP_DIFF:
+ case BACKUP_FULL:
+ case BACKUP_INCR:
+ case BACKUP_DIFF:
return perform_read_data(ctx, io);
default:
return bRC_Error;
DMSG2(ctx, D2, "IO_WRITE buf=%p len=%d\n", io->buf, io->count);
}
switch (mode){
- case MODE::RESTORE:
+ case RESTORE:
return perform_write_data(ctx, io);
default:
return bRC_Error;
return bRC_Error;
}
switch (mode){
- case MODE::RESTORE:
+ case RESTORE:
return perform_write_end(ctx, io);
- case MODE::BACKUP_FULL:
- case MODE::BACKUP_INCR:
- case MODE::BACKUP_DIFF:
+ case BACKUP_FULL:
+ case BACKUP_INCR:
+ case BACKUP_DIFF:
return perform_read_metadata(ctx);
default:
return bRC_Error;
int reqparams = 2;
/* The first file in Full backup, is the RestoreObject */
- if (!estimate && mode == MODE::BACKUP_FULL && robjsent == false) {
+ if (!estimate && mode == BACKUP_FULL && robjsent == false) {
ConfigFile ini;
/* robj for the first time, allocate the buffer */
default:
/* we need to signal error */
sp->type = FT_REG;
- DMSG2(ctx, DERROR, "Invalid file type: %c for %s\n", type, fname);
- JMSG2(ctx, M_ERROR, "Invalid file type: %c for %s\n", type, fname);
+ DMSG2(ctx, DERROR, "Invalid file type: %c for %s\n", type, fname.c_str());
+ JMSG2(ctx, M_ERROR, "Invalid file type: %c for %s\n", type, fname.c_str());
}
DMSG6(ctx, DINFO, "STAT:%c size:%lld uid:%d gid:%d mode:%06o nl:%d\n", type, size, uid, gid, perms, nlinks);
reqparams--;
if (!estimate){
/* The current file was the restore object, so just ask for the next file */
- if (mode == MODE::BACKUP_FULL && robjsent == false) {
+ if (mode == BACKUP_FULL && robjsent == false) {
robjsent = true;
return bRC_More;
}
DMSG0(ctx, D1, "METAPLUGIN::queryParameter\n");
if (listing == ListingNone){
- listing = QueryParams;
+ listing = ListingQueryParams;
Mmsg(cmd, "%s query=%s", qp->command, qp->parameter);
if (prepare_backend(ctx, BACKEND_JOB_INFO_ESTIMATE, cmd.c_str()) == bRC_Error){
return bRC_Error;
/*
- Bacula® - The Network Backup Solution
+ Bacula(R) - The Network Backup Solution
- Copyright (C) 2007-2017 Bacula Systems SA
- All rights reserved.
+ Copyright (C) 2000-2020 Kern Sibbald
- The main author of Bacula is Kern Sibbald, with contributions from many
- others, a complete list can be found in the file AUTHORS.
+ The original author of Bacula is Kern Sibbald, with contributions
+ from many others, a complete list can be found in the file AUTHORS.
- Licensees holding a valid Bacula Systems SA license may use this file
- and others of this release in accordance with the proprietary license
- agreement provided in the LICENSE file. Redistribution of any part of
- this release is not permitted.
+ You may use this file and others of this release according to the
+ license defined in the LICENSE file, which includes the Affero General
+ Public License, v3.0 ("AGPLv3") and some additional permissions and
+ terms pursuant to its AGPLv3 Section 7.
- Bacula® is a registered trademark of Kern Sibbald.
-*/
+ This notice must be preserved when any source code is
+ conveyed and/or propagated.
+
+ Bacula(R) is a registered trademark of Kern Sibbald.
+ */
/**
* @file metaplugin.h
* @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
* @version 2.1.0
* @date 2020-12-23
*
- * @copyright Copyright (c) 2021 All rights reserved.
- * IP transferred to Bacula Systems according to agreement.
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
*/
#include "pluginlib.h"
// Plugin linking time variables
extern const char *PLUGINPREFIX;
extern const char *PLUGINNAME;
+extern const char *PLUGINNAMESPACE;
+extern const bool CUSTOMNAMESPACE;
extern const char *PLUGINAPI;
extern const char *BACKEND_CMD;
class METAPLUGIN: public SMARTALLOC
{
public:
- enum class MODE
+ enum MODE
{
NONE = 0,
BACKUP_FULL,
~METAPLUGIN();
private:
- enum ListingMode
+ enum LISTING
{
ListingNone,
- Listing,
- QueryParams,
+ ListingMode,
+ ListingQueryParams,
};
// TODO: define a variable which will signal job cancel
char replace; // the replace variable for restore job
bool robjsent; // set when RestoreObject was sent during Full backup
bool estimate; // used when mode is METAPLUGIN_BACKUP_* but we are doing estimate only
- ListingMode listing; // used for a Listing procedure for estimate
+ LISTING listing; // used for a Listing procedure for estimate
bool nodata; // set when backend signaled no data for backup or no data for restore
bool nextfile; // set when IO_CLOSE got FNAME: command
bool openerror; // show if "openfile" was unsuccessful
/*
- Bacula® - The Network Backup Solution
+ Bacula(R) - The Network Backup Solution
- Copyright (C) 2007-2017 Bacula Systems SA
- All rights reserved.
+ Copyright (C) 2000-2020 Kern Sibbald
- The main author of Bacula is Kern Sibbald, with contributions from many
- others, a complete list can be found in the file AUTHORS.
+ The original author of Bacula is Kern Sibbald, with contributions
+ from many others, a complete list can be found in the file AUTHORS.
- Licensees holding a valid Bacula Systems SA license may use this file
- and others of this release in accordance with the proprietary license
- agreement provided in the LICENSE file. Redistribution of any part of
- this release is not permitted.
+ You may use this file and others of this release according to the
+ license defined in the LICENSE file, which includes the Affero General
+ Public License, v3.0 ("AGPLv3") and some additional permissions and
+ terms pursuant to its AGPLv3 Section 7.
- Bacula® is a registered trademark of Kern Sibbald.
-*/
-/*
- *
- * All rights reserved. IP transferred to Bacula Systems according to agreement.
+ This notice must be preserved when any source code is
+ conveyed and/or propagated.
+
+ Bacula(R) is a registered trademark of Kern Sibbald.
+ */
+/**
+ * @file commctx.h
+ * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
+ * @brief Common definitions and utility functions for Inteos plugins.
+ * @version 2.1.0
+ * @date 2021-02-10
*
- * Common definitions and utility functions for Inteos plugins.
- * Functions defines a common framework used in our utilities and plugins.
- * Author: Radosław Korzeniewski, radekk@inteos.pl, Inteos Sp. z o.o.
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
*/
#include "pluginlib.h"
/*
- Bacula® - The Network Backup Solution
+ Bacula(R) - The Network Backup Solution
- Copyright (C) 2007-2017 Bacula Systems SA
- All rights reserved.
+ Copyright (C) 2000-2020 Kern Sibbald
- The main author of Bacula is Kern Sibbald, with contributions from many
- others, a complete list can be found in the file AUTHORS.
+ The original author of Bacula is Kern Sibbald, with contributions
+ from many others, a complete list can be found in the file AUTHORS.
- Licensees holding a valid Bacula Systems SA license may use this file
- and others of this release in accordance with the proprietary license
- agreement provided in the LICENSE file. Redistribution of any part of
- this release is not permitted.
+ You may use this file and others of this release according to the
+ license defined in the LICENSE file, which includes the Affero General
+ Public License, v3.0 ("AGPLv3") and some additional permissions and
+ terms pursuant to its AGPLv3 Section 7.
- Bacula® is a registered trademark of Kern Sibbald.
-*/
-/*
- *
- * All rights reserved. IP transferred to Bacula Systems according to agreement.
+ This notice must be preserved when any source code is
+ conveyed and/or propagated.
+
+ Bacula(R) is a registered trademark of Kern Sibbald.
+ */
+/**
+ * @file commctx.h
+ * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
+ * @brief Common definitions and utility functions for Inteos plugins.
+ * @version 2.1.0
+ * @date 2021-02-10
*
- * Common definitions and utility functions for Inteos plugins.
- * Functions defines a common framework used in our utilities and plugins.
- * Author: Radosław Korzeniewski, radekk@inteos.pl, Inteos Sp. z o.o.
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
*/
#ifndef _PLUGINLIB_H_
/*
- Bacula® - The Network Backup Solution
+ Bacula(R) - The Network Backup Solution
- Copyright (C) 2007-2017 Bacula Systems SA
- All rights reserved.
+ Copyright (C) 2000-2020 Kern Sibbald
- The main author of Bacula is Kern Sibbald, with contributions from many
- others, a complete list can be found in the file AUTHORS.
+ The original author of Bacula is Kern Sibbald, with contributions
+ from many others, a complete list can be found in the file AUTHORS.
- Licensees holding a valid Bacula Systems SA license may use this file
- and others of this release in accordance with the proprietary license
- agreement provided in the LICENSE file. Redistribution of any part of
- this release is not permitted.
+ You may use this file and others of this release according to the
+ license defined in the LICENSE file, which includes the Affero General
+ Public License, v3.0 ("AGPLv3") and some additional permissions and
+ terms pursuant to its AGPLv3 Section 7.
- Bacula® is a registered trademark of Kern Sibbald.
-*/
+ This notice must be preserved when any source code is
+ conveyed and/or propagated.
+
+ Bacula(R) is a registered trademark of Kern Sibbald.
+ */
/**
* @file commctx.h
* @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
* @version 1.1.0
* @date 2020-12-23
*
+ * @copyright Copyright (c) 2020 All rights reserved. IP transferred to Bacula Systems according to agreement.
*/
#include "pluginlib.h"
/*
- Bacula® - The Network Backup Solution
+ Bacula(R) - The Network Backup Solution
- Copyright (C) 2007-2017 Bacula Systems SA
- All rights reserved.
+ Copyright (C) 2000-2020 Kern Sibbald
- The main author of Bacula is Kern Sibbald, with contributions from many
- others, a complete list can be found in the file AUTHORS.
+ The original author of Bacula is Kern Sibbald, with contributions
+ from many others, a complete list can be found in the file AUTHORS.
- Licensees holding a valid Bacula Systems SA license may use this file
- and others of this release in accordance with the proprietary license
- agreement provided in the LICENSE file. Redistribution of any part of
- this release is not permitted.
+ You may use this file and others of this release according to the
+ license defined in the LICENSE file, which includes the Affero General
+ Public License, v3.0 ("AGPLv3") and some additional permissions and
+ terms pursuant to its AGPLv3 Section 7.
- Bacula® is a registered trademark of Kern Sibbald.
-*/
+ This notice must be preserved when any source code is
+ conveyed and/or propagated.
+
+ Bacula(R) is a registered trademark of Kern Sibbald.
+ */
/**
* @file ptcomm.cpp
* @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
- * @brief This is a Bacula plugin library for interfacing with Metaplugin backend.
+ * @brief This is a process communication lowlevel library for Bacula plugin.
* @version 2.0.0
* @date 2020-11-20
*
/*
- Bacula® - The Network Backup Solution
+ Bacula(R) - The Network Backup Solution
- Copyright (C) 2007-2017 Bacula Systems SA
- All rights reserved.
+ Copyright (C) 2000-2020 Kern Sibbald
- The main author of Bacula is Kern Sibbald, with contributions from many
- others, a complete list can be found in the file AUTHORS.
+ The original author of Bacula is Kern Sibbald, with contributions
+ from many others, a complete list can be found in the file AUTHORS.
- Licensees holding a valid Bacula Systems SA license may use this file
- and others of this release in accordance with the proprietary license
- agreement provided in the LICENSE file. Redistribution of any part of
- this release is not permitted.
+ You may use this file and others of this release according to the
+ license defined in the LICENSE file, which includes the Affero General
+ Public License, v3.0 ("AGPLv3") and some additional permissions and
+ terms pursuant to its AGPLv3 Section 7.
- Bacula® is a registered trademark of Kern Sibbald.
-*/
+ This notice must be preserved when any source code is
+ conveyed and/or propagated.
+
+ Bacula(R) is a registered trademark of Kern Sibbald.
+ */
/**
- * This is a process communication lowlevel library for Bacula plugin.
- * Author: Radoslaw Korzeniewski, radekk@inteos.pl, Inteos Sp. z o.o.
+ * @file ptcomm.h
+ * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
+ * @brief This is a process communication lowlevel library for Bacula plugin.
+ * @version 2.0.0
+ * @date 2021-02-10
+ *
+ * @copyright Copyright (c) 2021 All rights reserved. IP transferred to Bacula Systems according to agreement.
*/
#ifndef _PTCOMM_H_
Bacula(R) is a registered trademark of Kern Sibbald.
*/
/**
- * @file commctx.h
+ * @file smartalist.h
* @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
* @brief This is a simple smart array list (alist) resource guard conceptually based on C++11 - RAII.
* @version 1.1.0
/*
- Bacula® - The Network Backup Solution
+ Bacula(R) - The Network Backup Solution
- Copyright (C) 2007-2017 Bacula Systems SA
- All rights reserved.
+ Copyright (C) 2000-2020 Kern Sibbald
- The main author of Bacula is Kern Sibbald, with contributions from many
- others, a complete list can be found in the file AUTHORS.
+ The original author of Bacula is Kern Sibbald, with contributions
+ from many others, a complete list can be found in the file AUTHORS.
- Licensees holding a valid Bacula Systems SA license may use this file
- and others of this release in accordance with the proprietary license
- agreement provided in the LICENSE file. Redistribution of any part of
- this release is not permitted.
+ You may use this file and others of this release according to the
+ license defined in the LICENSE file, which includes the Affero General
+ Public License, v3.0 ("AGPLv3") and some additional permissions and
+ terms pursuant to its AGPLv3 Section 7.
- Bacula® is a registered trademark of Kern Sibbald.
-*/
+ This notice must be preserved when any source code is
+ conveyed and/or propagated.
+
+ Bacula(R) is a registered trademark of Kern Sibbald.
+ */
/**
* @file smartalist_test.cpp
* @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
Bacula(R) is a registered trademark of Kern Sibbald.
*/
/**
- * @file commctx.h
+ * @file smartptr.h
* @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
* @brief This is a simple smart pointer guard conceptually based on C++11 smart pointers - unique_ptr.
* @version 1.1.0
/*
- Bacula® - The Network Backup Solution
+ Bacula(R) - The Network Backup Solution
- Copyright (C) 2007-2017 Bacula Systems SA
- All rights reserved.
+ Copyright (C) 2000-2020 Kern Sibbald
- The main author of Bacula is Kern Sibbald, with contributions from many
- others, a complete list can be found in the file AUTHORS.
+ The original author of Bacula is Kern Sibbald, with contributions
+ from many others, a complete list can be found in the file AUTHORS.
- Licensees holding a valid Bacula Systems SA license may use this file
- and others of this release in accordance with the proprietary license
- agreement provided in the LICENSE file. Redistribution of any part of
- this release is not permitted.
+ You may use this file and others of this release according to the
+ license defined in the LICENSE file, which includes the Affero General
+ Public License, v3.0 ("AGPLv3") and some additional permissions and
+ terms pursuant to its AGPLv3 Section 7.
- Bacula® is a registered trademark of Kern Sibbald.
-*/
+ This notice must be preserved when any source code is
+ conveyed and/or propagated.
+
+ Bacula(R) is a registered trademark of Kern Sibbald.
+ */
/**
* @file smartptr_test.cpp
* @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
/*
- Bacula® - The Network Backup Solution
+ Bacula(R) - The Network Backup Solution
- Copyright (C) 2007-2017 Bacula Systems SA
- All rights reserved.
+ Copyright (C) 2000-2020 Kern Sibbald
- The main author of Bacula is Kern Sibbald, with contributions from many
- others, a complete list can be found in the file AUTHORS.
+ The original author of Bacula is Kern Sibbald, with contributions
+ from many others, a complete list can be found in the file AUTHORS.
- Licensees holding a valid Bacula Systems SA license may use this file
- and others of this release in accordance with the proprietary license
- agreement provided in the LICENSE file. Redistribution of any part of
- this release is not permitted.
+ You may use this file and others of this release according to the
+ license defined in the LICENSE file, which includes the Affero General
+ Public License, v3.0 ("AGPLv3") and some additional permissions and
+ terms pursuant to its AGPLv3 Section 7.
- Bacula® is a registered trademark of Kern Sibbald.
-*/
-/*
- * File: test_rhv_backend.c
- * Author: radekk, radoslaw@korzeniewski.net
- *
- * Copyright (c) 2017 by Inteos sp. z o.o.
- * All rights reserved. IP transferred to Bacula Systems according to agreement.
- * This is a dumb and extremely simple backend simulator used for test swift Plugin.
+ This notice must be preserved when any source code is
+ conveyed and/or propagated.
+
+ Bacula(R) is a registered trademark of Kern Sibbald.
+ */
+/**
+ * @file test_metaplugin_backend.cpp
+ * @author Radosław Korzeniewski (radoslaw@korzeniewski.net)
+ * @brief This is a dumb and extremely simple backend simulator used for test Metaplugin.
+ * @version 2.1.0
+ * @date 2020-12-23
*
+ * @copyright Copyright (c) 2020 All rights reserved. IP transferred to Bacula Systems according to agreement.
*/
#include <stdio.h>
#define BUFLEN 4096
#define BIGBUFLEN 65536
- void LOG(const char *txt)
+void LOG(const char *txt)
{
char _buf[BUFLEN];
const char *longfilename = longfilenamestr;
// test for fname > 500c
+#if __cplusplus > 201103L
static_assert(sizeof(longfilenamestr) > 500);
+#endif
snprintf(buf, BIGBUFLEN, "FNAME:%s/%s\n", PLUGINPREFIX, longfilename);
write_plugin('C', buf);
write_plugin('C', "STAT:F 234560 901 901 0100640 1\n");