1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240
|
#ifndef BUDEFS_H
#define BUDEFS_H BUDEFS_H
#include "version.h"
#include <sys/stat.h>
#ifdef HAVE_SYS_MODE_H
#include <sys/mode.h>
#endif
#include <x_types.h>
#define ENDOFARCHIVE -1
#define REGFILE 1
#define FIFO 2
#define SYMLINK 3
#define HARDLINK 4
#define DIRECTORY 5
#define BLOCKDEVICE 6
#define CHARDEVICE 7
#define SOCKET 55
#define INFORMATION 100
#define FILECONTENTS 99
#define FILECONTENTS_O 111
#define IS_REGFILE(statbuf) S_ISREG(statbuf.st_mode)
#define IS_FIFO(statbuf) S_ISFIFO(statbuf.st_mode)
#define IS_SYMLINK(statbuf) S_ISLNK(statbuf.st_mode)
#define IS_HARDLINK(statbuf) (statbuf.st_nlink > 1)
#define IS_DIRECTORY(statbuf) S_ISDIR(statbuf.st_mode)
#define IS_BLOCKDEV(statbuf) S_ISBLK(statbuf.st_mode)
#define IS_CHARDEV(statbuf) S_ISCHR(statbuf.st_mode)
#define IS_SOCKET(statbuf) S_ISSOCK(statbuf.st_mode)
#define FILECONTPREFIX "/../"
#define FILECONTZPREFIX "//../"
#define LOCALDEVPREFIX ".//."
#define FILECONTOPTION "-r"
#define FILECONTZOPTION "-R"
#define LOCALDEVOPTION "-m"
#define NOOPERATION '\0'
#define WRITETOTAPE 'W'
#define SETCARTRIDGE 'c'
#define SETFILE 'f'
#define OSETCARTRIDGE 'C'
#define OSETFILE 'F'
#define SKIPFILES 'S'
#define SETCARTSET 's'
#define GOODBYE 'X'
#define ERASETAPE 'E'
#define READFROMTAPE 'R'
#define OPENFORREAD '<'
#define CLOSETAPE '*'
#define OPENFORWRITE '>'
#define CLOSETAPEN '.'
#define OPENFORRAWREAD 'r'
#define OPENFORRAWWRITE 'w'
#define QUERYPOSITION 'p'
#define QUERYWRPOSITION 'i'
#define OQUERYPOSITION 'P'
#define OQUERYWRPOSITION 'I'
#define QUERYNUMCARTS '@'
#define QUERYRDYFORSERV '?'
#define CLIENTBACKUP '|'
#define OCLIENTBACKUP '~'
#define SETBUFFEREDOP '+'
#define SETSERIALOP '-'
#define SETCHCARTONEOT '^'
#define SETERRORONEOT '_'
#define COMMAND_OK '\0'
#define CLOSE_FAILED '*'
#define OPENRD_FAILED '<'
#define OPENWR_FAILED '>'
#define DEVINUSE 'U'
#define SERVICEINUSE 'B'
#define DEVNOTOPENRD 'R'
#define DEVNOTOPENWR 'W'
#define DEVNOTREADY '-'
#define ENDOFFILEREACHED '.'
#define ENDOFTAPEREACHED ':'
#define PROTOCOL_ERROR 'p'
#define CHANGECART_FAILED 'C'
#define SETFILE_FAILED 'F'
#define ERASETAPE_FAILED 'E'
#define FATAL_ERROR '!'
#define CONFIG_ERROR '$'
#define REOPEN_FAILED '~'
#define NO_VALID_CARTRIDGE '@'
#define NO_VALID_FILENUM '#'
#define NO_VALID_CARTSET 's'
#define AUTHENTICATION '='
#define SUBPROCESS_FAILED 'S'
#define RESERVED_ERROR_CODE 1
#define WARNING 0
#define MODE_CREATE 'c'
#define MODE_EXTRACT 'x'
#define MODE_CONTENTS 't'
#define MODE_VERIFY 'd'
#define MODE_INDEX 'I'
#define MODE_NONE '\0'
#define STREAMER_UNKNOWN 0
#define STREAMER_READY 1
#define STREAMER_UNLOADED 2
#define STREAMER_BUSY 3
#define STREAMER_DEVINUSE 4
#define STREAMER_UNAVAIL 5
#define STREAMER_STATE_MASK 0x0f
#define STREAMER_CHANGEABLE (1 << 4)
#define STREAMER_FLAGS_MASK 0xf0
#define DEFBINDIR "@clientbindir@"
#define DEFVARDIR "@clientvardir@"
#define DEFLIBDIR "@clientlibdir@"
#define DEFLOGDIR "@clientlogdir@"
#define DEFSERVBINDIR "@serverbindir@"
#define DEFSERVVARDIR "@servervardir@"
#define DEFSERVLIBDIR "@serverlibdir@"
#define DEFCLIENTCONF "@clientconf@"
#define DEFSERVERCONF "@serverconf@"
#define PREVIOUS_CARTRIDGE 0x00ffffff /* -1 in 3 bytes */
#define INFOBLOCKSIZE 500
#define INFOHEADER "AF's backup system\n\nINFO HEADER"
#define CARTNOTEXT "Cartridge number:\t"
#define DATETEXT "Labeling time:\t\t"
#define VERSIONTEXT "Program version:\t" VERSION_NUMBER
#define VERBOSE_NORMAL 1
#define VERBOSE_CART_FILE (VERBOSE_NORMAL << 1)
#define VERBOSE_UID (VERBOSE_NORMAL << 2)
#define VERBOSE_LOCATION (VERBOSE_NORMAL << 3)
#include "cryptkey.h"
#ifndef ACCESSKEY
#define ACCESSKEY 0x6b31e5a9
#endif
/* size of communications buffer */
#ifndef COMMBUFSIZ
#define COMMBUFSIZ 1000
#endif
/* for technical reasons BUFFERSIZ must be >= MAXPATHLEN (/sys/param.h) */
#if (COMMBUFSIZ < 2000)
#define BUFFERSIZ 2000
#else
#define BUFFERSIZ COMMBUFSIZ
#endif
#define PROC_MAX_TRIES 10
#define CARTREADY_FILE "/tmp/afbu_cartready"
#define GREETING_MESSAGE "AF's backup server ready.\n"
#define COMPRESS_SUFFIX ".z"
#define TMP_SUFFIX ".tmp"
#define UIDSEP "|"
#define LOCSEP "!"
#define PORTSEP "%"
#define SEPLOC "@"
#ifndef hpux
#define MT_FILE_OPTION "-f"
#else
#define MT_FILE_OPTION "-t"
#endif
#ifdef sun
#define DEFAULT_TAPE_DEVICE "/dev/rmt/0bn"
#define END_OF_TAPE errno == ENOSPC
#endif
#ifdef _AIX
#define DEFAULT_TAPE_DEVICE "/dev/rmt0.1"
#define END_OF_TAPE errno == ENXIO || errno == ENOSPC
#endif
#ifdef sgi
#define DEFAULT_TAPE_DEVICE "/dev/tps0d4nr"
#define END_OF_TAPE errno == ENOSPC
#endif
#ifdef linux
#define DEFAULT_TAPE_DEVICE "/dev/nst0"
#define END_OF_TAPE errno == ENOSPC
#endif
#ifdef __osf__
#define DEFAULT_TAPE_DEVICE "/dev/nrmt0"
#define END_OF_TAPE errno == ENOSPC
#endif
#ifdef hpux
#define DEFAULT_TAPE_DEVICE "/dev/rmt/0hnb"
#define END_OF_TAPE errno == ENOSPC || errno == ENOSPC
#endif
#ifdef __FreeBSD__
#define DEFAULT_TAPE_DEVICE "/dev/nrst0"
#define END_OF_TAPE errno == ENOSPC
#endif
#if ! defined(sun) && ! defined(_AIX) && ! defined(sgi) && ! defined(linux) && ! defined(__osf__) && ! defined(hpux) && ! defined(__FreeBSD__)
# error unknown architecture
#endif
#define DEFAULT_CLIENT_CONFIGFILES \
"/etc/buclient.conf", \
"/etc/afbackup/client.conf"
#define DEFAULT_SERVER_CONFIGFILES \
"/etc/buserver.conf", \
"/etc/afbackup/server.conf"
#define DEFAULT_SETFILECMD "mt " \
MT_FILE_OPTION " %d rewind && mt " \
MT_FILE_OPTION " %d fsf %m"
#define DEFAULT_SKIPFILESCMD "mt " MT_FILE_OPTION " %d fsf %n"
#define DEFAULT_NEXTCARTCMD "mt " MT_FILE_OPTION " %d rewoffl"
#define DEFAULT_WEOFCMD "mt " MT_FILE_OPTION " %d eof"
#define DEFAULT_TAPEPOSFILE "@servervardir@/tapepos"
#define DEFAULT_PREFCLIENTFILE "@servervardir@/prefclient"
#define DEFAULT_USERTOINFORM "postmaster"
#define DEFAULT_MAILPROGRAM "mail"
#define DEFAULT_TAPEBLOCKSIZE 512
#define DEFAULT_MAXBYTESPERFILE 50000000
#define DEFAULT_CARTGRACETIME 120
#define DEFAULT_DEVUNAVSENDMAIL 5
#define DEFAULT_DEVUNAVGIVEUP 60
#define DEFAULT_DEVPROBEITV 2
#define DEFAULT_SERVERLOCKFILE "Lck.afbu_server"
#define DEFAULT_CLIENTLOCKFILE "Lck.afbu_client"
#define DEFAULT_SERVER "backuphost"
#define DEFAULT_PORT 0xbac
#define DEFAULT_SERVICE "afbackup"
#define ALIGN_4(i) (((((long int) (i) - 1) >> 2) + 1) << 2)
#endif /* !defined(BUDEFS_H) */
|