//***********************************************************************
//
// $Source: /home/torsten/cvs/bar/errors.def,v $
// $Revision$
// $Author$
// Contents: Backup ARchiver errors definition
// Systems: all
//
//***********************************************************************

INCLUDE <config.h>
INCLUDE <common/misc.h>

#ifdef HAVE_LIBSSH2
INCLUDE "libssh2.h"
#endif

IMPORT java.lang.System

NONE    "none"
DEFAULT "unknown"

// --- general ----------------------------------------------------------
ERROR INSUFFICIENT_MEMORY              TR("insufficient memory")
ERROR INIT                             TR("initialize failed")
ERROR INVALID_ARGUMENT                 TR("invalid argument")
ERROR CONFIG                           TR("configuration error")
ERROR NO_WRITABLE_CONFIG               TR("no writable configuration file")
ERROR ABORTED                          TR("aborted")
ERROR INTERRUPTED                      TR("interrupted")
ERROR FUNCTION_NOT_SUPPORTED           TR("function not supported")
ERROR STILL_NOT_IMPLEMENTED            TR("function still not implemented")
ERROR RUN_SERVICE                      TR("run as daemon/service failed")
ERROR IPC                              TR("inter-process communication failed")
ERROR INIT_PASSWORD                    TR("initialize password failed")
ERROR NO_PASSWORD                      TR("no password given")
// Note: because of name clash with Windows include use INVALID_PASSWORD_ instead of INVALID_PASSWORD
ERROR INVALID_PASSWORD_                TR("invalid password")
ERROR PROCESS                          TR("process data failed")
ERROR ERROR_INVALID_ENCODING           TR("invalid encoding")
ERROR CONVERT_CHARS                    TR("convert characters")

// --- patterns ---------------------------------------------------------
// patterns
ERROR INVALID_PATTERN
  stringSet(errorText,sizeof(errorText),TR("invalid pattern"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": '%s'",ERROR_DATA);
  }

// --- network ----------------------------------------------------------
ERROR NO_HOST_NAME                     TR("no host name given")
ERROR HOST_NOT_FOUND
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringFormat(errorText,sizeof(errorText),"host '%s' not found",ERROR_DATA);
  }
  else
  {
    stringSet(errorText,sizeof(errorText),TR("host not found"));
  }

ERROR BIND_FAIL
  stringSet(errorText,sizeof(errorText),TR("bind failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR CONNECT_FAIL
  stringSet(errorText,sizeof(errorText),TR("connect failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR CONNECT_TIMEOUT                  TR("connect timeout")
ERROR DISCONNECTED                     TR("disconnected")

ERROR TOO_MANY_CONNECTIONS             TR("too many concurrent connections")
ERROR NO_LOGIN_NAME                    TR("no login name given")
ERROR NO_LOGIN_PASSWORD                TR("no password given")
ERROR NETWORK_SEND
  stringSet(errorText,sizeof(errorText),TR("sending data failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR NETWORK_RECEIVE                  TR("receiving data failed")
ERROR NETWORK_EXECUTE_FAIL             TR("execute command failed")
ERROR NETWORK_TIMEOUT_SEND             TR("timeout send data")
ERROR NETWORK_TIMEOUT_RECEIVE          TR("timeout receive data")
ERROR NO_RESPONSE                      TR("no response from remote")
ERROR INVALID_RESPONSE                 TR("invalid response from remote")
ERROR BAD_REQUEST                      TR("bad request")

// --- TLS/SSL ----------------------------------------------------------
ERROR INIT_TLS                         TR("initialize (TLS/SSL) failed")
ERROR NO_TLS_CA                        TR("no (TLS/SSL) certificate authority file")
ERROR NO_TLS_CERTIFICATE               TR("no (TLS/SSL) certificate file")
ERROR NO_TLS_KEY                       TR("no (TLS/SSL) key file")
ERROR INVALID_TLS_CA                   TR("invalid (TLS/SSL) certificate authority")
ERROR INVALID_TLS_CERTIFICATE          TR("invalid (TLS/SSL) certificate")
ERROR READ_CERTIFICATE_FAIL            TR("read (TLS/SSL) certificate fail")
ERROR CORRUPT_CERTIFICATE              TR("corrupt (TLS/SSL) certificate")
ERROR TLS_CERTIFICATE_EXPIRED
  stringSet(errorText,sizeof(errorText),TR("TLS (SSL) certificate expired"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR TLS_CERTIFICATE_NOT_ACTIVE
  stringSet(errorText,sizeof(errorText),TR("TLS (SSL) certificate is still not active"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR TLS_HANDSHAKE
  stringSet(errorText,sizeof(errorText),TR("TLS (SSL) handshake failedure"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR INVALID_SSH_SPECIFIER            TR("invalid SSH specifier")
ERROR NO_SSH_PUBLIC_KEY                TR("no SSH public key")
ERROR NO_SSH_PRIVATE_KEY               TR("no SSH private key")
ERROR NO_SSH_PASSWORD
  stringSet(errorText,sizeof(errorText),TR("no SSH password given"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendChar(errorText,sizeof(errorText),' ');
    stringAppend(errorText,sizeof(errorText),TR("for '{0}'",ERROR_DATA));
  }

ERROR INVALID_SSH_PASSWORD
  stringSet(errorText,sizeof(errorText),TR("invalid SSH password"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendChar(errorText,sizeof(errorText),' ');
    stringAppend(errorText,sizeof(errorText),TR("for '{0}'",ERROR_DATA));
  }

ERROR INVALID_SSH_PRIVATE_KEY
  stringSet(errorText,sizeof(errorText),TR("invalid SSH private key"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s (code: %d)",ERROR_DATA,ERROR_ERRNO);
  }

ERROR SSH_SESSION_FAIL                 TR("initialize SSH session failed")
ERROR SSH_AUTHENTICATION
  stringSet(errorText,sizeof(errorText),TR("SSH authentication failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s (code: %d)",ERROR_DATA,ERROR_ERRNO);
  }

ERROR SSH
  stringSet(errorText,sizeof(errorText),TR("ssh protocol error"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s (code: %d)",ERROR_DATA,ERROR_ERRNO);
  }

// --- SMB/CIFS ---------------------------------------------------------

ERROR INVALID_SMB_SPECIFIER            TR("invalid SMB/CIFS specifier")
ERROR NO_SMB_PASSWORD
  stringSet(errorText,sizeof(errorText),TR("no SMB/CIFS password given"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendChar(errorText,sizeof(errorText),' ');
    stringAppend(errorText,sizeof(errorText),TR("for '{0}'",ERROR_DATA));
  }

ERROR SMB_SESSION_FAIL                 TR("initialize SMB/CIFS session failed")
ERROR SMB_AUTHENTICATION
  stringSet(errorText,sizeof(errorText),TR("SMB/CIFS authentication failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s (code: %d)",ERROR_DATA,ERROR_ERRNO);
  }

ERROR INVALID_SMB_PASSWORD
  stringSet(errorText,sizeof(errorText),TR("invalid SMB/CIFS password"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendChar(errorText,sizeof(errorText),' ');
    stringAppend(errorText,sizeof(errorText),TR("for '{0}'",ERROR_DATA));
  }

ERROR SMB
  stringSet(errorText,sizeof(errorText),TR("SMB/CIFS protocol error"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s (code: %d)",ERROR_DATA,ERROR_ERRNO);
  }

// --- job --------------------------------------------------------------
ERROR JOB_ALREADY_EXISTS
  stringSet(errorText,sizeof(errorText),TR("job '{0}' already exists",ERROR_DATA));

ERROR JOB_RUNNING
  stringSet(errorText,sizeof(errorText),TR("job '{0}' running",ERROR_DATA));

ERROR CREATE_JOB
  stringSet(errorText,sizeof(errorText),TR("create job failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR DELETE_JOB
  stringSet(errorText,sizeof(errorText),TR("delete job failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR RENAME_JOB
  stringSet(errorText,sizeof(errorText),TR("rename job failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

// --- storage ----------------------------------------------------------
//ERROR INIT_STORAGE                     TR("initialize storage failed")
ERROR INIT_STORAGE
  stringSet(errorText,sizeof(errorText),TR("initialize storage failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR NO_STORAGE_NAME                  TR("no storage name given")
ERROR INVALID_STORAGE                  TR("invalid storage")

// --- FTP --------------------------------------------------------------
ERROR INVALID_FTP_SPECIFIER            TR("invalid FTP specifier")
ERROR FTP_SESSION_FAIL
  stringSet(errorText,sizeof(errorText),TR("initialize FTP session failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR NO_FTP_PASSWORD                  TR("no FTP password given")
ERROR INVALID_FTP_PASSWORD             TR("invalid FTP password")
ERROR FTP_AUTHENTICATION
  stringSet(errorText,sizeof(errorText),TR("invalid FTP user/password"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR FTP_GET_SIZE                     TR("get FTP file size failed")
//ERROR FTP_CREATE                       TR("create FTP file failed")
//ERROR FTP_READ                         TR("read FTP file failed")
//ERROR FTP_WRITE                        TR("write FTP file failed")
//ERROR FTP_DELETE                       TR("delete FTP file failed")

// --- WebDAV -----------------------------------------------------------
ERROR INVALID_WEBDAV_SPECIFIER         TR("invalid WebDAV specifier")
ERROR WEBDAV_SESSION_FAIL              TR("initialize WebDAV session failed")
ERROR NO_WEBDAV_PASSWORD
  stringSet(errorText,sizeof(errorText),TR("no WebDAV password given"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendChar(errorText,sizeof(errorText),' ');
    stringAppend(errorText,sizeof(errorText),TR("for '{0}'",ERROR_DATA));
  }

ERROR INVALID_WEBDAV_PASSWORD          TR("invalid WebDAV password")
ERROR WEBDAV_AUTHENTICATION
  stringSet(errorText,sizeof(errorText),TR("invalid WebDAV user/password"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR WEBDAV_GET_SIZE
  stringSet(errorText,sizeof(errorText),TR("get WebDAV file size"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText)," %s",ERROR_DATA);
  }
  stringAppend(errorText,sizeof(errorText)," ");
  stringAppend(errorText,sizeof(errorText),TR("failed"));

ERROR WEBDAV_UPLOAD
  stringSet(errorText,sizeof(errorText),TR("WebDAV upload failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR WEBDAV_DOWNLOAD
  stringSet(errorText,sizeof(errorText),TR("WebDAV download failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR WEBDAV
  stringSet(errorText,sizeof(errorText),TR("WebDAV failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s (code: %d)",ERROR_DATA,ERROR_ERRNO);
  }

// --- compress ---------------------------------------------------------
ERROR INIT_COMPRESS
  stringSet(errorText,sizeof(errorText),TR("initialize compress failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR INIT_DECOMPRESS
  stringSet(errorText,sizeof(errorText),TR("initialize decompress failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR COMPRESS_EOF                     TR("end of compressed file")
ERROR DELTA_SOURCE_NOT_FOUND
  stringSet(errorText,sizeof(errorText),TR("delta source not found"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": '%s'",ERROR_DATA);
  }

ERROR INVALID_COMPRESS_ALGORITHM       TR("invalid compress algorithm")
ERROR UNKNOWN_COMPRESS_ALGORITHM       TR("unknown compress algorithm")
ERROR COMPRESS_ALGORITHM_NOT_SUPPORTED TR("compress algorithm not supported")

ERROR DEFLATE
  stringSet(errorText,sizeof(errorText),TR("compress failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s (code: %d)",ERROR_DATA,ERROR_ERRNO);
  }

ERROR INFLATE
  stringSet(errorText,sizeof(errorText),TR("decompress failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s (code: %d)",ERROR_DATA,ERROR_ERRNO);
  }

// --- crypt ------------------------------------------------------------
ERROR UNSUPPORTED_BLOCK_LENGTH         TR("unsupported block length")
ERROR INIT_CRYPT
  stringSet(errorText,sizeof(errorText),TR("initialize crypt failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR NO_CRYPT_KEY                     TR("no crypt key for cipher")
ERROR NO_CRYPT_PASSWORD                TR("no password given for cipher")
ERROR INVALID_CRYPT_PASSWORD           TR("invalid decryption password")
ERROR CRYPT_PASSWORDS_MISMATCH         TR("encryption passwords mismatch")

ERROR INIT_CIPHER
  stringSet(errorText,sizeof(errorText),TR("initialize cipher failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR CREATE_KEY_FAIL
  stringSet(errorText,sizeof(errorText),TR("create public/private key failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR INVALID_ENCODING                 TR("invalid encoding")

ERROR INIT_KEY
  stringSet(errorText,sizeof(errorText),TR("initialize key failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR KEY_NOT_FOUND
  stringSet(errorText,sizeof(errorText),TR("public/private key not found"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR READ_KEY_FAIL
  stringSet(errorText,sizeof(errorText),TR("read public/private key failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR INVALID_KEY
  stringSet(errorText,sizeof(errorText),TR("invalid key"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR CORRUPT_KEY
  stringSet(errorText,sizeof(errorText),TR("corrupt key"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR INVALID_KEY_LENGTH               TR("invalid key length")
// Note: because of name clash with Windows include use INVALID_BLOCK_LENGTH_ instead of INVALID_BLOCK_LENGTH
ERROR INVALID_BLOCK_LENGTH_            TR("invalid block length")
ERROR INVALID_SALT_LENGTH              TR("invalid salt length")
ERROR NO_PUBLIC_CRYPT_KEY              TR("no public encryption key")
ERROR NO_PRIVATE_CRYPT_KEY             TR("no private encryption key")
ERROR NOT_A_PUBLIC_CRYPT_KEY
  stringSet(errorText,sizeof(errorText),TR("key is not a public encryption key"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR NOT_A_PRIVATE_CRYPT_KEY
  stringSet(errorText,sizeof(errorText),TR("key is not a private encryption key"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR NO_PUBLIC_SIGNATURE_KEY          TR("no public signature key")
ERROR NO_PRIVATE_SIGNATURE_KEY         TR("no private signature key")
ERROR NOT_A_PUBLIC_SIGNATURE_KEY
  stringSet(errorText,sizeof(errorText),TR("key is not a public signature key"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR NOT_A_PRIVATE_SIGNATURE_KEY
  stringSet(errorText,sizeof(errorText),TR("key is not a private signature key"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR KEY_ENCRYPT
  stringSet(errorText,sizeof(errorText),TR("key encryption failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR KEY_DECRYPT
  stringSet(errorText,sizeof(errorText),TR("key decryption failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR WRONG_PRIVATE_KEY                TR("wrong private decryption key")

ERROR INVALID_CRYPT_ALGORITHM          TR("invalid encryption algorithm")
ERROR UNKNOWN_CRYPT_ALGORITHM          TR("unknown encryption algorithm")

ERROR ENCRYPT
  stringSet(errorText,sizeof(errorText),TR("encrypt failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s (code: %d)",ERROR_DATA,ERROR_ERRNO);
  }

ERROR DECRYPT
  stringSet(errorText,sizeof(errorText),TR("decrypt failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s (code: %d)",ERROR_DATA,ERROR_ERRNO);
  }


ERROR INIT_HASH                        TR("initialize hash failed")
ERROR INVALID_HASH_ALGORITHM           TR("invalid hash algorithm")
ERROR UNKNOWN_HASH_ALGORITHM           TR("unknown hash algorithm")

ERROR INIT_MAC                         TR("initialize message authentication code failed")
ERROR INVALID_MAC_ALGORITHM            TR("invalid message authentication code algorithm")
ERROR UNKNOWN_MAC_ALGORITHM            TR("unknown message authentication code algorithm")

// --- file i/o ---------------------------------------------------------
ERROR DIRECTORY_NOT_FOUND_
  stringSet(errorText,sizeof(errorText),TR("directory not found"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR NO_FILE_NAME                     TR("no file name given")

ERROR CREATE_FILE
  stringSet(errorText,sizeof(errorText),TR("create file failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR OPEN_FILE
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringFormat(errorText,sizeof(errorText),"%s",ERROR_DATA);
  }
  else
  {
    stringSet(errorText,sizeof(errorText),TR("open file failed"));
  }

ERROR CREATE_DIRECTORY
  stringSet(errorText,sizeof(errorText),TR("create directory failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR READ_FILE
  stringSet(errorText,sizeof(errorText),TR("read file failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR END_OF_FILE
  stringSet(errorText,sizeof(errorText),TR("end of file"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR WRITE_FILE
  stringSet(errorText,sizeof(errorText),TR("write file failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR DELETE_FILE
  stringSet(errorText,sizeof(errorText),TR("delete file failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR OPEN_DIRECTORY
  stringSet(errorText,sizeof(errorText),TR("open directory"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR READ_DIRECTORY                   TR("read directory failed")

// Note: because of name clash with Windows include use FILE_EXISTS_ instead of FILE_EXISTS
ERROR FILE_EXISTS_
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringSet(errorText,sizeof(errorText),TR("file '{0}' already exists",ERROR_DATA));
  }
  else
  {
    stringSet(errorText,sizeof(errorText),TR("file already exists"));
  }

// Note: because of name clash with Windows include use FILE_NOT_FOUND_ instead of FILE_NOT_FOUND
ERROR FILE_NOT_FOUND_
  stringSet(errorText,sizeof(errorText),TR("file not found"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR FILE_ACCESS_DENIED
  stringSet(errorText,sizeof(errorText),TR("access denied"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR NOT_A_DIRECTORY
  stringSet(errorText,sizeof(errorText),TR("not a directory"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR END_OF_DIRECTORY                 TR("end of directory list")

ERROR INIT_FILE_NOTIFY
  stringSet(errorText,sizeof(errorText),TR("init file notify failed"));
  if (stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR INSUFFICIENT_FILE_NOTIFY         TR("insufficient file notify entries")

ERROR IO
  stringSet(errorText,sizeof(errorText),TR("i/o error"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s (code: %d)",ERROR_DATA,ERROR_ERRNO);
  }

// --- optical disk i/o -------------------------------------------------
ERROR OPTICAL_DISK_NOT_FOUND
  stringSet(errorText,sizeof(errorText),TR("CD/DVD/BD device not found"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR OPEN_OPTICAL_DISK
  stringSet(errorText,sizeof(errorText),TR("open CD/DVD/BD disk failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR READ_OPTICAL_DISK
  stringSet(errorText,sizeof(errorText),TR("read CD/DVD/BD disk failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR OPEN_ISO9660_FILE
  stringSet(errorText,sizeof(errorText),TR("open ISO 9660 image failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

// --- device i/o -------------------------------------------------------
ERROR NO_DEVICE_NAME                   TR("no device name given")
ERROR NOT_A_DEVICE                     TR("not a device")

ERROR OPEN_DEVICE
  stringSet(errorText,sizeof(errorText),TR("open device failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR INVALID_DEVICE_BLOCK_SIZE        TR("invalid device block size")
ERROR READ_DEVICE                      TR("read device failed")
ERROR WRITE_DEVICE                     TR("write device failed")
ERROR PARSE_DEVICE_LIST                TR("error parsing device list")

ERROR MOUNT
  stringSet(errorText,sizeof(errorText),TR("mount failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR UMOUNT
  stringSet(errorText,sizeof(errorText),TR("unmount failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

// --- archive ----------------------------------------------------------
ERROR NO_ARCHIVE_FILE_NAME             TR("no archive file name given")

ERROR NOT_AN_ARCHIVE_FILE
  stringSet(errorText,sizeof(errorText),TR("not an archive file"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR ARCHIVE_NOT_FOUND
  stringSet(errorText,sizeof(errorText),TR("archive not found"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR END_OF_ARCHIVE                   TR("end of archive")
ERROR NO_META_ENTRY                    TR("no meta entry")
ERROR NO_FILE_ENTRY                    TR("no file entry")
ERROR NO_FILE_DATA
  stringSet(errorText,sizeof(errorText),TR("no file data entry"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendChar(errorText,sizeof(errorText),' ');
    stringAppend(errorText,sizeof(errorText),TR("for '{0}'",ERROR_DATA));
  }

ERROR NO_DIRECTORY_ENTRY               TR("no directory entry")
ERROR NO_LINK_ENTRY                    TR("no link entry")
ERROR NO_HARDLINK_ENTRY                TR("no hard link entry")
ERROR NO_SPECIAL_ENTRY                 TR("no special entry")
ERROR NO_IMAGE_ENTRY                   TR("no image entry")
ERROR NO_IMAGE_DATA                    TR("no image data entry")
ERROR END_OF_DATA                      TR("end of data")
ERROR INCOMPLETE_ARCHIVE               TR("incomplete archive")
ERROR INSUFFICIENT_SPLIT_NUMBERS       TR("insufficient split number digits in name")

// Note: because of name clash with Windows include use CRC_ instead of CRC
ERROR CRC_
  stringSet(errorText,sizeof(errorText),TR("wrong CRC"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppend(errorText,sizeof(errorText)," ");
    stringAppend(errorText,sizeof(errorText),TR("at offset"));
    stringAppend(errorText,sizeof(errorText)," ");
    stringAppend(errorText,sizeof(errorText),ERROR_DATA);
  }

ERROR ENTRY_NOT_FOUND
  stringSet(errorText,sizeof(errorText),"entry not found");
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR ENTRY_INCOMPLETE
  stringSet(errorText,sizeof(errorText),TR("entry is incomplete"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR WRONG_ENTRY_TYPE
  stringSet(errorText,sizeof(errorText),TR("wrong entry type"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR ENTRIES_DIFFER
  stringSet(errorText,sizeof(errorText),TR("entries differ"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR CORRUPT_DATA
  stringSet(errorText,sizeof(errorText),TR("corrupt data or invalid password"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR INVALID_CHUNK_SIZE               TR("invalid chunk size")
ERROR UNKNOWN_CHUNK
  stringSet(errorText,sizeof(errorText),TR("unknown chunk"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR INVALID_SIGNATURE                TR("invalid signature")

// --- incremental files ------------------------------------------------
ERROR NOT_AN_INCREMENTAL_FILE          TR("invalid incremental file")
ERROR WRONG_INCREMENTAL_FILE_VERSION   TR("wrong incremental file version")
ERROR CORRUPT_INCREMENTAL_FILE         TR("corrupt incremental file")

// --- device -----------------------------------------------------------
ERROR INVALID_DEVICE_SPECIFIER         TR("invalid device specifier")
ERROR LOAD_VOLUME_FAIL                 TR("load volume failed")

// --- exec -------------------------------------------------------------
ERROR PARSE_COMMAND
  stringSet(errorText,sizeof(errorText),TR("parse command failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": '%s'",ERROR_DATA);
  }

ERROR EXPAND_TEMPLATE                  TR("expand command template failed")
ERROR IO_REDIRECT_FAIL
  stringSet(errorText,sizeof(errorText),TR("i/o redirect failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR EXEC_FAIL
  stringSet(errorText,sizeof(errorText),TR("execute external program failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR EXEC_TERMINATE
  stringSet(errorText,sizeof(errorText),TR("terminated external program"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

// --- BARControl protocol ----------------------------------------------
ERROR PARSE
  stringSet(errorText,sizeof(errorText),TR("parsing data failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR PARSE_DATE
  stringSet(errorText,sizeof(errorText),TR("parsing date failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR PARSE_TIME
  stringSet(errorText,sizeof(errorText),TR("parsing time failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR PARSE_WEEKDAYS
  stringSet(errorText,sizeof(errorText),TR("parsing weekdays failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR PARSE_MAINTENANCE
  stringSet(errorText,sizeof(errorText),TR("parsing maintenance failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR PARSE_SCHEDULE
  stringSet(errorText,sizeof(errorText),TR("parsing schedule failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR UNKNOWN_COMMAND
  stringSet(errorText,sizeof(errorText),TR("unknown command"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR EXPECTED_PARAMETER
  stringSet(errorText,sizeof(errorText),TR("expected parameter"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR UNKNOWN_VALUE
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringSet(errorText,sizeof(errorText),ERROR_DATA);
  }
  else
  {
    stringSet(errorText,sizeof(errorText),TR("unknown value"));
  }

ERROR INVALID_VALUE
  stringSet(errorText,sizeof(errorText),TR("invalid value"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR DEPRECATED_OR_IGNORED_VALUE
  stringSet(errorText,sizeof(errorText),TR("deprecated or ignored value"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR AUTHORIZATION                    TR("authorization failed")
ERROR JOB_NOT_FOUND
  stringSet(errorText,sizeof(errorText),TR("job not found"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR SCHEDULE_NOT_FOUND
  stringSet(errorText,sizeof(errorText),TR("schedule not found"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR PERSISTENCE_ID_NOT_FOUND
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringFormat(errorText,sizeof(errorText),"persistence with id #%s not found",ERROR_DATA);
  }
  else
  {
    stringSet(errorText,sizeof(errorText),TR("persistence not found"));
  }

ERROR MAINTENANCE_ID_NOT_FOUND
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringFormat(errorText,sizeof(errorText),"maintenance with id #%s not found",ERROR_DATA);
  }
  else
  {
    stringSet(errorText,sizeof(errorText),TR("maintenance not found"));
  }

ERROR SERVER_ID_NOT_FOUND
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringFormat(errorText,sizeof(errorText),"server with id #%s not found",ERROR_DATA);
  }
  else
  {
    stringSet(errorText,sizeof(errorText),TR("server not found"));
  }

ERROR ENTRY_ID_NOT_FOUND
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringFormat(errorText,sizeof(errorText),"entry with id #%s not found",ERROR_DATA);
  }
  else
  {
    stringSet(errorText,sizeof(errorText),TR("entry not found"));
  }

ERROR PATTERN_ID_NOT_FOUND
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringFormat(errorText,sizeof(errorText),"pattern with id #%s not found",ERROR_DATA);
  }
  else
  {
    stringSet(errorText,sizeof(errorText),TR("pattern not found"));
  }

ERROR MOUNT_ID_NOT_FOUND
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringFormat(errorText,sizeof(errorText),"mount with id #%s not found",ERROR_DATA);
  }
  else
  {
    stringSet(errorText,sizeof(errorText),TR("mount not found"));
  }

ERROR DELTA_SOURCE_ID_NOT_FOUND
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringFormat(errorText,sizeof(errorText),"delta source with id #%s not found",ERROR_DATA);
  }
  else
  {
    stringSet(errorText,sizeof(errorText),TR("delta source not found"));
  }

// --- index database ---------------------------------------------------
ERROR DATABASE
  stringSet(errorText,sizeof(errorText),TR("database"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR DATABASE_INVALID
  stringSet(errorText,sizeof(errorText),TR("invalid database URI"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR DATABASE_NOT_SUPPORTED           TR("database type not supported")

ERROR DATABASE_EXISTS                  TR("database already exists")
ERROR DATABASE_NOT_FOUND               TR("database not found")
ERROR DATABASE_CONNECT                 TR("connect to database failed")
ERROR DATABASE_CONNECTION_LOST         TR("database connection lost")
ERROR DATABASE_AUTHORIZATION           TR("database authorization failed")

ERROR DATABASE_VERSION
  stringSet(errorText,sizeof(errorText),TR("insufficient database version"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR DATABASE_VERSION_UNKNOWN         TR("unknown version of index")
ERROR DATABASE_MISSING_TABLE
  stringSet(errorText,sizeof(errorText),TR("missing table"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText)," '%s'",ERROR_DATA);
  }

ERROR DATABASE_MISSING_COLUMN
  stringSet(errorText,sizeof(errorText),TR("missing column"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText)," '%s'",ERROR_DATA);
  }

ERROR DATABASE_OBSOLETE_TABLE
  stringSet(errorText,sizeof(errorText),TR("obsolete table"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText)," '%s'",ERROR_DATA);
  }

ERROR DATABASE_OBSOLETE_COLUMN
  stringSet(errorText,sizeof(errorText),TR("obsolete column"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText)," '%s'",ERROR_DATA);
  }

ERROR DATABASE_BIND
  stringSet(errorText,sizeof(errorText),TR("database bind failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR DATABASE_TYPE_MISMATCH
  stringSet(errorText,sizeof(errorText),TR("type mismatch"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText)," '%s'",ERROR_DATA);
  }

ERROR DATABASE_CREATE_INDEX            TR("error creating index")
ERROR DATABASE_INDEX_NOT_FOUND         TR("index not found")
ERROR DATABASE_INDEX_NOT_READY         TR("index still not initialized")
ERROR DATABASE_INVALID_INDEX
  stringSet(errorText,sizeof(errorText),TR("invalid index"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR DATABASE_PARSE_ID
  stringSet(errorText,sizeof(errorText),TR("parse index id failed"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR DATABASE_LOCKED
  stringSet(errorText,sizeof(errorText),TR("database is locked"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR DATABASE_BUSY                    TR("database busy")
ERROR DATABASE_INTERRUPTED             TR("database operation interrupted")
ERROR DATABASE_TIMEOUT
  stringSet(errorText,sizeof(errorText),TR("timeout accessing index"));
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText),": %s",ERROR_DATA);
  }

ERROR DATABASE_ENTRY_NOT_FOUND         TR("database entry not found")

// --- master/slave -----------------------------------------------------
ERROR MASTER_DISCONNECTED              TR("master disconnected")
ERROR SLAVE_DISCONNECTED               TR("slave disconnected")
ERROR NOT_PAIRED                       TR("slave is not paired")
ERROR NOT_A_SLAVE                      TR("instance is not a slave")

// --- debugging only ---------------------------------------------------
ERROR TESTCODE
  stringSet(errorText,sizeof(errorText),"test code");
  if (!stringIsEmpty(ERROR_DATA))
  {
    stringAppendFormat(errorText,sizeof(errorText)," %s",ERROR_DATA);
  }

// end of file
